pub struct QqPlatformAdapter { /* private fields */ }Expand description
QQ Official Bot platform adapter.
Implementations§
Source§impl QqPlatformAdapter
impl QqPlatformAdapter
Sourcepub async fn connect(
config: QqConfig,
shutdown: Arc<Notify>,
) -> Result<Arc<Self>>
pub async fn connect( config: QqConfig, shutdown: Arc<Notify>, ) -> Result<Arc<Self>>
Connect to the QQ gateway and start the heartbeat + dispatch tasks.
This is the constructor used in place of PlatformAdapter::connect when
we already own the config (avoids the Self::Config indirection).
shutdown is notified on Ctrl+C to let background tasks exit gracefully.
Trait Implementations§
Source§impl PlatformAdapter for QqPlatformAdapter
impl PlatformAdapter for QqPlatformAdapter
Source§fn capabilities() -> PlatformCaps
fn capabilities() -> PlatformCaps
Platform capabilities. Used by
ChatbotFrontend for streaming strategy
and by the Markdown sanitizer.Source§fn send_message<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
chat_id: &'life1 str,
text: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<SendResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn send_message<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
chat_id: &'life1 str,
text: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<SendResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Send a text message to a chat. Returns the platform message ID.
Source§fn edit_message<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_chat_id: &'life1 str,
_msg_id: &'life2 str,
_text: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn edit_message<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
_chat_id: &'life1 str,
_msg_id: &'life2 str,
_text: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Edit a previously-sent message. Default implementation falls back
to
send_message for platforms that don’t support editing.Source§fn upload_file<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
chat_id: &'life1 str,
file_path: &'life2 str,
media_type: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<UploadResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn upload_file<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
chat_id: &'life1 str,
file_path: &'life2 str,
media_type: &'life3 str,
) -> Pin<Box<dyn Future<Output = Result<UploadResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Upload a file to the platform. Returns the platform file URL/ID
that can be referenced in subsequent messages. Read more
Source§fn send_media_message<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
chat_id: &'life1 str,
file_url: &'life2 str,
file_name: &'life3 str,
media_type: &'life4 str,
) -> Pin<Box<dyn Future<Output = Result<SendResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn send_media_message<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
chat_id: &'life1 str,
file_url: &'life2 str,
file_name: &'life3 str,
media_type: &'life4 str,
) -> Pin<Box<dyn Future<Output = Result<SendResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Send a media message (image/file) to a chat. Default implementation
falls back to
send_message with the URL as text.Source§fn recv_event<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<PlatformEvent>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn recv_event<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<PlatformEvent>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Receive the next platform event. Blocks until an event arrives.
Auto Trait Implementations§
impl !Freeze for QqPlatformAdapter
impl !RefUnwindSafe for QqPlatformAdapter
impl !UnwindSafe for QqPlatformAdapter
impl Send for QqPlatformAdapter
impl Sync for QqPlatformAdapter
impl Unpin for QqPlatformAdapter
impl UnsafeUnpin for QqPlatformAdapter
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