pub struct Session {Show 21 fields
pub app: Arc<Context>,
pub bot: Arc<Bot>,
pub channel: Channel,
pub event: SessionEvent,
pub user: User,
pub author: Author,
pub channel_id: String,
pub channel_name: String,
pub content: String,
pub elements: Vec<MessageElement>,
pub guild_id: String,
pub guild_name: String,
pub id: String,
pub is_direct: bool,
pub message_id: String,
pub platform: String,
pub quote: Option<Box<Message>>,
pub self_id: String,
pub timestamp: i64,
pub type_: String,
pub user_id: String,
}Expand description
表示一个会话,封装了事件上下文并提供了便捷的交互方法。
Fields§
§app: Arc<Context>当前会话的应用上下文。
bot: Arc<Bot>当前会话绑定的机器人实例。
channel: Channel当前会话绑定的频道数据
event: SessionEvent会话事件数据
user: User当前会话绑定的用户数据
channel_id: String§channel_name: String§content: String§elements: Vec<MessageElement>§guild_id: String§guild_name: String§id: String§is_direct: bool§message_id: String§platform: String§quote: Option<Box<Message>>§self_id: String§timestamp: i64§type_: String§user_id: StringImplementations§
Source§impl Session
impl Session
Sourcepub fn new(bot: Arc<Bot>, event: SessionEvent) -> Self
pub fn new(bot: Arc<Bot>, event: SessionEvent) -> Self
Sourcepub async fn send(
&self,
elements: &[MessageElement],
) -> FrameworkResult<Vec<String>>
pub async fn send( &self, elements: &[MessageElement], ) -> FrameworkResult<Vec<String>>
在当前上下文发送消息
Auto Trait Implementations§
impl !RefUnwindSafe for Session
impl !UnwindSafe for Session
impl Freeze for Session
impl Send for Session
impl Sync for Session
impl Unpin for Session
impl UnsafeUnpin for Session
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