forked from TeamInklings/Octobot
Optimize event handlers until we update to .NET 7
This commit is contained in:
parent
29c2332ad9
commit
917e7e5775
1 changed files with 12 additions and 10 deletions
|
@ -1,4 +1,5 @@
|
||||||
using Discord;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using Discord;
|
||||||
using Discord.Rest;
|
using Discord.Rest;
|
||||||
using Discord.WebSocket;
|
using Discord.WebSocket;
|
||||||
|
|
||||||
|
@ -8,16 +9,17 @@ public static class EventHandler {
|
||||||
private static readonly DiscordSocketClient Client = Boyfriend.Client;
|
private static readonly DiscordSocketClient Client = Boyfriend.Client;
|
||||||
private static bool _sendReadyMessages = true;
|
private static bool _sendReadyMessages = true;
|
||||||
|
|
||||||
|
[SuppressMessage("ReSharper", "ConvertClosureToMethodGroup")]
|
||||||
public static void InitEvents() {
|
public static void InitEvents() {
|
||||||
Client.Ready += ReadyEvent;
|
Client.Ready += () => ReadyEvent();
|
||||||
Client.MessageDeleted += MessageDeletedEvent;
|
Client.MessageDeleted += (x, y) => MessageDeletedEvent(x, y);
|
||||||
Client.MessageReceived += MessageReceivedEvent;
|
Client.MessageReceived += x => MessageReceivedEvent(x);
|
||||||
Client.MessageUpdated += MessageUpdatedEvent;
|
Client.MessageUpdated += (x, y, z) => MessageUpdatedEvent(x, y, z);
|
||||||
Client.UserJoined += UserJoinedEvent;
|
Client.UserJoined += x => UserJoinedEvent(x);
|
||||||
Client.GuildScheduledEventCreated += ScheduledEventCreatedEvent;
|
Client.GuildScheduledEventCreated += x => ScheduledEventCreatedEvent(x);
|
||||||
Client.GuildScheduledEventCancelled += ScheduledEventCancelledEvent;
|
Client.GuildScheduledEventCancelled += x => ScheduledEventCancelledEvent(x);
|
||||||
Client.GuildScheduledEventStarted += ScheduledEventStartedEvent;
|
Client.GuildScheduledEventStarted += x => ScheduledEventStartedEvent(x);
|
||||||
Client.GuildScheduledEventCompleted += ScheduledEventCompletedEvent;
|
Client.GuildScheduledEventCompleted += x => ScheduledEventCompletedEvent(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Task ReadyEvent() {
|
private static Task ReadyEvent() {
|
||||||
|
|
Reference in a new issue