From ffdfd0e84e05f77a5a9cabac2ef5fac91896ec15 Mon Sep 17 00:00:00 2001 From: Kwoth Date: Fri, 17 Feb 2017 15:20:28 +0100 Subject: [PATCH] word and invite filtering work on edited messages too, now --- src/NadekoBot/Services/CommandHandler.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/NadekoBot/Services/CommandHandler.cs b/src/NadekoBot/Services/CommandHandler.cs index 2b827191..c563586c 100644 --- a/src/NadekoBot/Services/CommandHandler.cs +++ b/src/NadekoBot/Services/CommandHandler.cs @@ -90,6 +90,27 @@ namespace NadekoBot.Services }); _client.MessageReceived += MessageReceivedHandler; + _client.MessageUpdated += (oldmsg, newMsg) => + { + var ignore = Task.Run(async () => + { + try + { + var usrMsg = newMsg as SocketUserMessage; + var guild = (usrMsg?.Channel as ITextChannel)?.Guild; + + if (guild != null && !await InviteFiltered(guild, usrMsg).ConfigureAwait(false)) + await WordFiltered(guild, usrMsg).ConfigureAwait(false); + + } + catch (Exception ex) + { + _log.Warn(ex); + } + return Task.CompletedTask; + }); + return Task.CompletedTask; + }; return Task.CompletedTask; }