Trait miraie::prelude::Conversation[][src]

pub trait Conversation: Sized {
    type Sender: Into<QQ>;
    fn sender(&self) -> &Self::Sender;
fn as_message(&self) -> &MessageChain;
fn followed_group_message(&self, bot: &Bot) -> MessageStream<Self>;
fn followed_sender_messages(&self, bot: &Bot) -> MessageStream<Self>;
fn reply<'life0, 'life1, 'async_trait>(
        &'life0 self,
        message: impl Into<MessageChain> + Send + 'static,
        bot: &'life1 Bot
    ) -> Pin<Box<dyn Future<Output = Result<SendMessageResponse>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
;
fn reply_unquote<'life0, 'life1, 'async_trait>(
        &'life0 self,
        message: impl Into<MessageChain> + Send + 'static,
        bot: &'life1 Bot
    ) -> Pin<Box<dyn Future<Output = Result<SendMessageResponse>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
; fn prompt<'life0, 'life1, 'async_trait>(
        &'life0 self,
        message: impl Into<MessageChain> + Send + 'static,
        bot: &'life1 Bot
    ) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: Sync + 'async_trait
, { ... }
fn prompt_timeout<'life0, 'life1, 'async_trait>(
        &'life0 self,
        message: impl Into<MessageChain> + Send + 'static,
        bot: &'life1 Bot,
        timeout: Duration
    ) -> Pin<Box<dyn Future<Output = Result<Self>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: Sync + 'async_trait
, { ... } }
Expand description

消息流,实现了消息流的类型(群聊消息和私聊消息)可以:

  • 获取后续的消息
  • 对本条消息进行回复

Associated Types

发送者的类型,对于私聊类型就是 crate::messages::friend::FriendMember, 对于群聊是 crate::messages::group::GroupMember; 这两者都实现了 Into<QQ>

Required methods

获取发送者信息

转换为 MessageChain

获取本聊天的后续消息。 如果是群聊,则返回当前群聊的任意后续消息; 如果是私聊,则返回当前私聊的任意后续消息。

获取这条消息发送者在本聊天中发送的后续消息

回复这条消息,产生“引用”。

不引用,直接回复这条消息

Provided methods

返回一条消息并等待回复,默认超时 10s

Example

let msg: GroupMessage;
let confirm = msg.promp("你确定吗?").await?;
if confirm.message.as_confirm().unwrap_or_default() {
    // do something...
}

返回一条消息并等待回复

Implementors