Updated a file

This commit is contained in:
EmotionChild 2022-04-18 22:59:52 +12:00
parent 8408ddce01
commit 94324f4d4a
No known key found for this signature in database
GPG key ID: 23DC06AC32786520

View file

@ -29,7 +29,7 @@ namespace SupportChild
Console.WriteLine("Starting SupportChild version " + GetVersion() + "...");
try
{
Reload();
this.Reload();
// Block this task until the program is closed.
await Task.Delay(-1);
@ -55,10 +55,10 @@ namespace SupportChild
public async void Reload()
{
if (discordClient != null)
if (this.discordClient != null)
{
await discordClient.DisconnectAsync();
discordClient.Dispose();
await this.discordClient.DisconnectAsync();
this.discordClient.Dispose();
Console.WriteLine("Discord client disconnected.");
}
@ -104,20 +104,20 @@ namespace SupportChild
Intents = DiscordIntents.All
};
discordClient = new DiscordClient(cfg);
this.discordClient = new DiscordClient(cfg);
eventHandler = new EventHandler(discordClient);
this.eventHandler = new EventHandler(this.discordClient);
Console.WriteLine("Hooking events...");
discordClient.Ready += eventHandler.OnReady;
discordClient.GuildAvailable += eventHandler.OnGuildAvailable;
discordClient.ClientErrored += eventHandler.OnClientError;
discordClient.MessageCreated += eventHandler.OnMessageCreated;
discordClient.GuildMemberAdded += eventHandler.OnMemberAdded;
discordClient.GuildMemberRemoved += eventHandler.OnMemberRemoved;
this.discordClient.Ready += this.eventHandler.OnReady;
this.discordClient.GuildAvailable += this.eventHandler.OnGuildAvailable;
this.discordClient.ClientErrored += this.eventHandler.OnClientError;
this.discordClient.MessageCreated += this.eventHandler.OnMessageCreated;
this.discordClient.GuildMemberAdded += this.eventHandler.OnMemberAdded;
this.discordClient.GuildMemberRemoved += this.eventHandler.OnMemberRemoved;
if (Config.reactionMessage != 0)
{
discordClient.MessageReactionAdded += eventHandler.OnReactionAdded;
this.discordClient.MessageReactionAdded += this.eventHandler.OnReactionAdded;
}
Console.WriteLine("Registering commands...");
@ -154,10 +154,10 @@ namespace SupportChild
this.commands.RegisterCommands<UnsetTicketCommand>();
Console.WriteLine("Hooking command events...");
this.commands.CommandErrored += eventHandler.OnCommandError;
this.commands.CommandErrored += this.eventHandler.OnCommandError;
Console.WriteLine("Connecting to Discord...");
await discordClient.ConnectAsync();
await this.discordClient.ConnectAsync();
}
}
}