Expand description
The payloads the client builds itself (D-225): events with the state before them (D-221, D-227), events derived from a list (D-223) and shard lifecycle events (D-226).
Events with a previous state have two fields (D-228):
old: what the cache held before the event —Nonewithout a cache, with the resource disabled inCacheConfig, or for something it never received (the counterpart of a discord.js partial);new: Discord’s data for the event, as itsdjs-modeltype. For a removal, this is Discord’s notice (IDs) andoldthe removed object.
Each of them dereferences to new, so its fields read as on an event without a wrapper:
client.on(Events::GuildMemberUpdate, |_ctx, update| async move {
let old_nick = update.old.as_ref().and_then(|old| old.nick.clone());
println!("{} was {old_nick:?}, is now {:?}", update.user.id, update.nick);
Ok(())
});Structs§
- Channel
Delete - The payload of
Events::ChannelDelete. - Channel
Update - The payload of
Events::ChannelUpdate. - Guild
Delete - The payload of
Events::GuildDelete:newonly holds the guild’s ID,oldthe cached guild. - Guild
Emoji Create - The payload of
Events::GuildEmojiCreate: a new emoji. - Guild
Emoji Delete - The payload of
Events::GuildEmojiDelete: a deleted emoji, as the cache held it. - Guild
Emoji Update - The payload of
Events::GuildEmojiUpdate: a changed emoji, before and after. - Guild
Member Remove - The payload of
Events::GuildMemberRemove:newholds the guild ID and the user,oldthe cached member. - Guild
Member Update - The payload of
Events::GuildMemberUpdate. - Guild
Role Delete - The payload of
Events::GuildRoleDelete:newonly holds the IDs,oldthe cached role. - Guild
Role Update - The payload of
Events::GuildRoleUpdate. - Guild
Scheduled Event Delete - The payload of
Events::GuildScheduledEventDelete. - Guild
Scheduled Event Update - The payload of
Events::GuildScheduledEventUpdate. - Guild
Soundboard Sound Delete - The payload of
Events::GuildSoundboardSoundDelete:newonly holds the IDs,oldthe cached sound. - Guild
Soundboard Sound Update - The payload of
Events::GuildSoundboardSoundUpdate. - Guild
Sticker Create - The payload of
Events::GuildStickerCreate: a new sticker. - Guild
Sticker Delete - The payload of
Events::GuildStickerDelete: a deleted sticker, as the cache held it. - Guild
Sticker Update - The payload of
Events::GuildStickerUpdate: a changed sticker, before and after. - Guild
Unavailable - The payload of
Events::GuildUnavailable:newonly holds the guild’s ID,oldthe cached guild (which the cache keeps while the guild is unavailable). - Guild
Update - The payload of
Events::GuildUpdate. - Invalidated
- The payload of
Events::Invalidated. The shard isContext::shard_id. - Message
Bulk Delete - The payload of
Events::MessageBulkDelete:newholds the IDs,oldthe messages the cache held (empty without a message cache). - Message
Delete - The payload of
Events::MessageDelete:newonly holds the IDs,oldthe cached message. - Message
Update - The payload of
Events::MessageUpdate. - Presence
Update - The payload of
Events::PresenceUpdate. - Shard
Reconnecting - The payload of
Events::ShardReconnecting. The shard isContext::shard_id. - Shard
Resume - The payload of
Events::ShardResume. - Stage
Instance Delete - The payload of
Events::StageInstanceDelete. - Stage
Instance Update - The payload of
Events::StageInstanceUpdate. - Thread
Delete - The payload of
Events::ThreadDelete:newonly holds the thread’s IDs,oldthe cached thread. - Thread
Update - The payload of
Events::ThreadUpdate. - User
Update - The payload of
Events::UserUpdate. - Voice
State Update - The payload of
Events::VoiceStateUpdate.