Skip to main content

RepliableEvent

Trait RepliableEvent 

Source
pub trait RepliableEvent {
    // Required methods
    fn reply_builder<M>(&self, msg: M, auto_escape: bool) -> SendApi
       where M: Into<OneBotMessage>;
    fn reply<T>(&self, msg: T)
       where KoviMessage: From<T>,
             T: Serialize;
    fn reply_and_quote<T>(&self, msg: T)
       where KoviMessage: From<T>,
             T: Serialize;
    fn get_text(&self) -> String;
    fn get_sender_nickname(&self) -> String;
    fn borrow_text(&self) -> Option<&str>;
}
Expand description

满足此 trait 即可被回复

Required Methods§

Source

fn reply_builder<M>(&self, msg: M, auto_escape: bool) -> SendApi
where M: Into<OneBotMessage>,

Source

fn reply<T>(&self, msg: T)
where KoviMessage: From<T>, T: Serialize,

快速回复消息

Source

fn reply_and_quote<T>(&self, msg: T)
where KoviMessage: From<T>, T: Serialize,

快速回复消息并且引用

Source

fn get_text(&self) -> String

便捷获取文本,如果没有文本则会返回空字符串,如果只需要借用,请使用 borrow_text()

Source

fn get_sender_nickname(&self) -> String

便捷获取发送者昵称,如果无名字,此处为空字符串

Source

fn borrow_text(&self) -> Option<&str>

借用 event 的 text,只是做了一下self.text.as_deref()的包装

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§