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}"
|
CallbackData = $"option|{From.Id}|edit|{option.OptionId}"
|
||||||
};
|
};
|
||||||
|
|
||||||
if (option.OptionType == OptionType.OnOff)
|
switch (option.OptionType)
|
||||||
{
|
{
|
||||||
var isEnabled = await ((IOption<bool>) option).GetValueAsync(Chat.Id);
|
case OptionType.OnOff:
|
||||||
button.Text += isEnabled ? " 🟢" : " 🔴";
|
{
|
||||||
|
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;
|
return button;
|
||||||
|
|||||||
Reference in New Issue
Block a user