From d0882ffe0ba1b2234fd9879aaed776346215f45f Mon Sep 17 00:00:00 2001 From: Akulij Date: Sun, 4 May 2025 18:42:28 +0300 Subject: [PATCH] admin: create /setalternative command to edit message variants --- src/admin.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/admin.rs b/src/admin.rs index 85643a8..1b99afd 100644 --- a/src/admin.rs +++ b/src/admin.rs @@ -31,6 +31,9 @@ pub enum AdminCommands { EditButton, /// Set specified literal value SetLiteral { literal: String }, + /// Set specified literal value + #[command(description = "handle a username and an age.", parse_with = "split")] + SetAlternative { literal: String, variant: String }, /// Sets chat where this message entered as support's chats SetChat, } @@ -86,6 +89,7 @@ pub async fn admin_command_handler( dialogue .update(State::Edit { literal, + variant: None, lang: "ru".to_string(), is_caption_set: false, }) @@ -95,6 +99,20 @@ pub async fn admin_command_handler( Ok(()) } + AdminCommands::SetAlternative { literal, variant } => { + dialogue + .update(State::Edit { + literal, + variant: Some(variant), + lang: "ru".to_string(), + is_caption_set: false, + }) + .await?; + bot.send_message(msg.chat.id, "Send message for literal alternative") + .await?; + + Ok(()) + } AdminCommands::SetChat => { dialogue.exit().await?; db.set_literal("support_chat_id", &msg.chat.id.0.to_string())