1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-01-31 09:09:00 +03:00

Optimize event handlers until we update to .NET 7

This commit is contained in:
Octol1ttle 2022-11-16 23:28:05 +05:00
parent 29c2332ad9
commit 917e7e5775
Signed by: Octol1ttle
GPG key ID: B77C34313AEE1FFF

View file

@ -1,4 +1,5 @@
using Discord;
using System.Diagnostics.CodeAnalysis;
using Discord;
using Discord.Rest;
using Discord.WebSocket;
@ -8,16 +9,17 @@ public static class EventHandler {
private static readonly DiscordSocketClient Client = Boyfriend.Client;
private static bool _sendReadyMessages = true;
[SuppressMessage("ReSharper", "ConvertClosureToMethodGroup")]
public static void InitEvents() {
Client.Ready += ReadyEvent;
Client.MessageDeleted += MessageDeletedEvent;
Client.MessageReceived += MessageReceivedEvent;
Client.MessageUpdated += MessageUpdatedEvent;
Client.UserJoined += UserJoinedEvent;
Client.GuildScheduledEventCreated += ScheduledEventCreatedEvent;
Client.GuildScheduledEventCancelled += ScheduledEventCancelledEvent;
Client.GuildScheduledEventStarted += ScheduledEventStartedEvent;
Client.GuildScheduledEventCompleted += ScheduledEventCompletedEvent;
Client.Ready += () => ReadyEvent();
Client.MessageDeleted += (x, y) => MessageDeletedEvent(x, y);
Client.MessageReceived += x => MessageReceivedEvent(x);
Client.MessageUpdated += (x, y, z) => MessageUpdatedEvent(x, y, z);
Client.UserJoined += x => UserJoinedEvent(x);
Client.GuildScheduledEventCreated += x => ScheduledEventCreatedEvent(x);
Client.GuildScheduledEventCancelled += x => ScheduledEventCancelledEvent(x);
Client.GuildScheduledEventStarted += x => ScheduledEventStartedEvent(x);
Client.GuildScheduledEventCompleted += x => ScheduledEventCompletedEvent(x);
}
private static Task ReadyEvent() {