;acmdcds added to benefit ;cmdcd, permission system can now take aliases

This commit is contained in:
Kwoth
2016-07-19 16:53:09 +02:00
parent 3b8e9a6af7
commit 123b75b7c9
2 changed files with 22 additions and 1 deletions

View File

@ -55,9 +55,11 @@ namespace NadekoBot.Modules.Permissions.Classes
if (string.IsNullOrWhiteSpace(commandText))
throw new ArgumentNullException(nameof(commandText));
var normalizedCmdTxt = commandText.Trim().ToUpperInvariant();
foreach (var com in NadekoBot.Client.GetService<CommandService>().AllCommands)
{
if (com.Text.ToLower().Equals(commandText.Trim().ToLower()))
if (com.Text.ToUpperInvariant().Equals(normalizedCmdTxt) || com.Aliases.Select(c=>c.ToUpperInvariant()).Contains(normalizedCmdTxt))
return com.Text;
}
throw new NullReferenceException("That command does not exist.");