Добавлена поддержка цветов кнопок телеграмма
This commit is contained in:
@@ -375,7 +375,17 @@ public sealed class TelegramAdapter : IMessengerAdapterSetup
|
||||
{
|
||||
if (inline is null || !inline.Any()) return null;
|
||||
return new InlineKeyboardMarkup(
|
||||
inline.Select(row => row.Select(b => new InlineKeyboardButton(b.Label, b.Value)).ToArray()).ToArray()
|
||||
inline.Select(row => row.Select(b => new InlineKeyboardButton(b.Label, b.Value)
|
||||
{
|
||||
Style = b.Style switch
|
||||
{
|
||||
ButtonStyle.Default => null,
|
||||
ButtonStyle.Info => KeyboardButtonStyle.Primary,
|
||||
ButtonStyle.Error => KeyboardButtonStyle.Danger,
|
||||
ButtonStyle.Success => KeyboardButtonStyle.Success,
|
||||
_ => null,
|
||||
}
|
||||
}).ToArray()).ToArray()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -385,7 +395,17 @@ public sealed class TelegramAdapter : IMessengerAdapterSetup
|
||||
|
||||
if (reply.Any())
|
||||
{
|
||||
return new ReplyKeyboardMarkup(reply.Select(row => row.Select(b => new KeyboardButton(b.Label)).ToArray()).ToArray())
|
||||
return new ReplyKeyboardMarkup(reply.Select(row => row.Select(b => new KeyboardButton(b.Label)
|
||||
{
|
||||
Style = b.Style switch
|
||||
{
|
||||
ButtonStyle.Default => null,
|
||||
ButtonStyle.Info => KeyboardButtonStyle.Primary,
|
||||
ButtonStyle.Error => KeyboardButtonStyle.Danger,
|
||||
ButtonStyle.Success => KeyboardButtonStyle.Success,
|
||||
_ => null,
|
||||
}
|
||||
}).ToArray()).ToArray())
|
||||
{
|
||||
ResizeKeyboard = true
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user