From 0a5d9e66d6f54f4e2d99a96a0cbbd8b906f87681 Mon Sep 17 00:00:00 2001 From: Master Kwoth Date: Tue, 6 Jun 2017 05:02:06 +0200 Subject: [PATCH] few more async events --- src/NadekoBot/Services/Administration/MuteService.cs | 2 +- src/NadekoBot/Services/Permissions/FilterService.cs | 7 +++++-- src/NadekoBot/_Extensions/Extensions.cs | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/NadekoBot/Services/Administration/MuteService.cs b/src/NadekoBot/Services/Administration/MuteService.cs index 01b29d34..7ed9062a 100644 --- a/src/NadekoBot/Services/Administration/MuteService.cs +++ b/src/NadekoBot/Services/Administration/MuteService.cs @@ -79,7 +79,7 @@ namespace NadekoBot.Services.Administration if (muted == null || !muted.Contains(usr.Id)) return Task.CompletedTask; - Task.Run(() => MuteUser(usr).ConfigureAwait(false)); + var _ = Task.Run(() => MuteUser(usr).ConfigureAwait(false)); } catch (Exception ex) { diff --git a/src/NadekoBot/Services/Permissions/FilterService.cs b/src/NadekoBot/Services/Permissions/FilterService.cs index 0fced623..69d54cde 100644 --- a/src/NadekoBot/Services/Permissions/FilterService.cs +++ b/src/NadekoBot/Services/Permissions/FilterService.cs @@ -57,8 +57,11 @@ namespace NadekoBot.Services.Permissions WordFilteringChannels = new ConcurrentHashSet(gcs.SelectMany(gc => gc.FilterWordsChannelIds.Select(fwci => fwci.ChannelId))); - _client.MessageUpdated += (oldData, newMsg, channel) - => FilterInvites((channel as ITextChannel)?.Guild, newMsg as IUserMessage); + _client.MessageUpdated += (oldData, newMsg, channel) => + { + var _ = Task.Run(() => FilterInvites((channel as ITextChannel)?.Guild, newMsg as IUserMessage)); + return Task.CompletedTask; + } } public async Task TryBlockEarly(IGuild guild, IUserMessage msg) diff --git a/src/NadekoBot/_Extensions/Extensions.cs b/src/NadekoBot/_Extensions/Extensions.cs index d0eba8dd..7ed4f270 100644 --- a/src/NadekoBot/_Extensions/Extensions.cs +++ b/src/NadekoBot/_Extensions/Extensions.cs @@ -120,8 +120,8 @@ namespace NadekoBot.Extensions reactionRemoved = delegate { }; var wrap = new ReactionEventWrapper(client, msg); - wrap.OnReactionAdded += reactionAdded; - wrap.OnReactionRemoved += reactionRemoved; + wrap.OnReactionAdded += (r) => { var _ = Task.Run(() => reactionAdded(r)); }; + wrap.OnReactionRemoved += (r) => { var _ = Task.Run(() => reactionRemoved(r)); }; return wrap; }