pub struct CommandContext<T: Clone + Send + Sync> {
pub meta: Metadata,
pub application_id: Id<ApplicationMarker>,
pub services: Arc<T>,
pub client: Arc<Client>,
pub event: InteractionCreate,
pub command: CommandData,
pub name: String,
pub options: HashMap<String, CommandOptionValue>,
}
Fields§
§meta: Metadata
§application_id: Id<ApplicationMarker>
§services: Arc<T>
§client: Arc<Client>
§event: InteractionCreate
§command: CommandData
§name: String
§options: HashMap<String, CommandOptionValue>
Implementations§
Source§impl<T: Clone + Send + Sync> CommandContext<T>
impl<T: Clone + Send + Sync> CommandContext<T>
pub fn from_context( meta: Metadata, ctx: Context<T>, event: InteractionCreate, command: CommandData, name: String, options: &[CommandDataOption], ) -> Self
pub fn interaction(&self) -> InteractionClient<'_>
pub fn client(&self) -> Arc<Client>
pub async fn guild(&self) -> Result<Option<Guild>, Error>
pub async fn response( &self, response: InteractionResponse, ) -> Result<Response<EmptyBody>, Error>
pub async fn update( &self, message: impl Into<String>, ) -> Result<Response<Message>, Error>
pub async fn reply( &self, message: impl Into<String>, ) -> Result<Response<EmptyBody>, Error>
pub async fn defer(&self) -> Result<Response<EmptyBody>, Error>
pub async fn defer_ephemeral(&self) -> Result<Response<EmptyBody>, Error>
pub fn get_arg_string_optional( &self, name: &str, ) -> Result<Option<String>, Error>
pub fn get_arg_string(&self, name: &str) -> Result<String, Error>
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for CommandContext<T>
impl<T> !RefUnwindSafe for CommandContext<T>
impl<T> Send for CommandContext<T>
impl<T> Sync for CommandContext<T>
impl<T> Unpin for CommandContext<T>
impl<T> !UnwindSafe for CommandContext<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more