Small refactoring
This commit is contained in:
parent
729e84fdce
commit
b02aacadd6
1 changed files with 76 additions and 71 deletions
147
SupportChild.cs
147
SupportChild.cs
|
@ -150,77 +150,82 @@ internal static class SupportChild
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.Log("Setting up Discord client...");
|
Logger.Log("Setting up Discord client...");
|
||||||
DiscordClientBuilder clientBuilder = DiscordClientBuilder.CreateDefault(Config.token, DiscordIntents.All)
|
DiscordClientBuilder clientBuilder = DiscordClientBuilder.CreateDefault(Config.token, DiscordIntents.All).SetReconnectOnFatalGatewayErrors();
|
||||||
.SetReconnectOnFatalGatewayErrors()
|
|
||||||
.ConfigureServices(configure =>
|
clientBuilder.ConfigureServices(configure =>
|
||||||
{
|
{
|
||||||
configure.AddSingleton<IClientErrorHandler>(new ErrorHandler());
|
configure.AddSingleton<IClientErrorHandler>(new ErrorHandler());
|
||||||
})
|
});
|
||||||
.ConfigureEventHandlers(builder =>
|
|
||||||
{
|
clientBuilder.ConfigureEventHandlers(builder =>
|
||||||
builder.HandleGuildDownloadCompleted(EventHandler.OnReady);
|
{
|
||||||
builder.HandleGuildAvailable(EventHandler.OnGuildAvailable);
|
builder.HandleGuildDownloadCompleted(EventHandler.OnReady);
|
||||||
builder.HandleMessageCreated(EventHandler.OnMessageCreated);
|
builder.HandleGuildAvailable(EventHandler.OnGuildAvailable);
|
||||||
builder.HandleGuildMemberAdded(EventHandler.OnMemberAdded);
|
builder.HandleMessageCreated(EventHandler.OnMessageCreated);
|
||||||
builder.HandleGuildMemberRemoved(EventHandler.OnMemberRemoved);
|
builder.HandleGuildMemberAdded(EventHandler.OnMemberAdded);
|
||||||
builder.HandleComponentInteractionCreated(EventHandler.OnComponentInteractionCreated);
|
builder.HandleGuildMemberRemoved(EventHandler.OnMemberRemoved);
|
||||||
})
|
builder.HandleComponentInteractionCreated(EventHandler.OnComponentInteractionCreated);
|
||||||
.UseInteractivity(new InteractivityConfiguration
|
});
|
||||||
{
|
|
||||||
PaginationBehaviour = PaginationBehaviour.Ignore,
|
clientBuilder.UseInteractivity(new InteractivityConfiguration
|
||||||
PaginationDeletion = PaginationDeletion.DeleteMessage,
|
{
|
||||||
Timeout = TimeSpan.FromMinutes(15)
|
PaginationBehaviour = PaginationBehaviour.Ignore,
|
||||||
})
|
PaginationDeletion = PaginationDeletion.DeleteMessage,
|
||||||
.UseCommands((_, extension) =>
|
Timeout = TimeSpan.FromMinutes(15)
|
||||||
{
|
});
|
||||||
extension.AddCommands(
|
|
||||||
[
|
clientBuilder.UseCommands((_, extension) =>
|
||||||
typeof(AddCategoryCommand),
|
{
|
||||||
typeof(AddCommand),
|
extension.AddCommands(
|
||||||
typeof(AddMessageCommand),
|
[
|
||||||
typeof(AddStaffCommand),
|
typeof(AddCategoryCommand),
|
||||||
typeof(AdminCommands),
|
typeof(AddCommand),
|
||||||
typeof(AssignCommand),
|
typeof(AddMessageCommand),
|
||||||
typeof(BlacklistCommand),
|
typeof(AddStaffCommand),
|
||||||
typeof(CloseCommand),
|
typeof(AdminCommands),
|
||||||
typeof(CreateButtonPanelCommand),
|
typeof(AssignCommand),
|
||||||
typeof(CreateSelectionBoxPanelCommand),
|
typeof(BlacklistCommand),
|
||||||
typeof(ListAssignedCommand),
|
typeof(CloseCommand),
|
||||||
typeof(ListCommand),
|
typeof(CreateButtonPanelCommand),
|
||||||
typeof(ListOpen),
|
typeof(CreateSelectionBoxPanelCommand),
|
||||||
typeof(ListUnassignedCommand),
|
typeof(ListAssignedCommand),
|
||||||
typeof(MoveCommand),
|
typeof(ListCommand),
|
||||||
typeof(NewCommand),
|
typeof(ListOpen),
|
||||||
typeof(RandomAssignCommand),
|
typeof(ListUnassignedCommand),
|
||||||
typeof(RemoveCategoryCommand),
|
typeof(MoveCommand),
|
||||||
typeof(RemoveMessageCommand),
|
typeof(NewCommand),
|
||||||
typeof(RemoveStaffCommand),
|
typeof(RandomAssignCommand),
|
||||||
typeof(RestartInterviewCommand),
|
typeof(RemoveCategoryCommand),
|
||||||
typeof(SayCommand),
|
typeof(RemoveMessageCommand),
|
||||||
typeof(SetSummaryCommand),
|
typeof(RemoveStaffCommand),
|
||||||
typeof(StatusCommand),
|
typeof(RestartInterviewCommand),
|
||||||
typeof(SummaryCommand),
|
typeof(SayCommand),
|
||||||
typeof(ToggleActiveCommand),
|
typeof(SetSummaryCommand),
|
||||||
typeof(TranscriptCommand),
|
typeof(StatusCommand),
|
||||||
typeof(UnassignCommand),
|
typeof(SummaryCommand),
|
||||||
typeof(UnblacklistCommand)
|
typeof(ToggleActiveCommand),
|
||||||
]);
|
typeof(TranscriptCommand),
|
||||||
extension.AddProcessor(new SlashCommandProcessor());
|
typeof(UnassignCommand),
|
||||||
extension.CommandErrored += EventHandler.OnCommandError;
|
typeof(UnblacklistCommand),
|
||||||
}, new CommandsConfiguration()
|
]);
|
||||||
{
|
extension.AddProcessor(new SlashCommandProcessor());
|
||||||
RegisterDefaultCommandProcessors = false,
|
extension.CommandErrored += EventHandler.OnCommandError;
|
||||||
UseDefaultCommandErrorHandler = false
|
}, new CommandsConfiguration()
|
||||||
})
|
{
|
||||||
.ConfigureExtraFeatures(clientConfig =>
|
RegisterDefaultCommandProcessors = false,
|
||||||
{
|
UseDefaultCommandErrorHandler = false
|
||||||
clientConfig.LogUnknownEvents = false;
|
});
|
||||||
clientConfig.LogUnknownAuditlogs = false;
|
|
||||||
})
|
clientBuilder.ConfigureExtraFeatures(clientConfig =>
|
||||||
.ConfigureLogging(config =>
|
{
|
||||||
{
|
clientConfig.LogUnknownEvents = false;
|
||||||
config.AddProvider(new LogTestFactory());
|
clientConfig.LogUnknownAuditlogs = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
clientBuilder.ConfigureLogging(config =>
|
||||||
|
{
|
||||||
|
config.AddProvider(new LogTestFactory());
|
||||||
|
});
|
||||||
|
|
||||||
client = clientBuilder.Build();
|
client = clientBuilder.Build();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue