Bot
Top level documentation for the Discord-Luau library, welcome! 👋
This package will represent the entrypoint to your adventure using Discord-Luau, through this package you’ll generate a discord Bot object, this bot Object enables you to write discord bots for the Discord API.
local DiscordLuau = require("/path/to/discord-luau")local Bot = DiscordLuau.bot -- This module!
local discordBot = Bot.new({ token = env.DISCORD_BOT_TOKEN, reconnect = env.IS_PRODUCTION, intents = 513, -- Guild, GuildMessages})
discordBot:connectAsync():await()
print(`Bot has connected: '{discordBot.user.username}'`)Summary
Properties
Bot.state :: State.StateBot.logger :: LoggerBot.application :: Classes.Application?Bot.user :: Classes.User?Bot.onReady :: Emitter<number>Bot.onAllShardsReady :: Emitter<()>Bot.onShardDisconnected :: Emitter<number, string>Bot.onShardReconnected :: Emitter<number>Bot.onMessage :: Emitter<Classes.Message>Bot.onMessageChanged :: Emitter<Classes.Message>Bot.onMessageDeleted :: Emitter<{ messageId: apiTypes.Snowflake, channelId: apiTypes.Snowflake, guildId: apiTypes.Snowflake? }>Bot.onMessageBulkDeleted :: Emitter<{ channelId: string, guildId: string?, ids: { string } }>Bot.onGroupDMChannelCreate :: Emitter<Classes.GroupDM>Bot.onCategoryChannelCreate :: Emitter<Classes.GuildCategory>Bot.onAnnouncementChannelCreate :: Emitter<Classes.GuildAnnouncement>Bot.onDirectoryChannelCreate :: Emitter<Classes.GuildDirectory>Bot.onDMChannelCreate :: Emitter<Classes.DM>Bot.onTextChannelCreate :: Emitter<Classes.GuildText>Bot.onVoiceChannelCreate :: Emitter<Classes.GuildVoice>Bot.onStageVoiceChannelCreate :: Emitter<Classes.GuildStageVoice>Bot.onGroupDMChannelUpdated :: Emitter<Classes.GroupDM>Bot.onCategoryChannelUpdated :: Emitter<Classes.GuildCategory>Bot.onAnnouncementChannelUpdated :: Emitter<Classes.GuildAnnouncement>Bot.onDirectoryChannelUpdated :: Emitter<Classes.GuildDirectory>Bot.onDMChannelUpdated :: Emitter<Classes.DM>Bot.onTextChannelUpdated :: Emitter<Classes.GuildText>Bot.onVoiceChannelUpdated :: Emitter<Classes.GuildVoice>Bot.onStageVoiceChannelUpdated :: Emitter<Classes.GuildStageVoice>Bot.onGroupDMChannelDeleted :: Emitter<Classes.GroupDM>Bot.onCategoryChannelDeleted :: Emitter<Classes.GuildCategory>Bot.onAnnouncementChannelDeleted :: Emitter<Classes.GuildAnnouncement>Bot.onDirectoryChannelDeleted :: Emitter<Classes.GuildDirectory>Bot.onDMChannelDeleted :: Emitter<Classes.DM>Bot.onTextChannelDeleted :: Emitter<Classes.GuildText>Bot.onVoiceChannelDeleted :: Emitter<Classes.GuildVoice>Bot.onStageVoiceChannelDeleted :: Emitter<Classes.GuildStageVoice>Bot.onUserUpdated :: Emitter<Classes.User>Bot.onChannelPinsUpdate :: Emitter<{ guildId: string, channelId: string, lastPinTimestamp: stdPolyfills.DateTime? }>Bot.onGuildCreate :: Emitter<classes.UnavailableGuild | classes.Guild>Bot.onGuildUpdate :: Emitter<Classes.Guild>Bot.onGuildDelete :: Emitter<Classes.UnavailableGuild>Bot.onGuildMemberBanned :: Emitter<{ guildId: string, user: classes.User }>Bot.onGuildMemberUnbanned :: Emitter<{ guildId: string, user: classes.User }>Bot.onGuildMemberJoined :: Emitter<{ guildId: string, member: Classes.GuildMember }>Bot.onGuildMemberLeft :: Emitter<{ guildId: string, user: classes.User }>Bot.onGuildMemberUpdated :: Emitter<{guildId: string,roles: { string },user: classes.User,nick: string?,avatar: string?,joinedAt: stdPolyfills.DateTime?,premiumSince: stdPolyfills.DateTime?,deaf: boolean?,mute: boolean?,pending: boolean?,communicationDisabledUntil: stdPolyfills.DateTime?,}>Bot.onPingInteraction :: Emitter<Classes.Ping>Bot.onCommandInteraction :: Emitter<Classes.TypesCommand>Bot.onComponentInteraction :: Emitter<Classes.Component>Bot.onAutocompleteInteraction :: Emitter<Classes.Autocomplete>Bot.onModalInteraction :: Emitter<Classes.Modal>Bot.onMessageReactionAdd :: Emitter<{ userId: string, channelId: string, messageId: string, guildId: string?, member: Classes.GuildMember?, emoji: Classes.Emoji, messageAuthorId: string?, burst: boolean, burstColors: { string }, reactionType: number }>Bot.onMessageReactionRemove :: Emitter<{ userId: string, channelId: string, messageId: string, guildId: string?, emoji: Classes.Emoji, burst: boolean, reactionType: number }>Bot.onMessageReactionRemoveAll :: Emitter<{ channelId: string, messageId: string, guildId: string? }>Bot.onMessageReactionRemoveEmoji :: Emitter<{ channelId: string, messageId: string, guildId: string?, emoji: Classes.Emoji }>Bot.onThreadListSync :: Emitter<{ guildId: string, channelIds: { string }?, members: { Classes.ThreadMember } }>Bot.onThreadMemberUpdate :: Emitter<{ guildId: string, threadMember: Classes.ThreadMember }>Bot.onThreadMembersUpdate :: Emitter<{ id: string, guildId: string, memberCount: number, addedMembers: { Classes.ThreadMember }, removedMemberIds: { string }? }>Bot.onEntitlementCreate :: Emitter<Classes.Entitlement>Bot.onEntitlementUpdate :: Emitter<Classes.Entitlement>Bot.onEntitlementDelete :: Emitter<Classes.Entitlement>Bot.onGuildAuditLogEntryCreate :: Emitter<Classes.AuditLogEntry>Bot.onGuildEmojisUpdate :: Emitter<{ guildId: string, emojis: { Classes.Emoji } }>Bot.onGuildStickersUpdate :: Emitter<{ guildId: string, stickers: { Classes.Sticker } }>Bot.onGuildScheduledEventCreate :: Emitter<Classes.ScheduledEvent>Bot.onGuildScheduledEventUpdate :: Emitter<Classes.ScheduledEvent>Bot.onGuildScheduledEventDelete :: Emitter<Classes.ScheduledEvent>Bot.onGuildScheduledEventUserAdd :: Emitter<{ guildScheduledEventId: string, userId: string, guildId: string }>Bot.onGuildScheduledEventUserRemove :: Emitter<{ guildScheduledEventId: string, userId: string, guildId: string }>Bot.onIntegrationCreate :: Emitter<Classes.Integration>Bot.onIntegrationUpdate :: Emitter<Classes.Integration>Bot.onIntegrationDelete :: Emitter<{ id: string, guildId: string, applicationId: string? }>Bot.onInviteCreate :: Emitter<{ channelId: string, code: string, createdAt: stdPolyfills.DateTime, guildId: string?, inviter: Classes.User?, maxAge: number, maxUses: number, targetType: number?, targetUser: Classes.User?, temporary: boolean, uses: number }>Bot.onInviteDelete :: Emitter<{ channelId: string, code: string, guildId: string? }>Bot.onAutoModerationRuleCreate :: Emitter<Classes.AutomoderationRule>Bot.onAutoModerationRuleUpdate :: Emitter<Classes.AutomoderationRule>Bot.onAutoModerationRuleDelete :: Emitter<Classes.AutomoderationRule>Bot.onAutoModerationActionExecution :: Emitter<{ guildId: string, action: apiTypes.AutomoderationActionObject, ruleId: string, ruleTriggerType: apiTypes.AutomoderationRuleTriggerType, userId: string, channelId: string?, messageId: string?, alertSystemMessageId: string?, content: string, matchedKeyword: string?, matchedContent: string? }>Bot.onApplicationCommandPermissionsUpdate :: Emitter<{ id: string, applicationId: string, guildId: string, permissions: { apiTypes.GuildApplicationCommandPermissionObject } }>Bot.onMessagePollVoteAdd :: Emitter<{ userId: string, channelId: string, messageId: string, guildId: string?, answerId: number }>Bot.onMessagePollVoteRemove :: Emitter<{ userId: string, channelId: string, messageId: string, guildId: string?, answerId: number }>Bot.onGuildRoleCreate :: Emitter<Classes.Role>Bot.onGuildRoleUpdate :: Emitter<Classes.Role>Bot.onGuildRoleDelete :: Emitter<{ guildId: string, roleId: string }>Bot.onAnnouncementThreadCreate :: Emitter<Classes.Announcement>Bot.onPublicThreadCreate :: Emitter<Classes.Public>Bot.onPrivateThreadCreate :: Emitter<Classes.Private>Bot.onAnnouncementThreadUpdate :: Emitter<Classes.Announcement>Bot.onPublicThreadUpdate :: Emitter<Classes.Public>Bot.onPrivateThreadUpdate :: Emitter<Classes.Private>Bot.onThreadDelete :: Emitter<{ id: string, guildId: string, parentId: string, type: number }>Bot.onPresenceUpdate :: Emitter<Classes.Presence>Bot.onTypingStart :: Emitter<{ channelId: string, guildId: string?, userId: string, timestamp: number, member: Classes.GuildMember? }>Bot.onGuildMembersChunk :: Emitter<{ guildId: string, members: { Classes.GuildMember }, chunkIndex: number, chunkCount: number, notFound: { string }?, nonce: string? }>Bot.onGuildIntegrationsUpdate :: Emitter<{ guildId: string }>Bot.onWebhooksUpdate :: Emitter<{ guildId: string, channelId: string }>Bot.onResumed :: Emitter<()>Bot.onVoiceStateUpdate :: Emitter<Classes.VoiceState>Bot.onVoiceServerUpdate :: Emitter<{ token: string, guildId: string, endpoint: string? }>Bot.onStageInstanceCreate :: Emitter<Classes.StageInstance>Bot.onStageInstanceUpdate :: Emitter<Classes.StageInstance>Bot.onStageInstanceDelete :: Emitter<Classes.StageInstance>Bot.onGuildSoundboardSoundCreate :: Emitter<Classes.SoundboardSound>Bot.onGuildSoundboardSoundUpdate :: Emitter<Classes.SoundboardSound>Bot.onGuildSoundboardSoundDelete :: Emitter<{ soundId: string, guildId: string }>Bot.onGuildSoundboardSoundsUpdate :: Emitter<{ guildId: string, soundboardSounds: { Classes.SoundboardSound } }>Bot.onVoiceChannelEffectSend :: Emitter<{ channelId: string, guildId: string, userId: string, emoji: Classes.Emoji?, animationType: number?, animationId: number?, soundId: string?, soundVolume: number? }>Bot.onRateLimited :: Emitter<{ opcode: number, retryAfter: number, guildId: string? }>Methods
Bot:queryGatewayInformation() → future.FutureLike<string, apiTypes.GetGatewayBotResponse>Bot:connectAsync() → future.FutureLike<string, nil>Bot:listDefaultSoundboardSoundsAsync() → future.FutureLike<string, { classes.SoundboardSound }>Bot:getGuildAsync(guildId: string, withCount: boolean?) → future.FutureLike<string, classes.Guild>Bot:getChannelAsync(channelId: string) → future.FutureLike<string, classes.Channel>Bot:getDMChannelAsync(channelId: string) → future.FutureLike<string, classes.DM>Bot:getGroupDMChannelAsync(channelId: string) → future.FutureLike<string, classes.GroupDM>Bot:getAnnouncementChannelAsync(channelId: string) → future.FutureLike<string, classes.GuildAnnouncement>Bot:getCategoryChannelAsync(channelId: string) → future.FutureLike<string, classes.GuildCategory>Bot:getDirectoryChannelAsync(channelId: string) → future.FutureLike<string, classes.GuildDirectory>Bot:getStageVCChannelAsync(channelId: string) → future.FutureLike<string, classes.GuildStageVoice>Bot:getTextChannelAsync(channelId: string) → future.FutureLike<string, classes.GuildText>Bot:getForumChannelAsync(channelId: string) → future.FutureLike<string, classes.ThreadForum>Bot:getMediaChannelAsync(channelId: string) → future.FutureLike<string, classes.ThreadMedia>Bot:getUserAsync(userId: string) → future.FutureLike<string, classes.User>Bot:setLogLevel(logLevel: logger.LogLevel)Bot:getVoiceChannelAsync(channelId: string) → future.FutureLike<string, classes.GuildVoice>Bot:requestGuildMembersAsync(guildId: apiTypes.Snowflake, params: { query: string?, limit: number, presences: boolean?, userIds: { apiTypes.Snowflake }?, nonce: string?, }) → future.FutureLike<string, nil>Bot:setPresenceAsync(presence: builders.presenceJSON) → future.FutureLike<string, nil>Properties
Section titled “Properties”logger
Section titled “logger”application
Section titled “application”onReady
Section titled “onReady”onAllShardsReady
Section titled “onAllShardsReady”onShardDisconnected
Section titled “onShardDisconnected”onShardReconnected
Section titled “onShardReconnected”onMessage
Section titled “onMessage”onMessageChanged
Section titled “onMessageChanged”onMessageDeleted
Section titled “onMessageDeleted”onMessageBulkDeleted
Section titled “onMessageBulkDeleted”onGroupDMChannelCreate
Section titled “onGroupDMChannelCreate”onCategoryChannelCreate
Section titled “onCategoryChannelCreate”onAnnouncementChannelCreate
Section titled “onAnnouncementChannelCreate”onDirectoryChannelCreate
Section titled “onDirectoryChannelCreate”onDMChannelCreate
Section titled “onDMChannelCreate”onTextChannelCreate
Section titled “onTextChannelCreate”onVoiceChannelCreate
Section titled “onVoiceChannelCreate”onStageVoiceChannelCreate
Section titled “onStageVoiceChannelCreate”onGroupDMChannelUpdated
Section titled “onGroupDMChannelUpdated”onCategoryChannelUpdated
Section titled “onCategoryChannelUpdated”onAnnouncementChannelUpdated
Section titled “onAnnouncementChannelUpdated”onDirectoryChannelUpdated
Section titled “onDirectoryChannelUpdated”onDMChannelUpdated
Section titled “onDMChannelUpdated”onTextChannelUpdated
Section titled “onTextChannelUpdated”onVoiceChannelUpdated
Section titled “onVoiceChannelUpdated”onStageVoiceChannelUpdated
Section titled “onStageVoiceChannelUpdated”onGroupDMChannelDeleted
Section titled “onGroupDMChannelDeleted”onCategoryChannelDeleted
Section titled “onCategoryChannelDeleted”onAnnouncementChannelDeleted
Section titled “onAnnouncementChannelDeleted”onDirectoryChannelDeleted
Section titled “onDirectoryChannelDeleted”onDMChannelDeleted
Section titled “onDMChannelDeleted”onTextChannelDeleted
Section titled “onTextChannelDeleted”onVoiceChannelDeleted
Section titled “onVoiceChannelDeleted”onStageVoiceChannelDeleted
Section titled “onStageVoiceChannelDeleted”onUserUpdated
Section titled “onUserUpdated”onChannelPinsUpdate
Section titled “onChannelPinsUpdate”onGuildCreate
Section titled “onGuildCreate”onGuildUpdate
Section titled “onGuildUpdate”onGuildDelete
Section titled “onGuildDelete”onGuildMemberBanned
Section titled “onGuildMemberBanned”onGuildMemberUnbanned
Section titled “onGuildMemberUnbanned”onGuildMemberJoined
Section titled “onGuildMemberJoined”onGuildMemberLeft
Section titled “onGuildMemberLeft”onGuildMemberUpdated
Section titled “onGuildMemberUpdated”onPingInteraction
Section titled “onPingInteraction”onCommandInteraction
Section titled “onCommandInteraction”onComponentInteraction
Section titled “onComponentInteraction”onAutocompleteInteraction
Section titled “onAutocompleteInteraction”onModalInteraction
Section titled “onModalInteraction”onMessageReactionAdd
Section titled “onMessageReactionAdd”onMessageReactionRemove
Section titled “onMessageReactionRemove”onMessageReactionRemoveAll
Section titled “onMessageReactionRemoveAll”onMessageReactionRemoveEmoji
Section titled “onMessageReactionRemoveEmoji”onThreadListSync
Section titled “onThreadListSync”onThreadMemberUpdate
Section titled “onThreadMemberUpdate”onThreadMembersUpdate
Section titled “onThreadMembersUpdate”onEntitlementCreate
Section titled “onEntitlementCreate”onEntitlementUpdate
Section titled “onEntitlementUpdate”onEntitlementDelete
Section titled “onEntitlementDelete”onGuildAuditLogEntryCreate
Section titled “onGuildAuditLogEntryCreate”onGuildEmojisUpdate
Section titled “onGuildEmojisUpdate”onGuildStickersUpdate
Section titled “onGuildStickersUpdate”onGuildScheduledEventCreate
Section titled “onGuildScheduledEventCreate”onGuildScheduledEventUpdate
Section titled “onGuildScheduledEventUpdate”onGuildScheduledEventDelete
Section titled “onGuildScheduledEventDelete”onGuildScheduledEventUserAdd
Section titled “onGuildScheduledEventUserAdd”onGuildScheduledEventUserRemove
Section titled “onGuildScheduledEventUserRemove”onIntegrationCreate
Section titled “onIntegrationCreate”onIntegrationUpdate
Section titled “onIntegrationUpdate”onIntegrationDelete
Section titled “onIntegrationDelete”onInviteCreate
Section titled “onInviteCreate”onInviteDelete
Section titled “onInviteDelete”onAutoModerationRuleCreate
Section titled “onAutoModerationRuleCreate”onAutoModerationRuleUpdate
Section titled “onAutoModerationRuleUpdate”onAutoModerationRuleDelete
Section titled “onAutoModerationRuleDelete”onAutoModerationActionExecution
Section titled “onAutoModerationActionExecution”onApplicationCommandPermissionsUpdate
Section titled “onApplicationCommandPermissionsUpdate”onMessagePollVoteAdd
Section titled “onMessagePollVoteAdd”onMessagePollVoteRemove
Section titled “onMessagePollVoteRemove”onGuildRoleCreate
Section titled “onGuildRoleCreate”onGuildRoleUpdate
Section titled “onGuildRoleUpdate”onGuildRoleDelete
Section titled “onGuildRoleDelete”onAnnouncementThreadCreate
Section titled “onAnnouncementThreadCreate”onPublicThreadCreate
Section titled “onPublicThreadCreate”onPrivateThreadCreate
Section titled “onPrivateThreadCreate”onAnnouncementThreadUpdate
Section titled “onAnnouncementThreadUpdate”onPublicThreadUpdate
Section titled “onPublicThreadUpdate”onPrivateThreadUpdate
Section titled “onPrivateThreadUpdate”onThreadDelete
Section titled “onThreadDelete”onPresenceUpdate
Section titled “onPresenceUpdate”onTypingStart
Section titled “onTypingStart”onGuildMembersChunk
Section titled “onGuildMembersChunk”onGuildIntegrationsUpdate
Section titled “onGuildIntegrationsUpdate”onWebhooksUpdate
Section titled “onWebhooksUpdate”onResumed
Section titled “onResumed”onVoiceStateUpdate
Section titled “onVoiceStateUpdate”onVoiceServerUpdate
Section titled “onVoiceServerUpdate”onStageInstanceCreate
Section titled “onStageInstanceCreate”onStageInstanceUpdate
Section titled “onStageInstanceUpdate”onStageInstanceDelete
Section titled “onStageInstanceDelete”onGuildSoundboardSoundCreate
Section titled “onGuildSoundboardSoundCreate”onGuildSoundboardSoundUpdate
Section titled “onGuildSoundboardSoundUpdate”onGuildSoundboardSoundDelete
Section titled “onGuildSoundboardSoundDelete”onGuildSoundboardSoundsUpdate
Section titled “onGuildSoundboardSoundsUpdate”onVoiceChannelEffectSend
Section titled “onVoiceChannelEffectSend”onRateLimited
Section titled “onRateLimited”Fired when the gateway rate limits a request. When opcode is RequestGuildMembers, guildId identifies the affected guild.
Methods
Section titled “Methods”queryGatewayInformation
Section titled “queryGatewayInformation”Bot : queryGatewayInformation ( ) -> FutureLike<string, GetGatewayBotResponse>
Queries the Discord Gateway for bot information.
This function sends a request to the Discord Gateway to retrieve information about the bot, such as the recommended number of shards and session start limit.
Returns
| FutureLike<string, GetGatewayBotResponse> |
connectAsync
Section titled “connectAsync”Bot : connectAsync ( ) -> FutureLike<string, nil>
Connects the bot to the Discord gateway asynchronously.
This function performs the following steps:
- Queries gateway information
- Asserts that the query was successful
- Connects to the WebSocket using the obtained gateway information
Returns a async that resolves when the connection is established.
Returns
| FutureLike<string, nil> |
listDefaultSoundboardSoundsAsync
Section titled “listDefaultSoundboardSoundsAsync”Bot : listDefaultSoundboardSoundsAsync ( ) -> FutureLike<string, { SoundboardSound }>
Returns the list of default soundboard sounds available to all guilds.
Returns
| FutureLike<string, SoundboardSound }> |
getGuildAsync
Section titled “getGuildAsync”Bot : getGuildAsync ( guildId , withCount ) -> FutureLike<string, Guild>
Returns the classes.guild object for the given id. If with_counts is set to true, this endpoint will also return approximate_member_count and approximate_presence_count for the classes.guild.
Returns
| FutureLike<string, Guild> |
getChannelAsync
Section titled “getChannelAsync”Bot : getChannelAsync ( channelId ) -> FutureLike<string, Channel>
Returns a channel object for the given channel ID.
This function sends a request to the Discord API to retrieve information about a channel. The channel type is determined by the generic type parameter T.
Parameters
| channelId: string |
Returns
| FutureLike<string, Channel> |
getDMChannelAsync
Section titled “getDMChannelAsync”Bot : getDMChannelAsync ( channelId ) -> FutureLike<string, DM>
Returns a DM channel object for the given channel ID.
This function sends a request to the Discord API to retrieve information about a DM channel.
Parameters
| channelId: string |
Returns
| FutureLike<string, DM> |
getGroupDMChannelAsync
Section titled “getGroupDMChannelAsync”Bot : getGroupDMChannelAsync ( channelId ) -> FutureLike<string, GroupDM>
Returns a Group DM channel object for the given channel ID.
This function sends a request to the Discord API to retrieve information about a Group DM channel.
Parameters
| channelId: string |
Returns
| FutureLike<string, GroupDM> |
getAnnouncementChannelAsync
Section titled “getAnnouncementChannelAsync”Bot : getAnnouncementChannelAsync ( channelId ) -> FutureLike<string, GuildAnnouncement>
Returns an announcement channel object for the given channel ID.
This function sends a request to the Discord API to retrieve information about an announcement channel.
Parameters
| channelId: string |
Returns
| FutureLike<string, GuildAnnouncement> |
getCategoryChannelAsync
Section titled “getCategoryChannelAsync”Bot : getCategoryChannelAsync ( channelId ) -> FutureLike<string, GuildCategory>
Returns a category channel object for the given channel ID.
This function sends a request to the Discord API to retrieve information about a category channel.
Parameters
| channelId: string |
Returns
| FutureLike<string, GuildCategory> |
getDirectoryChannelAsync
Section titled “getDirectoryChannelAsync”Bot : getDirectoryChannelAsync ( channelId ) -> FutureLike<string, GuildDirectory>
Returns a directory channel object for the given channel ID.
This function sends a request to the Discord API to retrieve information about a directory channel.
Parameters
| channelId: string |
Returns
| FutureLike<string, GuildDirectory> |
getStageVCChannelAsync
Section titled “getStageVCChannelAsync”Bot : getStageVCChannelAsync ( channelId ) -> FutureLike<string, GuildStageVoice>
Returns a stage voice channel object for the given channel ID.
This function sends a request to the Discord API to retrieve information about a stage voice channel.
Parameters
| channelId: string |
Returns
| FutureLike<string, GuildStageVoice> |
getTextChannelAsync
Section titled “getTextChannelAsync”Bot : getTextChannelAsync ( channelId ) -> FutureLike<string, GuildText>
Returns a text channel object for the given channel ID.
This function sends a request to the Discord API to retrieve information about a text channel.
Parameters
| channelId: string |
Returns
| FutureLike<string, GuildText> |
getForumChannelAsync
Section titled “getForumChannelAsync”Bot : getForumChannelAsync ( channelId ) -> FutureLike<string, ThreadForum>
Returns a forum channel object for the given channel ID.
This function sends a request to the Discord API to retrieve information about a forum channel.
Parameters
| channelId: string |
Returns
| FutureLike<string, ThreadForum> |
getMediaChannelAsync
Section titled “getMediaChannelAsync”Bot : getMediaChannelAsync ( channelId ) -> FutureLike<string, ThreadMedia>
Returns a media channel object for the given channel ID.
This function sends a request to the Discord API to retrieve information about a media channel.
Parameters
| channelId: string |
Returns
| FutureLike<string, ThreadMedia> |
getUserAsync
Section titled “getUserAsync”Bot : getUserAsync ( userId ) -> FutureLike<string, User>
Returns a user object for the given user ID.
This function sends a request to the Discord API to retrieve information about a user.
Parameters
| userId: string |
Returns
| FutureLike<string, User> |
setLogLevel
Section titled “setLogLevel”Bot : setLogLevel ( logLevel ) -> ()
Will set the Log Level for the bot, and all instantiated objects within the bot.
Parameters
| logLevel: LogLevel |
getVoiceChannelAsync
Section titled “getVoiceChannelAsync”Bot : getVoiceChannelAsync ( channelId ) -> FutureLike<string, GuildVoice>
Returns a voice channel object for the given channel ID.
This function sends a request to the Discord API to retrieve information about a voice channel.
Parameters
| channelId: string |
Returns
| FutureLike<string, GuildVoice> |
requestGuildMembersAsync
Section titled “requestGuildMembersAsync”Bot : requestGuildMembersAsync ( guildId , params ) -> FutureLike<string, nil>
Requests guild members from the Discord Gateway. Limited to 1 request per guild every 30 seconds when using limit=0 with an empty query. Returns a failed future if the guild is currently rate limited.
Parameters
| guildId: Snowflake | |
| params: { query: string?, limit: number, presences: boolean?, userIds: { apiTypes.Snowflake, } |
Returns
| FutureLike<string, nil> |
setPresenceAsync
Section titled “setPresenceAsync”Bot : setPresenceAsync ( presence ) -> FutureLike<string, nil>
Allows you to set the presence for the Discord Bot.
Parameters
| presence: presenceJSON |
Returns
| FutureLike<string, nil> |
Functions
Section titled “Functions”Bot . new ( options ) -> ()
Construct a new DiscordLuau object
Parameters
| options: { token: string, intents: number, reconnect: boolean?, logLevel: logger.LogLevel?, globalRatelimit: number?, } |