DiscordLua
discorddiscord
v1.2.4
Install

Events

Event

Gateway and client events. Listen with client:on(name, handler) or client:on(discord.Events.Name, handler). Argument types link to the corresponding API reference when the Client implementation wraps a structure.

lua
local discord = require("discord")
local client = discord.Client({ intents = { "Guilds", "GuildMessages", "MessageContent" } })
client:on("messageCreate", function(message)
    print(message.content)
end)
client:login(os.getenv("DISCORD_TOKEN"))

ready

#

discord.Events.ClientReady"ready"

Trigger

After Identify succeeds and the initial guild set is cached. Also emitted as clientReady.

Arguments

ArgumentType
clientClient

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("ready", function(client)
end)

Alias: Events.Ready is the same string as ready.

error

#

discord.Events.Error"error"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to error runs in Client.

Arguments

No additional payload arguments. The handler is function().

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("error", function()
end)

warn

#

discord.Events.Warn"warn"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to warn runs in Client.

Arguments

No additional payload arguments. The handler is function().

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("warn", function()
end)

debug

#

discord.Events.Debug"debug"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to debug runs in Client.

Arguments

No additional payload arguments. The handler is function().

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("debug", function()
end)

messageCreate

#

discord.Events.MessageCreate"messageCreate"

Trigger

A MESSAGE_CREATE Gateway dispatch was wrapped into a Message and stored on the channel cache when possible.

Arguments

ArgumentType
messageMessage

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("messageCreate", function(message)
end)

messageUpdate

#

discord.Events.MessageUpdate"messageUpdate"

Trigger

A MESSAGE_UPDATE dispatch was wrapped. Partial messages follow Client partials.

Arguments

ArgumentType
messageMessage

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("messageUpdate", function(message)
end)

messageDelete

#

discord.Events.MessageDelete"messageDelete"

Trigger

A MESSAGE_DELETE dispatch. The handler may receive a partial object if the message was not cached.

Arguments

ArgumentType
messageMessage

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("messageDelete", function(message)
end)

messageDeleteBulk

#

discord.Events.MessageBulkDelete"messageDeleteBulk"

Trigger

A MESSAGE_DELETE_BULK dispatch. Arguments are the deleted messages collection and the channel.

Arguments

ArgumentType
messagesmessages
channelChannel

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("messageDeleteBulk", function(messages, channel)
end)

Alias: Events.MessageDeleteBulk is the same string as messageDeleteBulk.

messagePollVoteAdd

#

discord.Events.MessagePollVoteAdd"messagePollVoteAdd"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to messagePollVoteAdd runs in Client.

Arguments

No additional payload arguments. The handler is function().

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("messagePollVoteAdd", function()
end)

messagePollVoteRemove

#

discord.Events.MessagePollVoteRemove"messagePollVoteRemove"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to messagePollVoteRemove runs in Client.

Arguments

No additional payload arguments. The handler is function().

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("messagePollVoteRemove", function()
end)

messageReactionAdd

#

discord.Events.MessageReactionAdd"messageReactionAdd"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to messageReactionAdd runs in Client.

Arguments

ArgumentType
reactionreaction
userUser

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("messageReactionAdd", function(reaction, user)
end)

messageReactionRemove

#

discord.Events.MessageReactionRemove"messageReactionRemove"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to messageReactionRemove runs in Client.

Arguments

ArgumentType
reactionreaction
userUser

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("messageReactionRemove", function(reaction, user)
end)

messageReactionRemoveAll

#

discord.Events.MessageReactionRemoveAll"messageReactionRemoveAll"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to messageReactionRemoveAll runs in Client.

Arguments

ArgumentType
messageMessage
reactionsreactions

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("messageReactionRemoveAll", function(message, reactions)
end)

messageReactionRemoveEmoji

#

discord.Events.MessageReactionRemoveEmoji"messageReactionRemoveEmoji"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to messageReactionRemoveEmoji runs in Client.

Arguments

ArgumentType
reactionreaction

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("messageReactionRemoveEmoji", function(reaction)
end)

interactionCreate

#

discord.Events.InteractionCreate"interactionCreate"

Trigger

An INTERACTION_CREATE dispatch was wrapped into an Interaction subclass.

Arguments

ArgumentType
interactionInteraction

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("interactionCreate", function(interaction)
end)

guildCreate

#

discord.Events.GuildCreate"guildCreate"

Trigger

A GUILD_CREATE dispatch added or updated a Guild on client.guilds.

Arguments

ArgumentType
guildGuild

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("guildCreate", function(guild)
end)

guildUpdate

#

discord.Events.GuildUpdate"guildUpdate"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to guildUpdate runs in Client.

Arguments

ArgumentType
guildGuild

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("guildUpdate", function(guild)
end)

guildDelete

#

discord.Events.GuildDelete"guildDelete"

Trigger

The client was removed from a guild, or the guild became unavailable.

Arguments

ArgumentType
wrappedwrapped

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("guildDelete", function(wrapped)
end)

guildAvailable

#

discord.Events.GuildAvailable"guildAvailable"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to guildAvailable runs in Client.

Arguments

ArgumentType
guildGuild

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("guildAvailable", function(guild)
end)

guildUnavailable

#

discord.Events.GuildUnavailable"guildUnavailable"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to guildUnavailable runs in Client.

Arguments

ArgumentType
wrappedwrapped

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("guildUnavailable", function(wrapped)
end)

guildMemberAdd

#

discord.Events.GuildMemberAdd"guildMemberAdd"

Trigger

A member joined a guild and was added to that guild's member cache.

Arguments

ArgumentType
membermember

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("guildMemberAdd", function(member)
end)

guildMemberRemove

#

discord.Events.GuildMemberRemove"guildMemberRemove"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to guildMemberRemove runs in Client.

Arguments

ArgumentType
wrappedwrapped
enumsenums

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("guildMemberRemove", function(wrapped, enums)
end)

guildMemberUpdate

#

discord.Events.GuildMemberUpdate"guildMemberUpdate"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to guildMemberUpdate runs in Client.

Arguments

ArgumentType
membermember

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("guildMemberUpdate", function(member)
end)

guildMemberAvailable

#

discord.Events.GuildMemberAvailable"guildMemberAvailable"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to guildMemberAvailable runs in Client.

Arguments

ArgumentType
membermember

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("guildMemberAvailable", function(member)
end)

guildMembersChunk

#

discord.Events.GuildMembersChunk"guildMembersChunk"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to guildMembersChunk runs in Client.

Arguments

ArgumentType
membersmembers
guildGuild
arg3arg3
countcount
notFoundnotFound
noncenonce
arg7arg7

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("guildMembersChunk", function(members, guild, arg3, count, notFound, nonce, arg7)
end)

guildBanAdd

#

discord.Events.GuildBanAdd"guildBanAdd"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to guildBanAdd runs in Client.

Arguments

No additional payload arguments. The handler is function().

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("guildBanAdd", function()
end)

guildBanRemove

#

discord.Events.GuildBanRemove"guildBanRemove"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to guildBanRemove runs in Client.

Arguments

No additional payload arguments. The handler is function().

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("guildBanRemove", function()
end)

roleCreate

#

discord.Events.GuildRoleCreate"roleCreate"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to roleCreate runs in Client.

Arguments

ArgumentType
roleRole

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("roleCreate", function(role)
end)

roleUpdate

#

discord.Events.GuildRoleUpdate"roleUpdate"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to roleUpdate runs in Client.

Arguments

ArgumentType
roleRole

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("roleUpdate", function(role)
end)

roleDelete

#

discord.Events.GuildRoleDelete"roleDelete"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to roleDelete runs in Client.

Arguments

ArgumentType
roleRole

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("roleDelete", function(role)
end)

guildIntegrationsUpdate

#

discord.Events.GuildIntegrationsUpdate"guildIntegrationsUpdate"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to guildIntegrationsUpdate runs in Client.

Arguments

ArgumentType
datadata

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("guildIntegrationsUpdate", function(data)
end)

guildAuditLogEntryCreate

#

discord.Events.GuildAuditLogEntryCreate"guildAuditLogEntryCreate"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to guildAuditLogEntryCreate runs in Client.

Arguments

ArgumentType
entryentry
guildGuild

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("guildAuditLogEntryCreate", function(entry, guild)
end)

guildScheduledEventCreate

#

discord.Events.GuildScheduledEventCreate"guildScheduledEventCreate"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to guildScheduledEventCreate runs in Client.

Arguments

No additional payload arguments. The handler is function().

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("guildScheduledEventCreate", function()
end)

guildScheduledEventUpdate

#

discord.Events.GuildScheduledEventUpdate"guildScheduledEventUpdate"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to guildScheduledEventUpdate runs in Client.

Arguments

No additional payload arguments. The handler is function().

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("guildScheduledEventUpdate", function()
end)

guildScheduledEventDelete

#

discord.Events.GuildScheduledEventDelete"guildScheduledEventDelete"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to guildScheduledEventDelete runs in Client.

Arguments

ArgumentType
guildScheduledEventGuildScheduledEvent

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("guildScheduledEventDelete", function(guildScheduledEvent)
end)

guildScheduledEventUserAdd

#

discord.Events.GuildScheduledEventUserAdd"guildScheduledEventUserAdd"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to guildScheduledEventUserAdd runs in Client.

Arguments

No additional payload arguments. The handler is function().

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("guildScheduledEventUserAdd", function()
end)

guildScheduledEventUserRemove

#

discord.Events.GuildScheduledEventUserRemove"guildScheduledEventUserRemove"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to guildScheduledEventUserRemove runs in Client.

Arguments

No additional payload arguments. The handler is function().

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("guildScheduledEventUserRemove", function()
end)

channelCreate

#

discord.Events.ChannelCreate"channelCreate"

Trigger

A channel was created and cached.

Arguments

ArgumentType
channelChannel

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("channelCreate", function(channel)
end)

channelUpdate

#

discord.Events.ChannelUpdate"channelUpdate"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to channelUpdate runs in Client.

Arguments

ArgumentType
channelChannel

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("channelUpdate", function(channel)
end)

channelDelete

#

discord.Events.ChannelDelete"channelDelete"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to channelDelete runs in Client.

Arguments

ArgumentType
channelChannel

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("channelDelete", function(channel)
end)

channelPinsUpdate

#

discord.Events.ChannelPinsUpdate"channelPinsUpdate"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to channelPinsUpdate runs in Client.

Arguments

ArgumentType
channelChannel
datadata

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("channelPinsUpdate", function(channel, data)
end)

threadCreate

#

discord.Events.ThreadCreate"threadCreate"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to threadCreate runs in Client.

Arguments

ArgumentType
channelChannel

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("threadCreate", function(channel)
end)

threadUpdate

#

discord.Events.ThreadUpdate"threadUpdate"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to threadUpdate runs in Client.

Arguments

ArgumentType
channelChannel

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("threadUpdate", function(channel)
end)

threadDelete

#

discord.Events.ThreadDelete"threadDelete"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to threadDelete runs in Client.

Arguments

ArgumentType
channelChannel

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("threadDelete", function(channel)
end)

threadListSync

#

discord.Events.ThreadListSync"threadListSync"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to threadListSync runs in Client.

Arguments

ArgumentType
threadsthreads
datadata

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("threadListSync", function(threads, data)
end)

threadMemberUpdate

#

discord.Events.ThreadMemberUpdate"threadMemberUpdate"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to threadMemberUpdate runs in Client.

Arguments

ArgumentType
membermember
threadthread

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("threadMemberUpdate", function(member, thread)
end)

threadMembersUpdate

#

discord.Events.ThreadMembersUpdate"threadMembersUpdate"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to threadMembersUpdate runs in Client.

Arguments

ArgumentType
addedadded
removedremoved
threadthread

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("threadMembersUpdate", function(added, removed, thread)
end)

presenceUpdate

#

discord.Events.PresenceUpdate"presenceUpdate"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to presenceUpdate runs in Client.

Arguments

ArgumentType
presencePresence

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("presenceUpdate", function(presence)
end)

voiceStateUpdate

#

discord.Events.VoiceStateUpdate"voiceStateUpdate"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to voiceStateUpdate runs in Client.

Arguments

ArgumentType
statestate

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("voiceStateUpdate", function(state)
end)

voiceServerUpdate

#

discord.Events.VoiceServerUpdate"voiceServerUpdate"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to voiceServerUpdate runs in Client.

Arguments

ArgumentType
datatable

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("voiceServerUpdate", function(data)
end)

voiceChannelEffectSend

#

discord.Events.VoiceChannelEffectSend"voiceChannelEffectSend"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to voiceChannelEffectSend runs in Client.

Arguments

ArgumentType
datatable

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("voiceChannelEffectSend", function(data)
end)

resumed

#

discord.Events.Resumed"resumed"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to resumed runs in Client.

Arguments

ArgumentType
datadata

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("resumed", function(data)
end)

integrationCreate

#

discord.Events.IntegrationCreate"integrationCreate"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to integrationCreate runs in Client.

Arguments

No additional payload arguments. The handler is function().

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("integrationCreate", function()
end)

integrationUpdate

#

discord.Events.IntegrationUpdate"integrationUpdate"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to integrationUpdate runs in Client.

Arguments

No additional payload arguments. The handler is function().

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("integrationUpdate", function()
end)

integrationDelete

#

discord.Events.IntegrationDelete"integrationDelete"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to integrationDelete runs in Client.

Arguments

ArgumentType
datatable

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("integrationDelete", function(data)
end)

typingStart

#

discord.Events.TypingStart"typingStart"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to typingStart runs in Client.

Arguments

ArgumentType
typingTyping

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("typingStart", function(typing)
end)

webhooksUpdate

#

discord.Events.WebhooksUpdate"webhooksUpdate"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to webhooksUpdate runs in Client.

Arguments

ArgumentType
channelChannel

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("webhooksUpdate", function(channel)
end)

Alias: Events.WebhookUpdate is the same string as webhooksUpdate.

inviteCreate

#

discord.Events.InviteCreate"inviteCreate"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to inviteCreate runs in Client.

Arguments

ArgumentType
inviteInvite

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("inviteCreate", function(invite)
end)

inviteDelete

#

discord.Events.InviteDelete"inviteDelete"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to inviteDelete runs in Client.

Arguments

ArgumentType
inviteInvite

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("inviteDelete", function(invite)
end)

userUpdate

#

discord.Events.UserUpdate"userUpdate"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to userUpdate runs in Client.

Arguments

ArgumentType
userUser

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("userUpdate", function(user)
end)

emojiCreate

#

discord.Events.EmojiCreate"emojiCreate"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to emojiCreate runs in Client.

Arguments

No additional payload arguments. The handler is function().

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("emojiCreate", function()
end)

emojiUpdate

#

discord.Events.EmojiUpdate"emojiUpdate"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to emojiUpdate runs in Client.

Arguments

No additional payload arguments. The handler is function().

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("emojiUpdate", function()
end)

emojiDelete

#

discord.Events.EmojiDelete"emojiDelete"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to emojiDelete runs in Client.

Arguments

ArgumentType
emojiemoji

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("emojiDelete", function(emoji)
end)

stickerCreate

#

discord.Events.StickerCreate"stickerCreate"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to stickerCreate runs in Client.

Arguments

No additional payload arguments. The handler is function().

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("stickerCreate", function()
end)

stickerUpdate

#

discord.Events.StickerUpdate"stickerUpdate"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to stickerUpdate runs in Client.

Arguments

No additional payload arguments. The handler is function().

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("stickerUpdate", function()
end)

stickerDelete

#

discord.Events.StickerDelete"stickerDelete"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to stickerDelete runs in Client.

Arguments

ArgumentType
stickersticker

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("stickerDelete", function(sticker)
end)

applicationCommandPermissionsUpdate

#

discord.Events.ApplicationCommandPermissionsUpdate"applicationCommandPermissionsUpdate"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to applicationCommandPermissionsUpdate runs in Client.

Arguments

ArgumentType
datatable

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("applicationCommandPermissionsUpdate", function(data)
end)

autoModerationActionExecution

#

discord.Events.AutoModerationActionExecution"autoModerationActionExecution"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to autoModerationActionExecution runs in Client.

Arguments

ArgumentType
autoModerationActionExecutionAutoModerationActionExecution

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("autoModerationActionExecution", function(autoModerationActionExecution)
end)

autoModerationRuleCreate

#

discord.Events.AutoModerationRuleCreate"autoModerationRuleCreate"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to autoModerationRuleCreate runs in Client.

Arguments

ArgumentType
autoModerationRuleAutoModerationRule

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("autoModerationRuleCreate", function(autoModerationRule)
end)

autoModerationRuleDelete

#

discord.Events.AutoModerationRuleDelete"autoModerationRuleDelete"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to autoModerationRuleDelete runs in Client.

Arguments

ArgumentType
autoModerationRuleAutoModerationRule

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("autoModerationRuleDelete", function(autoModerationRule)
end)

autoModerationRuleUpdate

#

discord.Events.AutoModerationRuleUpdate"autoModerationRuleUpdate"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to autoModerationRuleUpdate runs in Client.

Arguments

ArgumentType
autoModerationRuleAutoModerationRule

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("autoModerationRuleUpdate", function(autoModerationRule)
end)

entitlementCreate

#

discord.Events.EntitlementCreate"entitlementCreate"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to entitlementCreate runs in Client.

Arguments

No additional payload arguments. The handler is function().

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("entitlementCreate", function()
end)

entitlementUpdate

#

discord.Events.EntitlementUpdate"entitlementUpdate"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to entitlementUpdate runs in Client.

Arguments

No additional payload arguments. The handler is function().

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("entitlementUpdate", function()
end)

entitlementDelete

#

discord.Events.EntitlementDelete"entitlementDelete"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to entitlementDelete runs in Client.

Arguments

ArgumentType
entitlementEntitlement

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("entitlementDelete", function(entitlement)
end)

stageInstanceCreate

#

discord.Events.StageInstanceCreate"stageInstanceCreate"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to stageInstanceCreate runs in Client.

Arguments

No additional payload arguments. The handler is function().

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("stageInstanceCreate", function()
end)

stageInstanceUpdate

#

discord.Events.StageInstanceUpdate"stageInstanceUpdate"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to stageInstanceUpdate runs in Client.

Arguments

No additional payload arguments. The handler is function().

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("stageInstanceUpdate", function()
end)

stageInstanceDelete

#

discord.Events.StageInstanceDelete"stageInstanceDelete"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to stageInstanceDelete runs in Client.

Arguments

No additional payload arguments. The handler is function().

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("stageInstanceDelete", function()
end)

subscriptionCreate

#

discord.Events.SubscriptionCreate"subscriptionCreate"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to subscriptionCreate runs in Client.

Arguments

No additional payload arguments. The handler is function().

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("subscriptionCreate", function()
end)

subscriptionUpdate

#

discord.Events.SubscriptionUpdate"subscriptionUpdate"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to subscriptionUpdate runs in Client.

Arguments

No additional payload arguments. The handler is function().

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("subscriptionUpdate", function()
end)

subscriptionDelete

#

discord.Events.SubscriptionDelete"subscriptionDelete"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to subscriptionDelete runs in Client.

Arguments

ArgumentType
subscriptionSubscription

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("subscriptionDelete", function(subscription)
end)

soundboardSounds

#

discord.Events.SoundboardSounds"soundboardSounds"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to soundboardSounds runs in Client.

Arguments

No additional payload arguments. The handler is function().

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("soundboardSounds", function()
end)

guildSoundboardSoundCreate

#

discord.Events.GuildSoundboardSoundCreate"guildSoundboardSoundCreate"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to guildSoundboardSoundCreate runs in Client.

Arguments

No additional payload arguments. The handler is function().

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("guildSoundboardSoundCreate", function()
end)

guildSoundboardSoundUpdate

#

discord.Events.GuildSoundboardSoundUpdate"guildSoundboardSoundUpdate"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to guildSoundboardSoundUpdate runs in Client.

Arguments

No additional payload arguments. The handler is function().

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("guildSoundboardSoundUpdate", function()
end)

guildSoundboardSoundDelete

#

discord.Events.GuildSoundboardSoundDelete"guildSoundboardSoundDelete"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to guildSoundboardSoundDelete runs in Client.

Arguments

ArgumentType
soundboardSoundSoundboardSound

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("guildSoundboardSoundDelete", function(soundboardSound)
end)

guildSoundboardSoundsUpdate

#

discord.Events.GuildSoundboardSoundsUpdate"guildSoundboardSoundsUpdate"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to guildSoundboardSoundsUpdate runs in Client.

Arguments

No additional payload arguments. The handler is function().

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("guildSoundboardSoundsUpdate", function()
end)

shardDisconnect

#

discord.Events.ShardDisconnect"shardDisconnect"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to shardDisconnect runs in Client.

Arguments

No additional payload arguments. The handler is function().

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("shardDisconnect", function()
end)

shardError

#

discord.Events.ShardError"shardError"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to shardError runs in Client.

Arguments

No additional payload arguments. The handler is function().

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("shardError", function()
end)

shardReady

#

discord.Events.ShardReady"shardReady"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to shardReady runs in Client.

Arguments

No additional payload arguments. The handler is function().

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("shardReady", function()
end)

shardReconnecting

#

discord.Events.ShardReconnecting"shardReconnecting"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to shardReconnecting runs in Client.

Arguments

No additional payload arguments. The handler is function().

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("shardReconnecting", function()
end)

shardResume

#

discord.Events.ShardResume"shardResume"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to shardResume runs in Client.

Arguments

No additional payload arguments. The handler is function().

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("shardResume", function()
end)

shardCreate

#

discord.Events.ShardCreate"shardCreate"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to shardCreate runs in Client.

Arguments

No additional payload arguments. The handler is function().

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("shardCreate", function()
end)

invalidated

#

discord.Events.Invalidated"invalidated"

Trigger

The session can no longer be used. Stop the process or create a new Client.

Arguments

No additional payload arguments. The handler is function().

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("invalidated", function()
end)

cacheSweep

#

discord.Events.CacheSweep"cacheSweep"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to cacheSweep runs in Client.

Arguments

No additional payload arguments. The handler is function().

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("cacheSweep", function()
end)

close

#

discord.Events.WebSocketShardClose"close"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to close runs in Client.

Arguments

No additional payload arguments. The handler is function().

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("close", function()
end)

allReady

#

discord.Events.WebSocketShardAllReady"allReady"

Trigger

Dispatched when the Gateway payload or local Client lifecycle mapped to allReady runs in Client.

Arguments

No additional payload arguments. The handler is function().

Lifecycle

Handlers registered with Client:on run synchronously in registration order. Client:once removes the listener after the first successful emit. Errors in a handler do not automatically disconnect the Gateway.

Example

lua
client:on("allReady", function()
end)
Search Ctrl K Navigate Open Esc