Skip to main content

CommandContext

Struct CommandContext 

Source
pub struct CommandContext {
    pub command: String,
    pub params: Vec<String>,
    pub sender: String,
    pub room_id: String,
    pub message_id: String,
    pub timestamp: DateTime<Utc>,
    pub history: Box<dyn HistoryAccess>,
    pub writer: Box<dyn MessageWriter>,
    pub metadata: RoomMetadata,
    pub available_commands: Vec<CommandInfo>,
    pub team_access: Option<Box<dyn TeamAccess>>,
}
Expand description

Context passed to a plugin’s handle method.

Fields§

§command: String

The command name that was invoked (without /).

§params: Vec<String>

Arguments passed after the command name.

§sender: String

Username of the invoker.

§room_id: String

Room ID.

§message_id: String

Message ID that triggered this command.

§timestamp: DateTime<Utc>

Timestamp of the triggering message.

§history: Box<dyn HistoryAccess>

Scoped handle for reading chat history.

§writer: Box<dyn MessageWriter>

Scoped handle for writing back to the chat.

§metadata: RoomMetadata

Snapshot of room metadata.

§available_commands: Vec<CommandInfo>

All registered commands (so /help can list them without holding a reference to the registry).

§team_access: Option<Box<dyn TeamAccess>>

Optional access to daemon-level team membership.

Some in daemon mode (backed by UserRegistry), None in standalone mode where teams are not available.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.