From 8a3e8c470543ea43622dcaa1a8c23c908f23d20e Mon Sep 17 00:00:00 2001 From: Akulij Date: Thu, 5 Jun 2025 22:59:28 +0500 Subject: [PATCH] filter variant to use only defined in runtime config --- src/bot_handler.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/bot_handler.rs b/src/bot_handler.rs index a96af0e..c5998c4 100644 --- a/src/bot_handler.rs +++ b/src/bot_handler.rs @@ -87,6 +87,16 @@ async fn handle_botmessage(bot: Bot, mut db: DB, bm: BotMessage, msg: Message) - None }; + // Filtering to use only defined variants + let variant = match bm + .variants() + .iter() + .any(|v| v == variant.as_ref().map_or("", |v| v)) + { + true => variant, + false => None, + }; + let is_propagate: bool = match bm.get_handler() { Some(handler) => 'prop: { let ctx = match handler.context() {