Shrinking methods to Lambda functions
This commit is contained in:
parent
3386db0f66
commit
d99bb79849
@ -9,40 +9,6 @@ namespace TelegramBotBase.Commands
|
||||
{
|
||||
public static class Extensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Adding the default /start command with a description.
|
||||
/// </summary>
|
||||
/// <param name="cmds"></param>
|
||||
/// <param name="description"></param>
|
||||
public static void Start(this Dictionary<BotCommandScope, List<BotCommand>> cmds, String description)
|
||||
{
|
||||
Add(cmds, "start", description, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adding the default /help command with a description.
|
||||
/// </summary>
|
||||
/// <param name="cmds"></param>
|
||||
/// <param name="description"></param>
|
||||
|
||||
public static void Help(this Dictionary<BotCommandScope, List<BotCommand>> cmds, String description)
|
||||
{
|
||||
Add(cmds, "help", description, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adding the default /settings command with a description.
|
||||
/// </summary>
|
||||
/// <param name="cmds"></param>
|
||||
/// <param name="description"></param>
|
||||
|
||||
|
||||
public static void Settings(this Dictionary<BotCommandScope, List<BotCommand>> cmds, String description)
|
||||
{
|
||||
Add(cmds, "settings", description, null);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Adding the command with a description.
|
||||
/// </summary>
|
||||
@ -93,24 +59,38 @@ namespace TelegramBotBase.Commands
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adding the default /start command with a description.
|
||||
/// </summary>
|
||||
/// <param name="cmds"></param>
|
||||
/// <param name="description"></param>
|
||||
public static void Start(this Dictionary<BotCommandScope, List<BotCommand>> cmds, String description) => Add(cmds, "start", description, null);
|
||||
|
||||
/// <summary>
|
||||
/// Adding the default /help command with a description.
|
||||
/// </summary>
|
||||
/// <param name="cmds"></param>
|
||||
/// <param name="description"></param>
|
||||
public static void Help(this Dictionary<BotCommandScope, List<BotCommand>> cmds, String description) => Add(cmds, "help", description, null);
|
||||
|
||||
/// <summary>
|
||||
/// Adding the default /settings command with a description.
|
||||
/// </summary>
|
||||
/// <param name="cmds"></param>
|
||||
/// <param name="description"></param>
|
||||
public static void Settings(this Dictionary<BotCommandScope, List<BotCommand>> cmds, String description) => Add(cmds, "settings", description, null);
|
||||
|
||||
/// <summary>
|
||||
/// Clears all default commands.
|
||||
/// </summary>
|
||||
/// <param name="cmds"></param>
|
||||
public static void ClearDefaultCommands(this Dictionary<BotCommandScope, List<BotCommand>> cmds)
|
||||
{
|
||||
Clear(cmds, null);
|
||||
}
|
||||
|
||||
public static void ClearDefaultCommands(this Dictionary<BotCommandScope, List<BotCommand>> cmds) => Clear(cmds, null);
|
||||
|
||||
/// <summary>
|
||||
/// Clears all commands of a specific device.
|
||||
/// </summary>
|
||||
/// <param name="cmds"></param>
|
||||
public static void ClearChatCommands(this Dictionary<BotCommandScope, List<BotCommand>> cmds, long DeviceId)
|
||||
{
|
||||
Clear(cmds, new BotCommandScopeChat() { ChatId = DeviceId });
|
||||
}
|
||||
public static void ClearChatCommands(this Dictionary<BotCommandScope, List<BotCommand>> cmds, long DeviceId) => Clear(cmds, new BotCommandScopeChat() { ChatId = DeviceId });
|
||||
|
||||
/// <summary>
|
||||
/// Adding a chat command with a description.
|
||||
@ -118,10 +98,7 @@ namespace TelegramBotBase.Commands
|
||||
/// <param name="cmds"></param>
|
||||
/// <param name="command"></param>
|
||||
/// <param name="description"></param>
|
||||
public static void AddChatCommand(this Dictionary<BotCommandScope, List<BotCommand>> cmds, long DeviceId, String command, String description)
|
||||
{
|
||||
Add(cmds, command, description, new BotCommandScopeChat() { ChatId = DeviceId });
|
||||
}
|
||||
public static void AddChatCommand(this Dictionary<BotCommandScope, List<BotCommand>> cmds, long DeviceId, String command, String description) => Add(cmds, command, description, new BotCommandScopeChat() { ChatId = DeviceId });
|
||||
|
||||
/// <summary>
|
||||
/// Adding a group command with a description.
|
||||
@ -129,19 +106,13 @@ namespace TelegramBotBase.Commands
|
||||
/// <param name="cmds"></param>
|
||||
/// <param name="command"></param>
|
||||
/// <param name="description"></param>
|
||||
public static void AddGroupCommand(this Dictionary<BotCommandScope, List<BotCommand>> cmds, String command, String description)
|
||||
{
|
||||
Add(cmds, command, description, new BotCommandScopeAllGroupChats());
|
||||
}
|
||||
public static void AddGroupCommand(this Dictionary<BotCommandScope, List<BotCommand>> cmds, String command, String description) => Add(cmds, command, description, new BotCommandScopeAllGroupChats());
|
||||
|
||||
/// <summary>
|
||||
/// Clears all group commands.
|
||||
/// </summary>
|
||||
/// <param name="cmds"></param>
|
||||
public static void ClearGroupCommands(this Dictionary<BotCommandScope, List<BotCommand>> cmds)
|
||||
{
|
||||
Clear(cmds, new BotCommandScopeAllGroupChats());
|
||||
}
|
||||
public static void ClearGroupCommands(this Dictionary<BotCommandScope, List<BotCommand>> cmds) => Clear(cmds, new BotCommandScopeAllGroupChats());
|
||||
|
||||
/// <summary>
|
||||
/// Adding group admin command with a description.
|
||||
@ -149,19 +120,13 @@ namespace TelegramBotBase.Commands
|
||||
/// <param name="cmds"></param>
|
||||
/// <param name="command"></param>
|
||||
/// <param name="description"></param>
|
||||
public static void AddGroupAdminCommand(this Dictionary<BotCommandScope, List<BotCommand>> cmds, String command, String description)
|
||||
{
|
||||
Add(cmds, command, description, new BotCommandScopeAllChatAdministrators());
|
||||
}
|
||||
public static void AddGroupAdminCommand(this Dictionary<BotCommandScope, List<BotCommand>> cmds, String command, String description) => Add(cmds, command, description, new BotCommandScopeAllChatAdministrators());
|
||||
|
||||
/// <summary>
|
||||
/// Clears all group admin commands.
|
||||
/// </summary>
|
||||
/// <param name="cmds"></param>
|
||||
public static void ClearGroupAdminCommand(this Dictionary<BotCommandScope, List<BotCommand>> cmds)
|
||||
{
|
||||
Clear(cmds, new BotCommandScopeAllChatAdministrators());
|
||||
}
|
||||
public static void ClearGroupAdminCommand(this Dictionary<BotCommandScope, List<BotCommand>> cmds) => Clear(cmds, new BotCommandScopeAllChatAdministrators());
|
||||
|
||||
/// <summary>
|
||||
/// Adding a privat command with a description.
|
||||
@ -169,18 +134,12 @@ namespace TelegramBotBase.Commands
|
||||
/// <param name="cmds"></param>
|
||||
/// <param name="command"></param>
|
||||
/// <param name="description"></param>
|
||||
public static void AddPrivateChatCommand(this Dictionary<BotCommandScope, List<BotCommand>> cmds, String command, String description)
|
||||
{
|
||||
Add(cmds, command, description, new BotCommandScopeAllPrivateChats());
|
||||
}
|
||||
public static void AddPrivateChatCommand(this Dictionary<BotCommandScope, List<BotCommand>> cmds, String command, String description) => Add(cmds, command, description, new BotCommandScopeAllPrivateChats());
|
||||
|
||||
/// <summary>
|
||||
/// Clears all private commands.
|
||||
/// </summary>
|
||||
/// <param name="cmds"></param>
|
||||
public static void ClearPrivateChatCommand(this Dictionary<BotCommandScope, List<BotCommand>> cmds)
|
||||
{
|
||||
Clear(cmds, new BotCommandScopeAllPrivateChats());
|
||||
}
|
||||
public static void ClearPrivateChatCommand(this Dictionary<BotCommandScope, List<BotCommand>> cmds) => Clear(cmds, new BotCommandScopeAllPrivateChats());
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user