Skip to content

Commit

Permalink
feat(Group.cs): add a new keyboard display
Browse files Browse the repository at this point in the history
  • Loading branch information
ZenonEl committed Jan 3, 2025
1 parent 95eea0d commit 984af12
Showing 1 changed file with 35 additions and 20 deletions.
55 changes: 35 additions & 20 deletions TelegramBot/Utils/Keyboard/Group.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,43 @@ namespace MediaTelegramBot.Utils;

public static class UsersGroup
{
public static InlineKeyboardMarkup GetUsersGroupActionsKeyboardMarkup()
public static InlineKeyboardMarkup GetUsersGroupActionsKeyboardMarkup(bool groupsMoreZero)
{
var inlineKeyboard = new InlineKeyboardMarkup(new[]
{
new[]
{
InlineKeyboardButton.WithCallbackData(Config.GetResourceString("CreateGroupButtonText"), $"user_create_group"),
},
new[]
{
InlineKeyboardButton.WithCallbackData(Config.GetResourceString("EditGroupButtonText"), $"user_edit_group"),
},
new[]
{
InlineKeyboardButton.WithCallbackData(Config.GetResourceString("DeleteGroupButtonText"), $"user_delete_group"),
},
new[]
var kb = new List<List<InlineKeyboardButton>>
{
new[]
{
InlineKeyboardButton.WithCallbackData(
Config.GetResourceString("CreateGroupButtonText"),
"user_create_group"
)
}.ToList()
};

if (groupsMoreZero)
{
kb.Add(new[]
{
InlineKeyboardButton.WithCallbackData(
Config.GetResourceString("EditGroupButtonText"),
"user_edit_group"
)
}.ToList());

kb.Add(new[]
{
InlineKeyboardButton.WithCallbackData(
Config.GetResourceString("DeleteGroupButtonText"),
"user_delete_group"
)
}.ToList());
}
kb.Add( new[]
{
KeyboardUtils.GetReturnButton()
},
});
return inlineKeyboard;
}.ToList());

return new InlineKeyboardMarkup(kb);
}

public static InlineKeyboardMarkup GetUsersGroupEditActionsKeyboardMarkup(int groupId)
Expand All @@ -47,7 +62,7 @@ public static InlineKeyboardMarkup GetUsersGroupEditActionsKeyboardMarkup(int gr
},
new[]
{
InlineKeyboardButton.WithCallbackData(Config.GetResourceString("ChangeIsDefaultEnabled"), $"user_change_is_default:{groupId}"),
InlineKeyboardButton.WithCallbackData(Config.GetResourceString("ChangeIsDefaultEnabledText"), $"user_change_is_default:{groupId}"),
},
new[]
{
Expand Down

0 comments on commit 984af12

Please sign in to comment.