Simplifying BotBuilder BotCommands
- Simplifying BotBuilder BotCommands - updating test project
This commit is contained in:
parent
ca1c382924
commit
b65ec13d8b
@ -144,9 +144,9 @@ namespace TelegramBotBase.Builder
|
|||||||
|
|
||||||
public ISessionSerializationStage DefaultCommands()
|
public ISessionSerializationStage DefaultCommands()
|
||||||
{
|
{
|
||||||
_botcommands.AddStartCommand("Starts the bot");
|
_botcommands.Start("Starts the bot");
|
||||||
_botcommands.AddHelpCommand("Should show you some help");
|
_botcommands.Help("Should show you some help");
|
||||||
_botcommands.AddSettingsCommand("Should show you some settings");
|
_botcommands.Settings("Should show you some settings");
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -12,7 +12,7 @@ namespace TelegramBotBase.Commands
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="cmds"></param>
|
/// <param name="cmds"></param>
|
||||||
/// <param name="description"></param>
|
/// <param name="description"></param>
|
||||||
public static void AddStartCommand(this List<BotCommand> cmds, String description)
|
public static void Start(this List<BotCommand> cmds, String description)
|
||||||
{
|
{
|
||||||
cmds.Add(new BotCommand() { Command = "start", Description = description });
|
cmds.Add(new BotCommand() { Command = "start", Description = description });
|
||||||
}
|
}
|
||||||
@ -22,7 +22,7 @@ namespace TelegramBotBase.Commands
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="cmds"></param>
|
/// <param name="cmds"></param>
|
||||||
/// <param name="description"></param>
|
/// <param name="description"></param>
|
||||||
public static void AddHelpCommand(this List<BotCommand> cmds, String description)
|
public static void Help(this List<BotCommand> cmds, String description)
|
||||||
{
|
{
|
||||||
cmds.Add(new BotCommand() { Command = "help", Description = description });
|
cmds.Add(new BotCommand() { Command = "help", Description = description });
|
||||||
}
|
}
|
||||||
@ -32,9 +32,20 @@ namespace TelegramBotBase.Commands
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="cmds"></param>
|
/// <param name="cmds"></param>
|
||||||
/// <param name="description"></param>
|
/// <param name="description"></param>
|
||||||
public static void AddSettingsCommand(this List<BotCommand> cmds, String description)
|
public static void Settings(this List<BotCommand> cmds, String description)
|
||||||
{
|
{
|
||||||
cmds.Add(new BotCommand() { Command = "settings", Description = description });
|
cmds.Add(new BotCommand() { Command = "settings", Description = description });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adding the command with a description.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cmds"></param>
|
||||||
|
/// <param name="command"></param>
|
||||||
|
/// <param name="description"></param>
|
||||||
|
public static void Add(this List<BotCommand> cmds, String command, String description)
|
||||||
|
{
|
||||||
|
cmds.Add(new BotCommand() { Command = command, Description = description });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,12 +26,12 @@ namespace TelegramBotBaseTest
|
|||||||
.NoProxy()
|
.NoProxy()
|
||||||
.CustomCommands(a =>
|
.CustomCommands(a =>
|
||||||
{
|
{
|
||||||
a.AddStartCommand("Starts the bot");
|
a.Start("Starts the bot");
|
||||||
a.AddHelpCommand("Should show you some help");
|
a.Help("Should show you some help");
|
||||||
a.AddSettingsCommand("Should show you some settings");
|
a.Settings("Should show you some settings");
|
||||||
a.Add(new BotCommand() { Command = "form1", Description = "Opens test form 1" });
|
a.Add("form1", "Opens test form 1");
|
||||||
a.Add(new BotCommand() { Command = "form2", Description = "Opens test form 2" });
|
a.Add("form2", "Opens test form 2");
|
||||||
a.Add(new BotCommand() { Command = "params", Description = "Returns all send parameters as a message." });
|
a.Add("params", "Returns all send parameters as a message.");
|
||||||
})
|
})
|
||||||
.NoSerialization()
|
.NoSerialization()
|
||||||
.UseEnglish()
|
.UseEnglish()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user