Struct miraie::bot::Bot [−][src]
pub struct Bot { /* fields omitted */ }
Expand description
Implementations
对 mirai bot 发送一个请求,默认超时 10s,如果需要调整超时,使用 Self::request_timeout
。
对 mirai bot 发送一个请求,带有自定义超时
获取一个全部群聊消息的 stream
获取一个私聊消息的 stream
通过 前缀关键词 来注册一个回调。目前不可取消。
只有前缀完全匹配的消息才会进行匹配。
command
方法比 handler
的方法相对而言实现更加高效,如果可能,尽量使用 command
来注册。
Example
let bot = bot.command("在吗", |msg: GroupMessage, bot: Bot| async move {
msg.reply("嘎哈", &bot).await?;
Result::<(), Error>::Ok(())
});
// 也可以直接返回 `String` 或者 `Result<String>` 之类的
let bot = bot.command("在吗", |_: GroupMessage| async { "嘎哈" });
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Bot
impl !UnwindSafe for Bot
Blanket Implementations
Mutably borrows from an owned value. Read more