-
Notifications
You must be signed in to change notification settings - Fork 144
Events
Discordia uses an event emitter class to broadcast various named events, most of which originate from Discord's gateway via WebSocket payloads. This is a list of all Discordia client events and their arguments.
The Client class extends the Emitter class. This makes it acceptable to subscribe callbacks or listeners to client events. The callbacks are fired when the events are emitted. All of the events listed here are called by the Discordia library and should not be manually emitted by the user.
For example, a listener can be subscribed to the messageCreate
event:
local client = discordia.Client()
client:on('messageCreate', function(message)
print(message.author.username, message.content)
end)
This event would print the message's author's name and the message content every time Discordia receives an event for a message creation from Discord.
Emitted after all shards and guilds are fully loaded.
- no arguments
Emitted after a shard successfully connects to a Discord gateway and loads all corresponding guilds.
-
shardId
- ID of the shard
Emitted after the client successfully resumes a severed gateway connection.
-
shardId
- ID of the shard
Emitted when a guild channel is created, when a private channel is opened, or when a group channel is joined.
-
channel
- the created channel
Emitted when a channel property is updated, such as its name, topic, bitrate, etc.
-
channel
- the updated channel
Emitted when a guild channel is deleted, when a private channel is closed, or when a group channel is left.
-
channel
- the deleted channel
Emitted when a new recipient is added to a group channel. User-accounts only.
-
channel
- the group channel to which the user was added -
user
- the user that was added
Emitted when a new recipient is removed from a group channel. User-accounts only.
-
channel
- the group channel from which the user was removed -
user
- the user that was removed
Emitted when a guild becomes available. This can occur after a server outage or as guild data is streamed in after login.
-
guild
- the available guild
Emitted when a guild is created from the perspective of the current user, usually after the client user joins a new one.
-
guild
- the created guild
Emitted when a guild property is updated such as its name, region, icon, etc.
-
guild
- the updated guild
Emitted when a guild becomes unavailable, potentially due to a server outage. Unavailable guilds may lack significant data.
-
guild
- the unavailable guild
Emitted when a guild is deleted from the perspective of the current user, usually after the client leaves one.
-
guild
- the deleted guild
Emitted when a user is banned from a guild.
-
user
- the user that was banned -
guild
- the guild from which the user was banned
Emitted when a user is unbanned from a guild.
-
user
- the user that was unbanned -
guild
- the guild from which the user was unbanned
Emitted when a guild's custom emoji is updated.
-
guild
- the guild in which the emoji exists
Emitted when a new user joins a guild.
-
member
- the member that joined the guild
Emitted when a user leaves a guild.
-
member
- the member that left the guild
Emitted when a guild member property is updated, such as its roles or nickname. See presenceUpdate for status changes.
-
member
- the member that was updated
Emitted when a guild role is created.
-
role
- the role that was created
Emitted when a guild role property is updated, such as its name, color, permissions, etc.
-
role
- the role that was updated
Emitted when a guild role is deleted.
-
role
- the role that was deletes
Emitted when a text channel message is created.
-
message
- the message that was created
Emitted when the content of a text channel message is edited.
-
message
- the message that was updated
Emitted when the content of a text channel message is edited, but the message is not cached by the client.
-
channel
- the channel in which the message was created -
messageId
- the Snowflake ID of the message
Emitted when a text channel message is deleted. Bulk deletions will fire this for every message that is deleted.
-
message
- the message that was deleted
Emitted when a text channel message is deleted, but the message is not cached by the client. Bulk deletions will fire this for every message that is deleted, but not cached.
-
channel
- the channel in which the message was deleted -
messageId
- the Snowflake ID of the message
Emitted when an emoji reaction is added to message.
-
reaction
- the reaction object that was added -
userId
- the Snowflake ID of the user that added the reaction
Emitted when an emoji reaction is added to message, whether the message is cached or not.
This event will be emitted before reactionAdd
/reactionAddUncached
are emitted.
-
channel
- the channel in which the reaction was added -
messageId
- The Snowflake ID of the reacted message -
hash
- the hash of the reaction; either an emoji ID or emoji name -
userId
- the Snowflake ID of the user that added the reaction
Emitted when an emoji reaction is added to message, but the message is not cached by the client.
-
channel
- the channel in which the reaction was added -
messageId
- the Snowflake ID of the reacted message -
hash
- the hash of the reaction; either an emoji ID or emoji name -
userId
- the Snowflake ID of the user that added the reaction
Emitted when an emoji reaction is removed from a message.
-
reaction
- the reaction object that was removed -
userId
- the Snowflake ID of the user whose reaction was removed
Emitted when an emoji reaction is removed from a message, whether the message is cached or not.
This event will be emitted before reactionRemove
/reactionRemoveUncached
are emitted.
-
channel
- the channel in which the reaction was removed -
messageId
- the Snowflake ID of the reacted message -
hash
- the hash of the reaction; either an emoji ID or emoji name -
userId
- the Snowflake ID of the user whose reaction was removed
Emitted when an emoji reaction is removed from a message, but the message is not cached by the client.
-
channel
- the channel in which the reaction was removed -
messageId
- the Snowflake ID of the reacted message -
hash
- the hash of the reaction; either an emoji ID or emoji name -
userId
- the Snowflake ID of the user whose reaction was removed
Emitted when all emoji reactions are removed from a message.
-
message
- the message from which the reactions were removed
Emitted when all emoji reactions are removed from a message, whether the message is cached or not.
This event will be emitted before reactionRemoveAll
/reactionRemoveAllUncached
are emitted.
-
channel
- the channel in which the reactions were removed -
messageId
- the Snowflake ID of the reacted message
Emitted when all emoji reactions are removed from a message, but the message is not cached by the client.
-
channel
- the channel in which the reactions were removed -
messageId
- the Snowflake ID of the reacted message
Emitted when a message is pinned or unpinned in a channel.
-
channel
- the channel in which the message was pinned or unpinned
Emitted when a guild member's status or user properties change. See memberUpdate for role and nickname changes.
-
member
- the member whose presence has changed
Emitted when a relationship's (friend, blocked user) status or user properties change. User-accounts only.
-
relationship
- the relationship that was updated
Emitted when a relationship (friend, blocked user) is added. User-accounts only.
-
relationship
- the relationship that was added
Emitted when a relationship (friend, blocked user) is removed. User-accounts only.
-
relationship
- the relationship that was removed
Emitted when a user starts typing in a text channel.
-
userId
- the Snowflake ID of the user that started typing -
channelId
- the Snowflake ID of the channel in which the user started typing -
timestamp
- Unix timestamp in seconds at which the user started typing
Emitted when the client user updates itself.
-
user
- the user that was updated (equivalent toclient.user
)
Emitted when a guild member connects to voice chat.
-
member
- the member that connected
Emitted when a guild member disconnects from voice chat.
-
member
- the member that connected
Emitted when a guild member's mute/deaf status changes.
-
member
- the member that connected
Emitted when a guild member joins a voice channel.
-
member
- the member that joined -
channel
- the channel that was joined
Emitted when a guild member leaves a voice channel.
-
member
- the member that left -
channel
- the channel that was left
Emitted when a guild's text channel's webhooks have updated.
-
channel
- the channel in which the webhook updated
Emitted to provide detailed information regarding specific library behavior.
-
debug
- The unformatted debug message
Emitted to provide helpful information regarding general library behavior.
-
message
- The unformatted info message
Emitted when something went wrong, but your code will probably continue operating normally.
-
message
- The unformatted warning message
Emitted when something went wrong and your code may not continue operating normally.
-
message
- The unformatted error message
Emitted when Discord responds with a heartbeat acknowledgement.
-
shardId
- the ID of the shard that received the acknowledgement -
latency
- round-trip latency of the heartbeat in milliseconds
Emitted for every Discord gateway event.
-
string
- Raw JSON string of the gateway payload