admin: create /setalternative command to edit message variants
This commit is contained in:
parent
e68ba4b796
commit
d0882ffe0b
18
src/admin.rs
18
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())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user