From 57f1a3c914e76f4c2855e859fe0de3519c554d61 Mon Sep 17 00:00:00 2001 From: modulatingforce <modulatingforce@gmail.com> Date: Fri, 31 Jan 2025 13:47:12 -0500 Subject: [PATCH] msg cache per channel --- src/botcore/bot.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/botcore/bot.rs b/src/botcore/bot.rs index b70b09c..71b5cb9 100644 --- a/src/botcore/bot.rs +++ b/src/botcore/bot.rs @@ -344,6 +344,18 @@ impl Bot &self.message_cache } + /// get message cache newest to oldest for a channel + pub async fn get_message_cache_per_channel(&self,channel:String) -> Vec<PrivmsgMessage> { + let cache = self.message_cache.lock().await; + let mut rslt = vec![]; + for a in cache.iter().rev().filter(|x| { x.channel_login==channel }).into_iter() { + rslt.push(a.clone()); + + } + rslt + } + + }