Event
public enum Event: String
Organize all ws dispatch events
-
Fired when audio data is received from voice connection
Usage
connection.on(.audioData) { data in let audioData = data as! Data }
Declaration
Swift
case audioData
-
Fired when a channel is created
Usage
bot.on(.channelCreate) { data in let channel = data as! Channel }
Declaration
Swift
case channelCreate = "CHANNEL_CREATE"
-
Fired when a channel is deleted
Usage
bot.on(.channelDelete) { data in let channel = data as! Channel }
Declaration
Swift
case channelDelete = "CHANNEL_DELETE"
-
Fired when a channel adds a pin or removes a pin
Usage
bot.on(.channelPinsUpdate) { data in let (channel, timestamp) = data as! (TextChannel, Date?) }
Declaration
Swift
case channelPinsUpdate = "CHANNEL_PINS_UPDATE"
-
Fired when a channel is updated
Usage
bot.on(.channelUpdate) { data in let channel = data as! Channel }
Declaration
Swift
case channelUpdate = "CHANNEL_UPDATE"
-
Fired when voice connection dies (self emitted)
Usage
connection.on(.connectionClose) { _ in kill(process.processIdentifier, SIGKILL) }
Declaration
Swift
case connectionClose
-
Fired when a shard is disconnected from the gateway
Usage
bot.on(.disconnect) { data in let shardNumber = data as! Int }
Declaration
Swift
case disconnect
-
Fired when a guild is available (This is not guildCreate)
Usage
bot.on(.guildAvailable) { data in let guild = data as! Guild }
Declaration
Swift
case guildAvailable
-
Fired when a member of a guild is banned
Usage
bot.on(.guildBanAdd) { data in let (guild, user) = data as! (Guild, User) }
Declaration
Swift
case guildBanAdd = "GUILD_BAN_ADD"
-
Fired when a member of a guild is unbanned
Usage
bot.on(.guildBanRemove) { data in let (guild, user) = data as! (Guild, User) }
Declaration
Swift
case guildBanRemove = "GUILD_BAN_REMOVE"
-
Fired when a guild is created
Usage
bot.on(.guildCreate) { data in let guild = data as! Guild }
Declaration
Swift
case guildCreate = "GUILD_CREATE"
-
Fired when a guild is deleted
Usage
bot.on(.guildDelete) { data in let guild = data as! Guild }
Declaration
Swift
case guildDelete = "GUILD_DELETE"
-
Fired when a guild’s custom emojis are created/deleted/updated
Usage
bot.on(.guildEmojisUpdate) { data in let (guild, emojis) = data as! (Guild, [Emoji]) }
Declaration
Swift
case guildEmojisUpdate = "GUILD_EMOJIS_UPDATE"
-
Fired when a guild updates it’s integrations
Usage
bot.on(.guildIntegrationsUpdate) { data in let guild = data as! Guild }
Declaration
Swift
case guildIntegrationsUpdate = "GUILD_INTEGRATIONS_UPDATE"
-
Fired when a user joins a guild
Usage
bot.on(.guildMemberAdd) { data in let (guild, member) = data as! (Guild, Member) }
Declaration
Swift
case guildMemberAdd = "GUILD_MEMBER_ADD"
-
Fired when a member leaves a guild
Usage
bot.on(.guildMemberRemove) { data in let (guild, user) = data as! (Guild, User) }
Declaration
Swift
case guildMemberRemove = "GUILD_MEMBER_REMOVE"
-
Fired when a member of a guild is updated
Usage
bot.on(.guildMemberUpdate) { data in let member = data as! Member }
Declaration
Swift
case guildMemberUpdate = "GUILD_MEMBER_UPDATE"
-
Fired when a role is created in a guild
Usage
bot.on(.guildRoleCreate) { data in let (guild, role) = data as! (Guild, Role) }
Declaration
Swift
case guildRoleCreate = "GUILD_ROLE_CREATE"
-
Fired when a role is deleted in a guild
Usage
bot.on(.guildRoleDelete) { data in let (guild, role) = data as! (Guild, Role) }
Declaration
Swift
case guildRoleDelete = "GUILD_ROLE_DELETE"
-
Fired when a role is updated in a guild
Usage
bot.on(.guildRoleUpdate) { data in let (guild, role) = data as! (Guild, Role) }
Declaration
Swift
case guildRoleUpdate = "GUILD_ROLE_UPDATE"
-
Fired when a guild becomes unavailable
Usage
bot.on(.guildUnavailable) { data in let guild = data as! UnavailableGuild }
Declaration
Swift
case guildUnavailable
-
Fired when a guild is updated
Usage
bot.on(.guildUpdate) { data in let guild = data as! Guild }
Declaration
Swift
case guildUpdate = "GUILD_UPDATE"
-
Fired when a message is created
Usage
bot.on(.messageCreate) { data in let msg = data as! Message }
Declaration
Swift
case messageCreate = "MESSAGE_CREATE"
-
Fired when a message is deleted
Usage
bot.on(.messageDelete) { data in guard let (msg, channel) = data as? (Message, TextChannel) else { // data has returned a MessageID let (messageID, channel) = data as! (MessageID, TextChannel) return } }
Declaration
Swift
case messageDelete = "MESSAGE_DELETE"
-
Fired when a large chunk of messages are deleted
Usage
bot.on(.messageDeleteBulk) { data in let (messageIDs, channel) = data as! ([MessageID], TextChannel) }
Declaration
Swift
case messageDeleteBulk = "MESSAGE_DELETE_BULK"
-
Fired when a message’s reactions are all removed
Usage
bot.on(.messageReactionRemoveAll) { data in let (messageID, channel) = data as! (MessageID, TextChannel) }
Declaration
Swift
case messageReactionRemoveAll = "MESSAGE_REACTION_REMOVE_ALL"
-
Fired when a message is updated
Usage
bot.on(.messageUpdate) { data in let (messageID, channel) = data as! (MessageID, TextChannel) }
Declaration
Swift
case messageUpdate = "MESSAGE_UPDATE"
-
Fired when a payload is received through the gateway
Usage
bot.on(.payload) { data, in let message = data as! String }
Declaration
Swift
case payload
-
Fired when a user’s presences is updated
Usage
bot.on(.presenceUpdate) { data in let (userID, presence) = data as! (UserID, Presence) }
Declaration
Swift
case presenceUpdate = "PRESENCE_UPDATE"
-
Fired when the bot is ready to receive events
Usage
bot.on(.ready) { data in let user = data as! User }
Declaration
Swift
case ready = "READY"
-
Fired when a reaction is added to a message
Usage
bot.on(.reactionAdd) { data in let (channel, userID, messageID, emoji) = data as! (TextChannel, UserID, MessageID, Emoji) }
Declaration
Swift
case reactionAdd = "MESSAGE_REACTION_ADD"
-
Fired when a reaction is removed from a message
Usage
bot.on(.reactionRemove) { data in let (channel, userID, messageID, emoji) = data as! (TextChannel, UserID, MessageID, Emoji) }
Declaration
Swift
case reactionRemove = "MESSAGE_REACTION_REMOVE"
-
Fired when a shard becomes ready
Usage
bot.on(.shardReady) { data in let shardID = data as! Int }
Declaration
Swift
case shardReady
-
Fired when someone starts typing a message
Usage
bot.on(.typingStart) { data in let (channel, userID, timestamp) = data as! (TextChannel, UserID, Date) }
Declaration
Swift
case typingStart = "TYPING_START"
-
Fired when a user updates their info
Usage
bot.on(.userUpdate) { data in let user = data as! User }
Declaration
Swift
case userUpdate = "USER_UPDATE"
-
Fired when someone joins a voice channel
Usage
bot.on(.voiceChannelJoin) { data in let (userID, voiceState) = data as! (UserID, VoiceState) }
Declaration
Swift
case voiceChannelJoin
-
Fired when someone leaves a voice channel
Usage
bot.on(.voiceChannelLeave) { data in let userID = data as! UserID }
Declaration
Swift
case voiceChannelLeave
-
Fired when someone joins/leaves/moves a voice channel
Usage
bot.on(.voiceStateUpdate) { data in let userID = data as! UserID }
Declaration
Swift
case voiceStateUpdate = "VOICE_STATE_UPDATE"