diff --git a/src/NadekoBot/Modules/CustomReactions/CustomReactions.cs b/src/NadekoBot/Modules/CustomReactions/CustomReactions.cs index 1df05284..44a14738 100644 --- a/src/NadekoBot/Modules/CustomReactions/CustomReactions.cs +++ b/src/NadekoBot/Modules/CustomReactions/CustomReactions.cs @@ -42,18 +42,19 @@ namespace NadekoBot.Modules.CustomReactions var t = Task.Run(async () => { + var content = umsg.Content.ToLowerInvariant(); HashSet reactions; GuildReactions.TryGetValue(channel.Guild.Id, out reactions); if (reactions != null && reactions.Any()) { - var reaction = reactions.Where(cr => cr.TriggerWithContext(umsg) == umsg.Content).Shuffle().FirstOrDefault(); + var reaction = reactions.Where(cr => cr.TriggerWithContext(umsg) == 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) == umsg.Content).Shuffle().FirstOrDefault(); + var greaction = GlobalReactions.Where(cr => cr.TriggerWithContext(umsg) == content).Shuffle().FirstOrDefault(); if (greaction != null) { try { await channel.SendMessageAsync(greaction.ResponseWithContext(umsg)).ConfigureAwait(false); } catch { } @@ -71,6 +72,8 @@ namespace NadekoBot.Modules.CustomReactions if (string.IsNullOrWhiteSpace(message) || string.IsNullOrWhiteSpace(key)) return; + key = key.ToLowerInvariant(); + if ((channel == null && !NadekoBot.Credentials.IsOwner(imsg.Author)) || (channel != null && !((IGuildUser)imsg.Author).GuildPermissions.Administrator)) { try { await imsg.Channel.SendMessageAsync("Insufficient permissions. Requires Bot ownership for global custom reactions, and Administrator for guild custom reactions."); } catch { } @@ -81,7 +84,7 @@ namespace NadekoBot.Modules.CustomReactions { GuildId = channel?.Guild.Id, IsRegex = false, - Trigger = key.ToLowerInvariant(), + Trigger = key, Response = message, }; diff --git a/src/NadekoBot/Modules/Translator/GoogleTranslator.cs b/src/NadekoBot/Modules/Searches/Commands/GoogleTranslator.cs similarity index 99% rename from src/NadekoBot/Modules/Translator/GoogleTranslator.cs rename to src/NadekoBot/Modules/Searches/Commands/GoogleTranslator.cs index 7421db47..769d2a80 100644 --- a/src/NadekoBot/Modules/Translator/GoogleTranslator.cs +++ b/src/NadekoBot/Modules/Searches/Commands/GoogleTranslator.cs @@ -5,7 +5,7 @@ using System.Net; using System.Net.Http; using System.Threading.Tasks; -namespace NadekoBot.Modules.Translator +namespace NadekoBot.Modules.Searches { public class GoogleTranslator { diff --git a/src/NadekoBot/Modules/Translator/Translator.cs b/src/NadekoBot/Modules/Searches/Commands/Translator.cs similarity index 86% rename from src/NadekoBot/Modules/Translator/Translator.cs rename to src/NadekoBot/Modules/Searches/Commands/Translator.cs index d13cdb54..07d36f91 100644 --- a/src/NadekoBot/Modules/Translator/Translator.cs +++ b/src/NadekoBot/Modules/Searches/Commands/Translator.cs @@ -7,15 +7,10 @@ using System.Threading.Tasks; using NadekoBot.Services; using Discord.WebSocket; -namespace NadekoBot.Modules.Translator +namespace NadekoBot.Modules.Searches { - [NadekoModule("Translator", "~")] - public class Translator : DiscordModule + public partial class Searches { - public Translator(ILocalization loc, CommandService cmds, ShardedDiscordClient client) : base(loc, cmds, client) - { - } - [NadekoCommand, Usage, Description, Aliases] [RequireContext(ContextType.Guild)] public async Task Translate(IUserMessage umsg, string langs, [Remainder] string text = null)