From 10fdd36e8700bea40f378c32a7de8e10d28d6d57 Mon Sep 17 00:00:00 2001 From: Master Kwoth Date: Sun, 6 Aug 2017 12:02:13 +0200 Subject: [PATCH] fixed sfi and sfw not ignoring server admin when message is edited. #1444 --- .../Modules/Permissions/Services/FilterService.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/NadekoBot/Modules/Permissions/Services/FilterService.cs b/src/NadekoBot/Modules/Permissions/Services/FilterService.cs index 886f85e7..e15926a9 100644 --- a/src/NadekoBot/Modules/Permissions/Services/FilterService.cs +++ b/src/NadekoBot/Modules/Permissions/Services/FilterService.cs @@ -61,12 +61,15 @@ namespace NadekoBot.Modules.Permissions.Services _client.MessageUpdated += (oldData, newMsg, channel) => { - var _ = Task.Run(async () => + var _ = Task.Run(() => { var guild = (channel as ITextChannel)?.Guild; var usrMsg = newMsg as IUserMessage; - return (await FilterInvites(guild, usrMsg)) || (await FilterWords(guild, usrMsg)); + if (guild == null || usrMsg == null) + return Task.CompletedTask; + + return TryBlockEarly(guild, usrMsg); }); return Task.CompletedTask; }; @@ -116,9 +119,9 @@ namespace NadekoBot.Modules.Permissions.Services if (usrMsg is null) return false; - if ((InviteFilteringChannels.Contains(usrMsg.Channel.Id) || - InviteFilteringServers.Contains(guild.Id)) && - usrMsg.Content.IsDiscordInvite()) + if ((InviteFilteringChannels.Contains(usrMsg.Channel.Id) + || InviteFilteringServers.Contains(guild.Id)) + && usrMsg.Content.IsDiscordInvite()) { try {