Skip to content

Commit

Permalink
feature: fix types for base class
Browse files Browse the repository at this point in the history
  • Loading branch information
4x8Matrix committed Jan 16, 2025
1 parent bfcf007 commit 8651ed3
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 30 deletions.
8 changes: 4 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"luau-lsp.inlayHints.parameterTypes": true,
"luau-lsp.inlayHints.typeHintMaxLength": 50,
"luau-lsp.require.mode": "relativeToFile",
"luau-lsp.fflags.override": {
"LuauTarjanChildLimit": "0",
"LuauTypeInferIterationLimit": "0",
}
// "luau-lsp.fflags.override": {
// "LuauTarjanChildLimit": "0",
// "LuauTypeInferIterationLimit": "0",
// }
}
7 changes: 1 addition & 6 deletions development.luau
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,4 @@ discordBot.onAllShardsReady:listen(function()
end)

print(`Connecting to Discord...`)
discordBot
:connectAsync()
:after(function()
print("Connected to Discord!")
end)
:poll()
discordBot:connectAsync():await()
42 changes: 22 additions & 20 deletions packages/discord_luau/src/bot.luau
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function Bot.Prototype.queryGatewayInformation(self: Bot)
assert(response:isOk(), response:unwrapErr())

return response:unwrapOk()
end) :: any
end) :: future.FutureLike<string, apiTypes.GetGatewayBotResponse>
end

--[[
Expand Down Expand Up @@ -296,7 +296,9 @@ function Bot.Prototype.connectAsync(self: Bot)

self.state.webSocketManager:connectAsync(gatewayInformation:unwrapOk()):poll()
self.state.webSocketManager.onConnected:wait()
end) :: any

return nil
end) :: future.FutureLike<string, nil>
end

--[[
Expand All @@ -316,7 +318,7 @@ function Bot.Prototype.getGuildAsync(self: Bot, guildId: string, withCount: bool
assert(response:isOk(), response:unwrapErr())

return classes.guild.guild.new(self.state, response:unwrapOk())
end) :: any
end) :: future.FutureLike<string, classes.Guild>
end

--[[
Expand All @@ -334,7 +336,7 @@ function Bot.Prototype.getChannelAsync<T>(self: Bot, channelId: string)
assert(response:isOk(), response:unwrapErr())

return classes.channels.construct(self.state, response:unwrapOk())
end) :: any
end) :: future.FutureLike<string, classes.Channel>
end

--[[
Expand All @@ -346,8 +348,8 @@ function Bot.Prototype.getDMChannelAsync(self: Bot, channelId: string)
return future.Future.new(function()
local channel = self:getChannelAsync(channelId):await():unwrapOk()

return channel :: classes.DM
end) :: any
return channel
end) :: future.FutureLike<string, classes.DM>
end

--[[
Expand All @@ -359,8 +361,8 @@ function Bot.Prototype.getGroupDMChannelAsync(self: Bot, channelId: string)
return future.Future.new(function()
local channel = self:getChannelAsync(channelId):await():unwrapOk()

return channel :: classes.GroupDM
end) :: any
return channel
end) :: future.FutureLike<string, classes.GroupDM>
end

--[[
Expand All @@ -372,8 +374,8 @@ function Bot.Prototype.getAnnouncementChannelAsync(self: Bot, channelId: string)
return future.Future.new(function()
local channel = self:getChannelAsync(channelId):await():unwrapOk()

return channel :: classes.GuildAnnouncement
end) :: any
return channel
end) :: future.FutureLike<string, classes.GuildAnnouncement>
end

--[[
Expand All @@ -385,8 +387,8 @@ function Bot.Prototype.getCategoryChannelAsync(self: Bot, channelId: string)
return future.Future.new(function()
local channel = self:getChannelAsync(channelId):await():unwrapOk()

return channel :: classes.GuildCategory
end) :: any
return channel
end) :: future.FutureLike<string, classes.GuildCategory>
end

--[[
Expand All @@ -398,8 +400,8 @@ function Bot.Prototype.getDirectoryChannelAsync(self: Bot, channelId: string)
return future.Future.new(function()
local channel = self:getChannelAsync(channelId):await():unwrapOk()

return channel :: classes.GuildDirectory
end) :: any
return channel
end) :: future.FutureLike<string, classes.GuildDirectory>
end

--[[
Expand All @@ -411,8 +413,8 @@ function Bot.Prototype.getStageVCChannelAsync(self: Bot, channelId: string)
return future.Future.new(function()
local channel = self:getChannelAsync(channelId):await():unwrapOk()

return channel :: classes.GuildStageVoice
end) :: any
return channel
end) :: future.FutureLike<string, classes.GuildStageVoice>
end

--[[
Expand All @@ -424,8 +426,8 @@ function Bot.Prototype.getTextChannelAsync(self: Bot, channelId: string)
return future.Future.new(function()
local channel = self:getChannelAsync(channelId):await():unwrapOk()

return channel :: classes.GuildText
end) :: any
return channel
end) :: future.FutureLike<string, classes.GuildText>
end

--[[
Expand All @@ -437,8 +439,8 @@ function Bot.Prototype.getVoiceChannelAsync(self: Bot, channelId: string)
return future.Future.new(function()
local channel = self:getChannelAsync(channelId):await():unwrapOk()

return channel :: classes.GuildVoice
end) :: any
return channel
end) :: future.FutureLike<string, classes.GuildVoice>
end

function Bot.Interface.new(options: {
Expand Down

0 comments on commit 8651ed3

Please sign in to comment.