From 252d15bf1d589708a43e0d99d780b5d53d131fb8 Mon Sep 17 00:00:00 2001 From: Toastie Date: Tue, 8 Oct 2024 14:08:16 +1300 Subject: [PATCH] .greetmsg (and related commands) and .greettest (and other greet test commands) will now show the correct response string when the toggle is disabled --- .../Administration/GreetBye/GreetCommands.cs | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/EllieBot/Modules/Administration/GreetBye/GreetCommands.cs b/src/EllieBot/Modules/Administration/GreetBye/GreetCommands.cs index a0b4d59..fa404db 100644 --- a/src/EllieBot/Modules/Administration/GreetBye/GreetCommands.cs +++ b/src/EllieBot/Modules/Administration/GreetBye/GreetCommands.cs @@ -200,9 +200,7 @@ public partial class Administration if (!isEnabled) { - var cmdName = GetCmdName(type); - - await Response().Pending(strs.boostmsg_enable($"`{prefix}{cmdName}`")).SendAsync(); + await SendGreetEnableHint(type); } } @@ -226,18 +224,24 @@ public partial class Administration await _service.Test(ctx.Guild.Id, type, (ITextChannel)ctx.Channel, user); var conf = await _service.GetGreetSettingsAsync(ctx.Guild.Id, type); + if (conf?.IsEnabled is not true) + await SendGreetEnableHint(type); + } + + private async Task SendGreetEnableHint(GreetType type) + { var cmd = $"`{prefix}{GetCmdName(type)}`"; var str = type switch { - GreetType.Greet => strs.boostmsg_enable(cmd), - GreetType.Bye => strs.greetmsg_enable(cmd), - GreetType.Boost => strs.byemsg_enable(cmd), + GreetType.Greet => strs.greetmsg_enable(cmd), + GreetType.Bye => strs.byemsg_enable(cmd), + GreetType.Boost => strs.boostmsg_enable(cmd), GreetType.GreetDm => strs.greetdmmsg_enable(cmd), _ => strs.error }; - if (conf?.IsEnabled is not true) - await Response().Pending(str).SendAsync(); + + await Response().Pending(str).SendAsync(); } } } \ No newline at end of file