[−][src]Struct panda::client::Client
Client it's the main struct of Panda library, it receives and handle all discord events
Methods
impl Client[src]
pub async fn new(token: impl Into<String>) -> StdResult<Self, PandaError>[src]
Create a new Panda Client with the default configs
pub fn new_with_config()[src]
Create a new "discord" Client with personalized configs
pub async fn start<'_>(&'_ mut self) -> StdResult<(), PandaError>[src]
Start the bot connection process
pub fn on_ready<F, Fut>(&mut self, func: F) where
F: Fn(Arc<Session>, Ready) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static, [src]
F: Fn(Arc<Session>, Ready) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static,
Set the handler function for Ready event
pub fn on_channel_create<F, Fut>(&mut self, func: F) where
F: Fn(Arc<Session>, ChannelCreate) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static, [src]
F: Fn(Arc<Session>, ChannelCreate) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static,
Set the handler function for ChannelCreate event
pub fn on_channel_update<F, Fut>(&mut self, func: F) where
F: Fn(Arc<Session>, ChannelUpdate) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static, [src]
F: Fn(Arc<Session>, ChannelUpdate) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static,
Set the handler function for ChannelUpdate event
pub fn on_channel_delete<F, Fut>(&mut self, func: F) where
F: Fn(Arc<Session>, ChannelDelete) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static, [src]
F: Fn(Arc<Session>, ChannelDelete) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static,
Set the handler function for ChannelDelete event
pub fn on_channel_pins_update<F, Fut>(&mut self, func: F) where
F: Fn(Arc<Session>, ChannelPinsUpdate) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static, [src]
F: Fn(Arc<Session>, ChannelPinsUpdate) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static,
Set the handler function for ChannelPinsUpdate event
pub fn on_guild_create<F, Fut>(&mut self, func: F) where
F: Fn(Arc<Session>, GuildCreate) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static, [src]
F: Fn(Arc<Session>, GuildCreate) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static,
Set the handler function for GuildCreate event
pub fn on_guild_update<F, Fut>(&mut self, func: F) where
F: Fn(Arc<Session>, GuildUpdate) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static, [src]
F: Fn(Arc<Session>, GuildUpdate) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static,
Set the handler function for GuildUpdate event
pub fn on_guild_delete<F, Fut>(&mut self, func: F) where
F: Fn(Arc<Session>, GuildDelete) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static, [src]
F: Fn(Arc<Session>, GuildDelete) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static,
Set the handler function for GuildDelete event
pub fn on_guild_ban_add<F, Fut>(&mut self, func: F) where
F: Fn(Arc<Session>, GuildBanAdd) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static, [src]
F: Fn(Arc<Session>, GuildBanAdd) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static,
Set the handler function for GuildBanAdd event
pub fn on_guild_ban_remove<F, Fut>(&mut self, func: F) where
F: Fn(Arc<Session>, GuildBanRemove) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static, [src]
F: Fn(Arc<Session>, GuildBanRemove) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static,
Set the handler function for GuildBanRemove event
pub fn on_guild_emojis_update<F, Fut>(&mut self, func: F) where
F: Fn(Arc<Session>, GuildEmojisUpdate) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static, [src]
F: Fn(Arc<Session>, GuildEmojisUpdate) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static,
Set the handler function for GuildEmojisUpdate event
pub fn on_guild_integrations_update<F, Fut>(&mut self, func: F) where
F: Fn(Arc<Session>, GuildIntegrationsUpdate) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static, [src]
F: Fn(Arc<Session>, GuildIntegrationsUpdate) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static,
Set the handler function for GuildIntegrationsUpdate event
pub fn on_guild_member_add<F, Fut>(&mut self, func: F) where
F: Fn(Arc<Session>, GuildMemberAdd) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static, [src]
F: Fn(Arc<Session>, GuildMemberAdd) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static,
Set the handler function for GuildMemberAdd event
pub fn on_guild_member_update<F, Fut>(&mut self, func: F) where
F: Fn(Arc<Session>, GuildMemberUpdate) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static, [src]
F: Fn(Arc<Session>, GuildMemberUpdate) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static,
Set the handler function for GuildMemberUpdate event
pub fn on_guild_member_remove<F, Fut>(&mut self, func: F) where
F: Fn(Arc<Session>, GuildMemberRemove) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static, [src]
F: Fn(Arc<Session>, GuildMemberRemove) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static,
Set the handler function for GuildMemberRemove event
pub fn on_guild_members_chunk<F, Fut>(&mut self, func: F) where
F: Fn(Arc<Session>, GuildMembersChunk) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static, [src]
F: Fn(Arc<Session>, GuildMembersChunk) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static,
Set the handler function for GuildMembersChunk event
pub fn on_guild_role_create<F, Fut>(&mut self, func: F) where
F: Fn(Arc<Session>, GuildRoleCreate) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static, [src]
F: Fn(Arc<Session>, GuildRoleCreate) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static,
Set the handler function for GuildRoleCreate event
pub fn on_guild_role_update<F, Fut>(&mut self, func: F) where
F: Fn(Arc<Session>, GuildRoleUpdate) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static, [src]
F: Fn(Arc<Session>, GuildRoleUpdate) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static,
Set the handler function for GuildRoleUpdate event
pub fn on_guild_role_delete<F, Fut>(&mut self, func: F) where
F: Fn(Arc<Session>, GuildRoleDelete) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static, [src]
F: Fn(Arc<Session>, GuildRoleDelete) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static,
Set the handler function for GuildRoleDelete event
pub fn on_message_create<F, Fut>(&mut self, func: F) where
F: Fn(Arc<Session>, MessageCreate) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static, [src]
F: Fn(Arc<Session>, MessageCreate) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static,
Set the handler function for MessageCreate event
pub fn on_message_update<F, Fut>(&mut self, func: F) where
F: Fn(Arc<Session>, MessageUpdate) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static, [src]
F: Fn(Arc<Session>, MessageUpdate) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static,
Set the handler function for MessageUpdate event
pub fn on_message_delete<F, Fut>(&mut self, func: F) where
F: Fn(Arc<Session>, MessageDelete) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static, [src]
F: Fn(Arc<Session>, MessageDelete) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static,
Set the handler function for MessageDelete event
pub fn on_message_delete_bulk<F, Fut>(&mut self, func: F) where
F: Fn(Arc<Session>, MessageDelete) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static, [src]
F: Fn(Arc<Session>, MessageDelete) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static,
Set the handler function for MessageDeleteBulk event
pub fn on_message_reaction_add<F, Fut>(&mut self, func: F) where
F: Fn(Arc<Session>, MessageReactionAdd) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static, [src]
F: Fn(Arc<Session>, MessageReactionAdd) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static,
Set the handler function for MessageReactionAdd event
pub fn on_message_reaction_remove<F, Fut>(&mut self, func: F) where
F: Fn(Arc<Session>, MessageReactionRemove) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static, [src]
F: Fn(Arc<Session>, MessageReactionRemove) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static,
Set the handler function for MessageReactionRemove event
pub fn on_message_reaction_remove_all<F, Fut>(&mut self, func: F) where
F: Fn(Arc<Session>, MessageReactionRemoveAll) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static, [src]
F: Fn(Arc<Session>, MessageReactionRemoveAll) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static,
Set the handler function for MessageReactionRemoveAll event
pub fn on_message_reaction_remove_emoji<F, Fut>(&mut self, func: F) where
F: Fn(Arc<Session>, MessageReactionRemoveEmoji) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static, [src]
F: Fn(Arc<Session>, MessageReactionRemoveEmoji) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static,
Set the handler function for MessageReactionRemoveEmoji event
pub fn on_presence_update<F, Fut>(&mut self, func: F) where
F: Fn(Arc<Session>, PresenceUpdate) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static, [src]
F: Fn(Arc<Session>, PresenceUpdate) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static,
Set the handler function for PresenceUpdate event
pub fn on_typing_start<F, Fut>(&mut self, func: F) where
F: Fn(Arc<Session>, TypingStart) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static, [src]
F: Fn(Arc<Session>, TypingStart) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static,
Set the handler function for TypingStart event
pub fn on_user_update<F, Fut>(&mut self, func: F) where
F: Fn(Arc<Session>, UserUpdate) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static, [src]
F: Fn(Arc<Session>, UserUpdate) -> Fut + Sync + Send + 'static,
Fut: Future<Output = Result<(), Box<dyn Error>>> + Send + 'static,
Set the handler function for UserUpdate event
Auto Trait Implementations
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,