pub struct EventContext {
pub me: Option<Ready>,
}Expand description
What an event handler can do: send, reply, react, delete and send direct messages. Every call is an ordinary command on the bot’s member, checked by the host.
Fields§
§me: Option<Ready>Who and where the bot is, once on_ready has run (always, for every later event).
Implementations§
Source§impl EventContext
impl EventContext
Sourcepub fn reply_to(
&self,
message: &Message,
reply: impl Into<Reply>,
) -> Result<Id, HostError>
pub fn reply_to( &self, message: &Message, reply: impl Into<Reply>, ) -> Result<Id, HostError>
Sourcepub fn dm(
&self,
member_id: &str,
reply: impl Into<Reply>,
) -> Result<(Id, Id), HostError>
pub fn dm( &self, member_id: &str, reply: impl Into<Reply>, ) -> Result<(Id, Id), HostError>
Sends a direct message to a member (capability dms). Returns the DM’s channel id and
the message id. FORBIDDEN with reason dms_closed when the member does not take DMs
from bots or closed this one.
§Errors
The host’s refusal.
Sourcepub fn is_me(&self, member_id: &str) -> bool
pub fn is_me(&self, member_id: &str) -> bool
Whether member_id is the bot itself (to ignore its own messages).
Sourcepub fn mentions_me(&self, message: &Message) -> bool
pub fn mentions_me(&self, message: &Message) -> bool
Whether message mentions the bot: by its member id, by @everyone, or by one of its
roles. Only when the message names roles does it ask the host for the bot’s own roles
(community::get_member); a refusal there counts as not mentioned.
Trait Implementations§
Source§impl Clone for EventContext
impl Clone for EventContext
Source§fn clone(&self) -> EventContext
fn clone(&self) -> EventContext
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more