Adding additional bot command checks toa void invalid configurations
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Telegram.Bot.Types;
|
||||
|
||||
@@ -20,6 +21,16 @@ public static class Extensions
|
||||
scope = BotCommandScope.Default();
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(command))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(command), $"{nameof(command)} parameter can not be null or empty");
|
||||
}
|
||||
|
||||
if(command.StartsWith(Constants.Telegram.BotCommandIndicator))
|
||||
{
|
||||
throw new ArgumentException($"{nameof(command)} parameter does not have to start with a slash, please remove.", $"{nameof(command)}");
|
||||
}
|
||||
|
||||
var item = cmds.FirstOrDefault(a => a.Key.Type == scope.Type);
|
||||
|
||||
if (item.Value != null)
|
||||
|
||||
Reference in New Issue
Block a user