From 1dd8f9b5eacf3db432b7c525bf63e73f6e17e587 Mon Sep 17 00:00:00 2001 From: Kwoth Date: Sat, 15 Oct 2016 14:59:51 +0200 Subject: [PATCH] Fixes to custom reactions case insensitivty --- src/NadekoBot/Modules/Administration/Commands/Migration.cs | 2 +- src/NadekoBot/Modules/CustomReactions/CustomReactions.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/NadekoBot/Modules/Administration/Commands/Migration.cs b/src/NadekoBot/Modules/Administration/Commands/Migration.cs index b434bb1d..feb3aab0 100644 --- a/src/NadekoBot/Modules/Administration/Commands/Migration.cs +++ b/src/NadekoBot/Modules/Administration/Commands/Migration.cs @@ -415,7 +415,7 @@ namespace NadekoBot.Modules.Administration IsRegex = false, OwnerOnly = false, Response = res, - Trigger = cr.Key, + Trigger = cr.Key.ToLowerInvariant(), }); }).ToArray()); diff --git a/src/NadekoBot/Modules/CustomReactions/CustomReactions.cs b/src/NadekoBot/Modules/CustomReactions/CustomReactions.cs index a10f8f13..2e72533e 100644 --- a/src/NadekoBot/Modules/CustomReactions/CustomReactions.cs +++ b/src/NadekoBot/Modules/CustomReactions/CustomReactions.cs @@ -42,19 +42,19 @@ namespace NadekoBot.Modules.CustomReactions var t = Task.Run(async () => { - var content = umsg.Content.ToLowerInvariant(); + var content = umsg.Content.Trim().ToLowerInvariant(); ConcurrentHashSet reactions; GuildReactions.TryGetValue(channel.Guild.Id, out reactions); if (reactions != null && reactions.Any()) { - var reaction = reactions.Where(cr => cr.TriggerWithContext(umsg) == content).Shuffle().FirstOrDefault(); + var reaction = reactions.Where(cr => cr.TriggerWithContext(umsg).Trim().ToLowerInvariant() == content).Shuffle().FirstOrDefault(); if (reaction != null) { try { await channel.SendMessageAsync(reaction.ResponseWithContext(umsg)).ConfigureAwait(false); } catch { } return; } } - var greaction = GlobalReactions.Where(cr => cr.TriggerWithContext(umsg) == content).Shuffle().FirstOrDefault(); + var greaction = GlobalReactions.Where(cr => cr.TriggerWithContext(umsg).Trim().ToLowerInvariant() == content).Shuffle().FirstOrDefault(); if (greaction != null) { try { await channel.SendMessageAsync(greaction.ResponseWithContext(umsg)).ConfigureAwait(false); } catch { }