pub struct PrivateMsgEvent {Show 16 fields
pub time: i64,
pub self_id: i64,
pub post_type: PostType,
pub message_type: String,
pub sub_type: String,
pub message: Message,
pub message_id: i32,
pub user_id: i64,
pub anonymous: Option<Anonymous>,
pub raw_message: String,
pub font: i32,
pub sender: Sender,
pub text: Option<String>,
pub human_text: String,
pub original_json: Value,
pub api_tx: Sender<ApiAndOptOneshot>,
}Fields§
§time: i64事件发生的时间戳
self_id: i64收到事件的机器人 登陆号
post_type: PostType上报类型
message_type: String消息类型
sub_type: String消息子类型,如果是好友则是 friend,如果是群临时会话则是 group
message: Message消息内容
message_id: i32消息 ID
user_id: i64发送者号
anonymous: Option<Anonymous>匿名信息,如果不是匿名消息则为 null
raw_message: String原始消息内容
font: i32字体
sender: Sender发送人信息
text: Option<String>处理过的纯文本,如果是纯图片或无文本,此处为None
human_text: String处理过的文本,会解析成人类易读形式,里面会包含[image][face]等解析后字符串
original_json: Value原始的onebot消息,已处理成json格式
api_tx: Sender<ApiAndOptOneshot>不推荐的消息发送方式
Implementations§
Source§impl PrivateMsgEvent
impl PrivateMsgEvent
pub fn reply<T>(&self, msg: T)
pub fn reply_and_quote<T>(&self, msg: T)
pub fn get_text(&self) -> String
pub fn get_sender_nickname(&self) -> String
pub fn borrow_text(&self) -> Option<&str>
Trait Implementations§
Source§impl CanSendApi for PrivateMsgEvent
impl CanSendApi for PrivateMsgEvent
Source§impl Clone for PrivateMsgEvent
impl Clone for PrivateMsgEvent
Source§fn clone(&self) -> PrivateMsgEvent
fn clone(&self) -> PrivateMsgEvent
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PrivateMsgEvent
impl Debug for PrivateMsgEvent
Source§impl Event for PrivateMsgEvent
impl Event for PrivateMsgEvent
Source§fn de(
event: &InternalEvent,
_: &BotInformation,
api_tx: &Sender<ApiAndOptOneshot>,
) -> Option<Self>
fn de( event: &InternalEvent, _: &BotInformation, api_tx: &Sender<ApiAndOptOneshot>, ) -> Option<Self>
解析事件 Read more
Source§impl<I> Index<I> for PrivateMsgEventwhere
I: Index,
impl<I> Index<I> for PrivateMsgEventwhere
I: Index,
Source§impl RepliableEvent for PrivateMsgEvent
impl RepliableEvent for PrivateMsgEvent
Source§fn reply_and_quote<T>(&self, msg: T)
fn reply_and_quote<T>(&self, msg: T)
快速回复消息并且引用
Source§fn get_sender_nickname(&self) -> String
fn get_sender_nickname(&self) -> String
便捷获取发送者昵称,如果无名字,此处为空字符串
Source§fn borrow_text(&self) -> Option<&str>
fn borrow_text(&self) -> Option<&str>
借用 event 的 text,只是做了一下self.text.as_deref()的包装
fn reply_builder<M>(&self, msg: M, auto_escape: bool) -> SendApiwhere
M: Into<OneBotMessage>,
Auto Trait Implementations§
impl Freeze for PrivateMsgEvent
impl RefUnwindSafe for PrivateMsgEvent
impl Send for PrivateMsgEvent
impl Sync for PrivateMsgEvent
impl Unpin for PrivateMsgEvent
impl UnsafeUnpin for PrivateMsgEvent
impl UnwindSafe for PrivateMsgEvent
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