summary refs log tree commit diff
path: root/src/system/bot/client.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/system/bot/client.rs')
-rw-r--r--src/system/bot/client.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/system/bot/client.rs b/src/system/bot/client.rs
index 4d4f7bb..a2d1b28 100644
--- a/src/system/bot/client.rs
+++ b/src/system/bot/client.rs
@@ -35,6 +35,18 @@ impl Client {
             .expect("Could not deserialize message")
     }
 
+    pub async fn fetch_recent_channel_messages(&self, channel_id: ChannelId) -> Result<Vec<FullMessage>, TwiError> {
+        let client = self.client.lock().await;
+
+        Ok(client
+            .channel_messages(channel_id)
+            .limit(10).unwrap()
+            .await?
+            .model()
+            .await
+            .unwrap())
+    }
+
     pub async fn resend_message(&self, message_id: MessageId, channel_id: ChannelId) {
         let bot_conf = self.bot_conf.read().await;
         let message = self.fetch_message(message_id, channel_id).await;