Skip to main content

ContextData

Trait ContextData 

Source
pub trait ContextData: ContextDataBounds + 'static {
    // Required methods
    fn channel_id(&self) -> &str;
    fn user_id(&self) -> &str;
    fn user_name(&self) -> &str;
    fn command_name(&self) -> Option<&str>;
    fn command_args(&self) -> Option<&str>;
    fn option(&self, name: &str) -> Option<OptionValue>;
    fn button_id(&self) -> Option<&str>;
    fn message_content(&self) -> Option<&str>;
    fn as_any(&self) -> &dyn Any;

    // Provided method
    fn action_sender(&self) -> Option<Box<dyn ChatActionSender>> { ... }
}
Expand description

Trait implemented by platform-specific context data

Platform implementations provide this to expose event data through the unified Context API.

Required Methods§

Source

fn channel_id(&self) -> &str

Source

fn user_id(&self) -> &str

Source

fn user_name(&self) -> &str

Source

fn command_name(&self) -> Option<&str>

Source

fn command_args(&self) -> Option<&str>

Source

fn option(&self, name: &str) -> Option<OptionValue>

Source

fn button_id(&self) -> Option<&str>

Source

fn message_content(&self) -> Option<&str>

Source

fn as_any(&self) -> &dyn Any

Provided Methods§

Source

fn action_sender(&self) -> Option<Box<dyn ChatActionSender>>

Create a chat action sender for the current channel

Returns None if the platform doesn’t support chat actions or if the necessary client is not available.

Implementors§