From 8a73d6344f7337df713b58c9e50b6792bf3a8c88 Mon Sep 17 00:00:00 2001 From: sylveondeko Date: Sun, 28 Apr 2024 18:40:05 -0400 Subject: [PATCH] reeee --- .../Modules/Administration/LogCommands.cs | 20 +++++++++++++------ .../strings/responses/responses.en-US.json | 1 + 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/Mewdeko/Modules/Administration/LogCommands.cs b/src/Mewdeko/Modules/Administration/LogCommands.cs index 0e531224b..fbecc9960 100644 --- a/src/Mewdeko/Modules/Administration/LogCommands.cs +++ b/src/Mewdeko/Modules/Administration/LogCommands.cs @@ -156,14 +156,22 @@ public async Task Log(LogType type) [Cmd, Aliases, RequireContext(ContextType.Guild), UserPerm(GuildPermission.Administrator), Priority(0)] public async Task Log(LogType type, ITextChannel? channel = null) { - await Service.SetLogChannel(ctx.Guild.Id, channel?.Id ?? 0, type).ConfigureAwait(false); - if (channel is not null) + try { - await ConfirmLocalizedAsync("logging_event_enabled", type, channel.Id).ConfigureAwait(false); - return; + await Service.SetLogChannel(ctx.Guild.Id, channel?.Id ?? 0, type).ConfigureAwait(false); + if (channel is not null) + { + await ConfirmLocalizedAsync("logging_event_enabled", type, channel.Id).ConfigureAwait(false); + return; + } + + await ConfirmLocalizedAsync("logging_event_disabled", type); + } + catch (Exception e) + { + Serilog.Log.Error(e, "There was an issue setting logs"); + await ctx.Channel.SendErrorAsync(GetText("command_fatal_error"), Config); } - - await ConfirmLocalizedAsync("logging_event_disabled", type); } diff --git a/src/Mewdeko/data/strings/responses/responses.en-US.json b/src/Mewdeko/data/strings/responses/responses.en-US.json index 9f92aa40d..cff62a2ba 100644 --- a/src/Mewdeko/data/strings/responses/responses.en-US.json +++ b/src/Mewdeko/data/strings/responses/responses.en-US.json @@ -12,6 +12,7 @@ "ban_by_hash_success": "Banned {0} users by hash {1}", "ban_by_hash_start": "Banning {0} users by hash {1}...", "ban_by_hash_fail_all": "Failed to ban {0} users by hash {1}", + "command_fatal_error": "This command had a fatal error. Please notify the bot owner or check your logs if you are selfhosting. If neccesary join the support server below.", "ban_by_hash_fail_some": "Banned {0} users by hash {1}, but failed to ban {2} users. Most likely due to heirarchy issues.", "ban_by_hash_none": "No users found with hash {0}", "ban_by_hash_confirm": "Are you sure you want to ban {0} users by hash {1}?",