admin: create /setalternative command to edit message variants

This commit is contained in:
Akulij 2025-05-04 18:42:28 +03:00
parent e68ba4b796
commit d0882ffe0b

View File

@ -31,6 +31,9 @@ pub enum AdminCommands {
EditButton, EditButton,
/// Set specified literal value /// Set specified literal value
SetLiteral { literal: String }, 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 /// Sets chat where this message entered as support's chats
SetChat, SetChat,
} }
@ -86,6 +89,7 @@ pub async fn admin_command_handler(
dialogue dialogue
.update(State::Edit { .update(State::Edit {
literal, literal,
variant: None,
lang: "ru".to_string(), lang: "ru".to_string(),
is_caption_set: false, is_caption_set: false,
}) })
@ -95,6 +99,20 @@ pub async fn admin_command_handler(
Ok(()) 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 => { AdminCommands::SetChat => {
dialogue.exit().await?; dialogue.exit().await?;
db.set_literal("support_chat_id", &msg.chat.id.0.to_string()) db.set_literal("support_chat_id", &msg.chat.id.0.to_string())