Changed the discord bot to be case insensitive.

Added IsEmpty and HasOne IEnumerable Extensions.
This commit is contained in:
Brett Hewitson 2021-12-17 15:27:52 +10:00
parent 734332f10c
commit dd431e93b2
20 changed files with 383 additions and 107 deletions

View file

@ -72,6 +72,7 @@ namespace ServerManagerTool.DiscordBot
// Force all commands to run async
DefaultRunMode = RunMode.Async,
LogLevel = LogLevelHelper.GetLogSeverity(logLevel),
CaseSensitiveCommands = false,
};
var discordBotConfig = new DiscordBotConfig

View file

@ -71,7 +71,7 @@ namespace ServerManagerTool.DiscordBot.Services
// Check if the message has a valid command prefix
var argPos = 0;
if (msg.HasStringPrefix(_config["DiscordSettings:Prefix"], ref argPos) || msg.HasMentionPrefix(_discord.CurrentUser, ref argPos))
if (msg.HasStringPrefix(_config["DiscordSettings:Prefix"], ref argPos, StringComparison.OrdinalIgnoreCase) || msg.HasMentionPrefix(_discord.CurrentUser, ref argPos))
{
if (LogLevel.Debug.ToString().Equals(_config["DiscordSettings:LogLevel"]))
await _logger?.OnLogAsync(new LogMessage(LogSeverity.Debug, MessageSource.System.ToString(), $"Message prefix matched, message will be processed."));