[][src]Trait serenity::client::EventHandler

pub trait EventHandler: Send + Sync {
    pub fn cache_ready(&self, _ctx: Context, _guilds: Vec<GuildId>) { ... }
pub fn channel_create(
        &self,
        _ctx: Context,
        _channel: Arc<RwLock<GuildChannel>>
    ) { ... }
pub fn category_create(
        &self,
        _ctx: Context,
        _category: Arc<RwLock<ChannelCategory>>
    ) { ... }
pub fn category_delete(
        &self,
        _ctx: Context,
        _category: Arc<RwLock<ChannelCategory>>
    ) { ... }
pub fn private_channel_create(
        &self,
        _ctx: Context,
        _channel: Arc<RwLock<PrivateChannel>>
    ) { ... }
pub fn channel_delete(
        &self,
        _ctx: Context,
        _channel: Arc<RwLock<GuildChannel>>
    ) { ... }
pub fn channel_pins_update(
        &self,
        _ctx: Context,
        _pin: ChannelPinsUpdateEvent
    ) { ... }
pub fn channel_recipient_addition(
        &self,
        _ctx: Context,
        _group_id: ChannelId,
        _user: User
    ) { ... }
pub fn channel_recipient_removal(
        &self,
        _ctx: Context,
        _group_id: ChannelId,
        _user: User
    ) { ... }
pub fn channel_update(
        &self,
        _ctx: Context,
        _old: Option<Channel>,
        _new: Channel
    ) { ... }
pub fn guild_ban_addition(
        &self,
        _ctx: Context,
        _guild_id: GuildId,
        _banned_user: User
    ) { ... }
pub fn guild_ban_removal(
        &self,
        _ctx: Context,
        _guild_id: GuildId,
        _unbanned_user: User
    ) { ... }
pub fn guild_create(&self, _ctx: Context, _guild: Guild, _is_new: bool) { ... }
pub fn guild_delete(
        &self,
        _ctx: Context,
        _incomplete: PartialGuild,
        _full: Option<Arc<RwLock<Guild>>>
    ) { ... }
pub fn guild_emojis_update(
        &self,
        _ctx: Context,
        _guild_id: GuildId,
        _current_state: HashMap<EmojiId, Emoji>
    ) { ... }
pub fn guild_integrations_update(&self, _ctx: Context, _guild_id: GuildId) { ... }
pub fn guild_member_addition(
        &self,
        _ctx: Context,
        _guild_id: GuildId,
        _new_member: Member
    ) { ... }
pub fn guild_member_removal(
        &self,
        _ctx: Context,
        _guild: GuildId,
        _user: User,
        _member_data_if_available: Option<Member>
    ) { ... }
pub fn guild_member_update(
        &self,
        _ctx: Context,
        _old_if_available: Option<Member>,
        _new: Member
    ) { ... }
pub fn guild_members_chunk(
        &self,
        _ctx: Context,
        _guild_id: GuildId,
        _offline_members: HashMap<UserId, Member>
    ) { ... }
pub fn guild_role_create(
        &self,
        _ctx: Context,
        _guild_id: GuildId,
        _new: Role
    ) { ... }
pub fn guild_role_delete(
        &self,
        _ctx: Context,
        _guild_id: GuildId,
        _removed_role_id: RoleId,
        _removed_role_data_if_available: Option<Role>
    ) { ... }
pub fn guild_role_update(
        &self,
        _ctx: Context,
        _guild_id: GuildId,
        _old_data_if_available: Option<Role>,
        _new: Role
    ) { ... }
pub fn guild_unavailable(&self, _ctx: Context, _guild_id: GuildId) { ... }
pub fn guild_update(
        &self,
        _ctx: Context,
        _old_data_if_available: Option<Arc<RwLock<Guild>>>,
        _new_but_incomplete: PartialGuild
    ) { ... }
pub fn message(&self, _ctx: Context, _new_message: Message) { ... }
pub fn message_delete(
        &self,
        _ctx: Context,
        _channel_id: ChannelId,
        _deleted_message_id: MessageId
    ) { ... }
pub fn message_delete_bulk(
        &self,
        _ctx: Context,
        _channel_id: ChannelId,
        _multiple_deleted_messages_ids: Vec<MessageId>
    ) { ... }
pub fn message_update(
        &self,
        _ctx: Context,
        _old_if_available: Option<Message>,
        _new: Option<Message>,
        _event: MessageUpdateEvent
    ) { ... }
pub fn reaction_add(&self, _ctx: Context, _add_reaction: Reaction) { ... }
pub fn reaction_remove(&self, _ctx: Context, _removed_reaction: Reaction) { ... }
pub fn reaction_remove_all(
        &self,
        _ctx: Context,
        _channel_id: ChannelId,
        _removed_from_message_id: MessageId
    ) { ... }
pub fn presence_replace(&self, _ctx: Context, _: Vec<Presence>) { ... }
pub fn presence_update(&self, _ctx: Context, _new_data: PresenceUpdateEvent) { ... }
pub fn ready(&self, _ctx: Context, _data_about_bot: Ready) { ... }
pub fn resume(&self, _ctx: Context, _: ResumedEvent) { ... }
pub fn shard_stage_update(&self, _ctx: Context, _: ShardStageUpdateEvent) { ... }
pub fn typing_start(&self, _ctx: Context, _: TypingStartEvent) { ... }
pub fn unknown(&self, _ctx: Context, _name: String, _raw: Value) { ... }
pub fn user_update(
        &self,
        _ctx: Context,
        _old_data: CurrentUser,
        _new: CurrentUser
    ) { ... }
pub fn voice_server_update(&self, _ctx: Context, _: VoiceServerUpdateEvent) { ... }
pub fn voice_state_update(
        &self,
        _ctx: Context,
        _: Option<GuildId>,
        _old: Option<VoiceState>,
        _new: VoiceState
    ) { ... }
pub fn webhook_update(
        &self,
        _ctx: Context,
        _guild_id: GuildId,
        _belongs_to_channel_id: ChannelId
    ) { ... } }

The core trait for handling events by serenity.

Provided methods

pub fn cache_ready(&self, _ctx: Context, _guilds: Vec<GuildId>)[src]

Dispatched when the cache has received and inserted all data from guilds.

This process happens upon starting your bot and should be fairly quick. However, cache actions performed prior this event may fail as the data could be not inserted yet.

Provides the cached guilds' ids.

pub fn channel_create(&self, _ctx: Context, _channel: Arc<RwLock<GuildChannel>>)[src]

Dispatched when a channel is created.

Provides said channel's data.

pub fn category_create(
    &self,
    _ctx: Context,
    _category: Arc<RwLock<ChannelCategory>>
)
[src]

Dispatched when a category is created.

Provides said category's data.

pub fn category_delete(
    &self,
    _ctx: Context,
    _category: Arc<RwLock<ChannelCategory>>
)
[src]

Dispatched when a category is deleted.

Provides said category's data.

pub fn private_channel_create(
    &self,
    _ctx: Context,
    _channel: Arc<RwLock<PrivateChannel>>
)
[src]

Dispatched when a private channel is created.

Provides said channel's data.

pub fn channel_delete(&self, _ctx: Context, _channel: Arc<RwLock<GuildChannel>>)[src]

Dispatched when a channel is deleted.

Provides said channel's data.

pub fn channel_pins_update(&self, _ctx: Context, _pin: ChannelPinsUpdateEvent)[src]

Dispatched when a pin is added, deleted.

Provides said pin's data.

pub fn channel_recipient_addition(
    &self,
    _ctx: Context,
    _group_id: ChannelId,
    _user: User
)
[src]

Dispatched when a user is added to a Group.

Provides the group's id and the user's data.

pub fn channel_recipient_removal(
    &self,
    _ctx: Context,
    _group_id: ChannelId,
    _user: User
)
[src]

Dispatched when a user is removed to a Group.

Provides the group's id and the user's data.

pub fn channel_update(
    &self,
    _ctx: Context,
    _old: Option<Channel>,
    _new: Channel
)
[src]

Dispatched when a channel is updated.

Provides the old channel data, and the new data.

pub fn guild_ban_addition(
    &self,
    _ctx: Context,
    _guild_id: GuildId,
    _banned_user: User
)
[src]

Dispatched when a user is banned from a guild.

Provides the guild's id and the banned user's data.

pub fn guild_ban_removal(
    &self,
    _ctx: Context,
    _guild_id: GuildId,
    _unbanned_user: User
)
[src]

Dispatched when a user's ban is lifted from a guild.

Provides the guild's id and the lifted user's data.

pub fn guild_create(&self, _ctx: Context, _guild: Guild, _is_new: bool)[src]

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.

pub fn guild_delete(
    &self,
    _ctx: Context,
    _incomplete: PartialGuild,
    _full: Option<Arc<RwLock<Guild>>>
)
[src]

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.

pub fn guild_emojis_update(
    &self,
    _ctx: Context,
    _guild_id: GuildId,
    _current_state: HashMap<EmojiId, Emoji>
)
[src]

Dispatched when the emojis are updated.

Provides the guild's id and the new state of the emojis in the guild.

pub fn guild_integrations_update(&self, _ctx: Context, _guild_id: GuildId)[src]

Dispatched when a guild's integration is added, updated or removed.

Provides the guild's id.

pub fn guild_member_addition(
    &self,
    _ctx: Context,
    _guild_id: GuildId,
    _new_member: Member
)
[src]

Dispatched when a user joins a guild.

Provides the guild's id and the user's member data.

pub fn guild_member_removal(
    &self,
    _ctx: Context,
    _guild: GuildId,
    _user: User,
    _member_data_if_available: Option<Member>
)
[src]

Dispatched when a user's membership ends by leaving, getting kicked, or being banned.

Provides the guild's id, the user's data, and the user's member data if available.

pub fn guild_member_update(
    &self,
    _ctx: Context,
    _old_if_available: Option<Member>,
    _new: Member
)
[src]

Dispatched when a member is updated (e.g their nickname is updated).

Provides the member's old data (if available) and the new data.

pub fn guild_members_chunk(
    &self,
    _ctx: Context,
    _guild_id: GuildId,
    _offline_members: HashMap<UserId, Member>
)
[src]

Dispatched when the data for offline members was requested.

Provides the guild's id and the data.

pub fn guild_role_create(&self, _ctx: Context, _guild_id: GuildId, _new: Role)[src]

Dispatched when a role is created.

Provides the guild's id and the new role's data.

pub fn guild_role_delete(
    &self,
    _ctx: Context,
    _guild_id: GuildId,
    _removed_role_id: RoleId,
    _removed_role_data_if_available: Option<Role>
)
[src]

Dispatched when a role is deleted.

Provides the guild's id, the role's id and its data if available.

pub fn guild_role_update(
    &self,
    _ctx: Context,
    _guild_id: GuildId,
    _old_data_if_available: Option<Role>,
    _new: Role
)
[src]

Dispatched when a role is updated.

Provides the guild's id, the role's old (if available) and new data.

pub fn guild_unavailable(&self, _ctx: Context, _guild_id: GuildId)[src]

Dispatched when a guild became unavailable.

Provides the guild's id.

pub fn guild_update(
    &self,
    _ctx: Context,
    _old_data_if_available: Option<Arc<RwLock<Guild>>>,
    _new_but_incomplete: PartialGuild
)
[src]

Dispatched when the guild is updated.

Provides the guild's old full data (if available) and the new, albeit partial data.

pub fn message(&self, _ctx: Context, _new_message: Message)[src]

Dispatched when a message is created.

Provides the message's data.

pub fn message_delete(
    &self,
    _ctx: Context,
    _channel_id: ChannelId,
    _deleted_message_id: MessageId
)
[src]

Dispatched when a message is deleted.

Provides the channel's id and the message's id.

pub fn message_delete_bulk(
    &self,
    _ctx: Context,
    _channel_id: ChannelId,
    _multiple_deleted_messages_ids: Vec<MessageId>
)
[src]

Dispatched when multiple messages were deleted at once.

Provides the channel's id and the deleted messages' ids.

pub fn message_update(
    &self,
    _ctx: Context,
    _old_if_available: Option<Message>,
    _new: Option<Message>,
    _event: MessageUpdateEvent
)
[src]

Dispatched when a message is updated.

Provides the old message if available, the new message as an option in case of cache inconsistencies, and the raw MessageUpdateEvent as a fallback.

pub fn reaction_add(&self, _ctx: Context, _add_reaction: Reaction)[src]

Dispatched when a new reaction is attached to a message.

Provides the reaction's data.

pub fn reaction_remove(&self, _ctx: Context, _removed_reaction: Reaction)[src]

Dispatched when a reaction is detached from a message.

Provides the reaction's data.

pub fn reaction_remove_all(
    &self,
    _ctx: Context,
    _channel_id: ChannelId,
    _removed_from_message_id: MessageId
)
[src]

Dispatched when all reactions of a message are detached from a message.

Provides the channel's id and the message's id.

pub fn presence_replace(&self, _ctx: Context, _: Vec<Presence>)[src]

pub fn presence_update(&self, _ctx: Context, _new_data: PresenceUpdateEvent)[src]

Dispatched when a user's presence is updated (e.g off -> on).

Provides the presence's new data.

pub fn ready(&self, _ctx: Context, _data_about_bot: Ready)[src]

Dispatched upon startup.

Provides data about the bot and the guilds it's in.

pub fn resume(&self, _ctx: Context, _: ResumedEvent)[src]

Dispatched upon reconnection.

pub fn shard_stage_update(&self, _ctx: Context, _: ShardStageUpdateEvent)[src]

Dispatched when a shard's connection stage is updated

Provides the context of the shard and the event information about the update.

pub fn typing_start(&self, _ctx: Context, _: TypingStartEvent)[src]

Dispatched when a user starts typing.

pub fn unknown(&self, _ctx: Context, _name: String, _raw: Value)[src]

Dispatched when an unknown event was sent from discord.

Provides the event's name and its unparsed data.

pub fn user_update(
    &self,
    _ctx: Context,
    _old_data: CurrentUser,
    _new: CurrentUser
)
[src]

Dispatched when the bot's data is updated.

Provides the old and new data.

pub fn voice_server_update(&self, _ctx: Context, _: VoiceServerUpdateEvent)[src]

Dispatched when a guild's voice server was updated (or changed to another one).

Provides the voice server's data.

pub fn voice_state_update(
    &self,
    _ctx: Context,
    _: Option<GuildId>,
    _old: Option<VoiceState>,
    _new: VoiceState
)
[src]

Dispatched when a user joins, leaves or moves to a voice channel.

Provides the guild's id (if available) and the old and the new state of the guild's voice channels.

pub fn webhook_update(
    &self,
    _ctx: Context,
    _guild_id: GuildId,
    _belongs_to_channel_id: ChannelId
)
[src]

Dispatched when a guild's webhook is updated.

Provides the guild's id and the channel's id the webhook belongs in.

Loading content...

Implementors

Loading content...