mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
[core] show choice short name in option button
This commit is contained in:
@@ -141,10 +141,22 @@ public class SettingsHandler : CommonHandler
|
||||
CallbackData = $"option|{From.Id}|edit|{option.OptionId}"
|
||||
};
|
||||
|
||||
if (option.OptionType == OptionType.OnOff)
|
||||
switch (option.OptionType)
|
||||
{
|
||||
case OptionType.OnOff:
|
||||
{
|
||||
var isEnabled = await ((IOption<bool>) option).GetValueAsync(Chat.Id);
|
||||
button.Text += isEnabled ? " 🟢" : " 🔴";
|
||||
break;
|
||||
}
|
||||
|
||||
case OptionType.Select:
|
||||
{
|
||||
var value = await ((IOption<string>) option).GetValueAsync(Chat.Id);
|
||||
var currentChoice = option.ChoiceList.Single(x => x.Id == value);
|
||||
button.Text += $" ({currentChoice.ShortName})";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return button;
|
||||
|
||||
Reference in New Issue
Block a user