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§
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 message_content(&self) -> Option<&str>
fn as_any(&self) -> &dyn Any
Provided Methods§
Sourcefn action_sender(&self) -> Option<Box<dyn ChatActionSender>>
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.