Small refactoring

This commit is contained in:
Toastie 2024-12-26 23:38:59 +13:00
parent 729e84fdce
commit b02aacadd6
Signed by: toastie_t0ast
GPG key ID: 27F3B6855AFD40A4

View file

@ -150,13 +150,14 @@ internal static class SupportChild
}
Logger.Log("Setting up Discord client...");
DiscordClientBuilder clientBuilder = DiscordClientBuilder.CreateDefault(Config.token, DiscordIntents.All)
.SetReconnectOnFatalGatewayErrors()
.ConfigureServices(configure =>
DiscordClientBuilder clientBuilder = DiscordClientBuilder.CreateDefault(Config.token, DiscordIntents.All).SetReconnectOnFatalGatewayErrors();
clientBuilder.ConfigureServices(configure =>
{
configure.AddSingleton<IClientErrorHandler>(new ErrorHandler());
})
.ConfigureEventHandlers(builder =>
});
clientBuilder.ConfigureEventHandlers(builder =>
{
builder.HandleGuildDownloadCompleted(EventHandler.OnReady);
builder.HandleGuildAvailable(EventHandler.OnGuildAvailable);
@ -164,14 +165,16 @@ internal static class SupportChild
builder.HandleGuildMemberAdded(EventHandler.OnMemberAdded);
builder.HandleGuildMemberRemoved(EventHandler.OnMemberRemoved);
builder.HandleComponentInteractionCreated(EventHandler.OnComponentInteractionCreated);
})
.UseInteractivity(new InteractivityConfiguration
});
clientBuilder.UseInteractivity(new InteractivityConfiguration
{
PaginationBehaviour = PaginationBehaviour.Ignore,
PaginationDeletion = PaginationDeletion.DeleteMessage,
Timeout = TimeSpan.FromMinutes(15)
})
.UseCommands((_, extension) =>
});
clientBuilder.UseCommands((_, extension) =>
{
extension.AddCommands(
[
@ -203,7 +206,7 @@ internal static class SupportChild
typeof(ToggleActiveCommand),
typeof(TranscriptCommand),
typeof(UnassignCommand),
typeof(UnblacklistCommand)
typeof(UnblacklistCommand),
]);
extension.AddProcessor(new SlashCommandProcessor());
extension.CommandErrored += EventHandler.OnCommandError;
@ -211,13 +214,15 @@ internal static class SupportChild
{
RegisterDefaultCommandProcessors = false,
UseDefaultCommandErrorHandler = false
})
.ConfigureExtraFeatures(clientConfig =>
});
clientBuilder.ConfigureExtraFeatures(clientConfig =>
{
clientConfig.LogUnknownEvents = false;
clientConfig.LogUnknownAuditlogs = false;
})
.ConfigureLogging(config =>
});
clientBuilder.ConfigureLogging(config =>
{
config.AddProvider(new LogTestFactory());
});