Trait serenity::prelude::EventHandler
[−]
[src]
pub trait EventHandler { fn cached(&self, _: Context, _: Vec<GuildId>) { ... } fn channel_create(&self, _: Context, _: Arc<RwLock<GuildChannel>>) { ... } fn category_create(&self, _: Context, _: Arc<RwLock<ChannelCategory>>) { ... } fn category_delete(&self, _: Context, _: Arc<RwLock<ChannelCategory>>) { ... } fn private_channel_create(&self, _: Context, _: Arc<RwLock<PrivateChannel>>) { ... } fn channel_delete(&self, _: Context, _: Arc<RwLock<GuildChannel>>) { ... } fn channel_pins_update(&self, _: Context, _: ChannelPinsUpdateEvent) { ... } fn channel_recipient_addition(&self, _: Context, _: ChannelId, _: User) { ... } fn channel_recipient_removal(&self, _: Context, _: ChannelId, _: User) { ... } fn channel_update(&self, _: Context, _: Option<Channel>, _: Channel) { ... } fn guild_ban_addition(&self, _: Context, _: GuildId, _: User) { ... } fn guild_ban_removal(&self, _: Context, _: GuildId, _: User) { ... } fn guild_create(&self, _: Context, _: Guild, _: bool) { ... } fn guild_delete(
&self,
_: Context,
_: PartialGuild,
_: Option<Arc<RwLock<Guild>>>
) { ... } fn guild_emojis_update(
&self,
_: Context,
_: GuildId,
_: HashMap<EmojiId, Emoji>
) { ... } fn guild_integrations_update(&self, _: Context, _: GuildId) { ... } fn guild_member_addition(&self, _: Context, _: GuildId, _: Member) { ... } fn guild_member_removal(
&self,
_: Context,
_: GuildId,
_: User,
_: Option<Member>
) { ... } fn guild_member_update(&self, _: Context, _: Option<Member>, _: Member) { ... } fn guild_members_chunk(
&self,
_: Context,
_: GuildId,
_: HashMap<UserId, Member>
) { ... } fn guild_role_create(&self, _: Context, _: GuildId, _: Role) { ... } fn guild_role_delete(
&self,
_: Context,
_: GuildId,
_: RoleId,
_: Option<Role>
) { ... } fn guild_role_update(
&self,
_: Context,
_: GuildId,
_: Option<Role>,
_: Role
) { ... } fn guild_unavailable(&self, _: Context, _: GuildId) { ... } fn guild_update(
&self,
_: Context,
_: Option<Arc<RwLock<Guild>>>,
_: PartialGuild
) { ... } fn message(&self, _: Context, _: Message) { ... } fn message_delete(&self, _: Context, _: ChannelId, _: MessageId) { ... } fn message_delete_bulk(&self, _: Context, _: ChannelId, _: Vec<MessageId>) { ... } fn reaction_add(&self, _: Context, _: Reaction) { ... } fn reaction_remove(&self, _: Context, _: Reaction) { ... } fn reaction_remove_all(&self, _: Context, _: ChannelId, _: MessageId) { ... } fn message_update(&self, _: Context, _: MessageUpdateEvent) { ... } fn presence_replace(&self, _: Context, _: Vec<Presence>) { ... } fn presence_update(&self, _: Context, _: PresenceUpdateEvent) { ... } fn ready(&self, _: Context, _: Ready) { ... } fn resume(&self, _: Context, _: ResumedEvent) { ... } fn shard_stage_update(&self, _: Context, _: ShardStageUpdateEvent) { ... } fn typing_start(&self, _: Context, _: TypingStartEvent) { ... } fn unknown(&self, _: Context, _: String, _: Value) { ... } fn user_update(&self, _: Context, _: CurrentUser, _: CurrentUser) { ... } fn voice_server_update(&self, _: Context, _: VoiceServerUpdateEvent) { ... } fn voice_state_update(&self, _: Context, _: Option<GuildId>, _: VoiceState) { ... } fn webhook_update(&self, _: Context, _: GuildId, _: ChannelId) { ... } }
The core trait for handling events by serenity.
Provided Methods
fn cached(&self, _: Context, _: Vec<GuildId>)
Dispatched when the cache gets full.
Provides the cached guilds' ids.
fn channel_create(&self, _: Context, _: Arc<RwLock<GuildChannel>>)
Dispatched when a channel is created.
Provides said channel's data.
fn category_create(&self, _: Context, _: Arc<RwLock<ChannelCategory>>)
Dispatched when a category is created.
Provides said category's data.
fn category_delete(&self, _: Context, _: Arc<RwLock<ChannelCategory>>)
Dispatched when a category is deleted.
Provides said category's data.
fn private_channel_create(&self, _: Context, _: Arc<RwLock<PrivateChannel>>)
Dispatched when a private channel is created.
Provides said channel's data.
fn channel_delete(&self, _: Context, _: Arc<RwLock<GuildChannel>>)
Dispatched when a channel is deleted.
Provides said channel's data.
fn channel_pins_update(&self, _: Context, _: ChannelPinsUpdateEvent)
Dispatched when a pin is added, deleted.
Provides said pin's data.
fn channel_recipient_addition(&self, _: Context, _: ChannelId, _: User)
Dispatched when a user is added to a Group
.
Provides the group's id and the user's data.
fn channel_recipient_removal(&self, _: Context, _: ChannelId, _: User)
Dispatched when a user is removed to a Group
.
Provides the group's id and the user's data.
fn channel_update(&self, _: Context, _: Option<Channel>, _: Channel)
Dispatched when a channel is updated.
Provides the old channel data, and the new data.
fn guild_ban_addition(&self, _: Context, _: GuildId, _: User)
Dispatched when a user is banned from a guild.
Provides the guild's id and the banned user's data.
fn guild_ban_removal(&self, _: Context, _: GuildId, _: User)
Dispatched when a user's ban is lifted from a guild.
/// Provides the guild's id and the lifted user's data.
fn guild_create(&self, _: Context, _: Guild, _: bool)
Dispatched when a guild is created; or an existing guild's data is sent to us.
Provides the guild's data and whether the guild is new.
fn guild_delete(
&self,
_: Context,
_: PartialGuild,
_: Option<Arc<RwLock<Guild>>>
)
&self,
_: Context,
_: PartialGuild,
_: Option<Arc<RwLock<Guild>>>
)
Dispatched when a guild is deleted.
Provides the partial data of the guild sent by discord, and the full data from the cache, if available.
fn guild_emojis_update(
&self,
_: Context,
_: GuildId,
_: HashMap<EmojiId, Emoji>
)
&self,
_: Context,
_: GuildId,
_: HashMap<EmojiId, Emoji>
)
Dispatched when the emojis are updated.
Provides the guild's id and the new state of the emojis in the guild.
fn guild_integrations_update(&self, _: Context, _: GuildId)
Dispatched when a guild's integration is added, updated or removed.
Provides the guild's id.
fn guild_member_addition(&self, _: Context, _: GuildId, _: Member)
Dispatched when a user joins a guild.
Provides the guild's id and the user's member data.
fn guild_member_removal(
&self,
_: Context,
_: GuildId,
_: User,
_: Option<Member>
)
&self,
_: Context,
_: GuildId,
_: User,
_: Option<Member>
)
Dispatched when a user is removed (kicked).
Provides the guild's id, the user's data, and the user's member data if available.
fn guild_member_update(&self, _: Context, _: Option<Member>, _: Member)
Dispatched when a member is updated (e.g their nickname is updated)
Provides the member's old data (if available) and the new data.
fn guild_members_chunk(
&self,
_: Context,
_: GuildId,
_: HashMap<UserId, Member>
)
&self,
_: Context,
_: GuildId,
_: HashMap<UserId, Member>
)
Dispatched when the data for offline members was requested.
Provides the guild's id and the data.
fn guild_role_create(&self, _: Context, _: GuildId, _: Role)
Dispatched when a role is created.
Provides the guild's id and the new role's data.
fn guild_role_delete(&self, _: Context, _: GuildId, _: RoleId, _: Option<Role>)
Dispatched when a role is deleted.
Provides the guild's id, the role's id and its data if available.
fn guild_role_update(&self, _: Context, _: GuildId, _: Option<Role>, _: Role)
Dispatched when a role is updated.
Provides the guild's id, the role's old (if available) and new data.
Dispatched when a guild became unavailable.
Provides the guild's id.
fn guild_update(
&self,
_: Context,
_: Option<Arc<RwLock<Guild>>>,
_: PartialGuild
)
&self,
_: Context,
_: Option<Arc<RwLock<Guild>>>,
_: PartialGuild
)
Dispatched when the guild is updated.
Provides the guild's old full data (if available) and the new, albeit partial data.
fn message(&self, _: Context, _: Message)
Dispatched when a message is created.
Provides the message's data.
fn message_delete(&self, _: Context, _: ChannelId, _: MessageId)
Dispatched when a message is deleted.
Provides the channel's id and the message's id.
fn message_delete_bulk(&self, _: Context, _: ChannelId, _: Vec<MessageId>)
Dispatched when multiple messages were deleted at once.
Provides the channel's id and the deleted messages' ids.
fn reaction_add(&self, _: Context, _: Reaction)
Dispatched when a new reaction is attached to a message.
Provides the reaction's data.
fn reaction_remove(&self, _: Context, _: Reaction)
Dispatched when a reaction is dettached from a message.
Provides the reaction's data.
fn reaction_remove_all(&self, _: Context, _: ChannelId, _: MessageId)
Dispatched when all reactions of a message are dettached from a message.
Provides the channel's id and the message's id.
fn message_update(&self, _: Context, _: MessageUpdateEvent)
Dispatched when a message is updated.
Provides the new data of the message.
fn presence_replace(&self, _: Context, _: Vec<Presence>)
fn presence_update(&self, _: Context, _: PresenceUpdateEvent)
Dispatched when a user's presence is updated (i.e off -> on).
Provides the presence's new data.
fn ready(&self, _: Context, _: Ready)
Dispatched upon startup.
Provides data about the bot and the guilds it's in.
fn resume(&self, _: Context, _: ResumedEvent)
Dispatched upon reconnection.
Dispatched when a shard's connection stage is updated
Provides the context of the shard and the event information about the update.
fn typing_start(&self, _: Context, _: TypingStartEvent)
Dispatched when a user starts typing.
fn unknown(&self, _: Context, _: String, _: Value)
Dispatched when an unknown event was sent from discord.
Provides the event's name and its unparsed data.
fn user_update(&self, _: Context, _: CurrentUser, _: CurrentUser)
Dispatched when the bot's data is updated.
Provides the old and new data.
fn voice_server_update(&self, _: Context, _: VoiceServerUpdateEvent)
Dispatched when a guild's voice server was updated (or changed to another one).
Provides the voice server's data.
fn voice_state_update(&self, _: Context, _: Option<GuildId>, _: VoiceState)
Dispatched when a user joins, leaves or moves a voice channel.
Provides the guild's id (if available) and the new state of the guild's voice channels.
fn webhook_update(&self, _: Context, _: GuildId, _: ChannelId)
Dispatched when a guild's webhook is updated.
Provides the guild's id and the channel's id the webhook belongs in.