From 4d349942bb8862f0faef533dc71c50924dce456f Mon Sep 17 00:00:00 2001 From: FloatingMilkshake Date: Thu, 2 Jan 2025 12:35:39 -0500 Subject: [PATCH] Check whether insidersChannel is set in config before using it --- .../InteractionCommands/InsidersInteractions.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Commands/InteractionCommands/InsidersInteractions.cs b/Commands/InteractionCommands/InsidersInteractions.cs index 132143e..47d5617 100644 --- a/Commands/InteractionCommands/InsidersInteractions.cs +++ b/Commands/InteractionCommands/InsidersInteractions.cs @@ -18,8 +18,19 @@ public static async Task SendInsidersInfoButtonMessage(InteractionContext ctx) new DiscordButtonComponent(DiscordButtonStyle.Secondary, "insiders-info-chat-btn-callback", "I just want to chat for now") ]; + string insidersChannelMention; + if (Program.cfgjson.InsidersChannel == 0) + { + insidersChannelMention = "#insiders"; + Program.discord.Logger.LogWarning("#insiders-info message sent with hardcoded #insiders mention! Is insidersChannel set in config.json?"); + } + else + { + insidersChannelMention = $"<#{Program.cfgjson.InsidersChannel}>"; + } + var builder = new DiscordInteractionResponseBuilder() - .WithContent($"{Program.cfgjson.Emoji.Insider} Choose your Insider roles here! Or, you can choose to chat in <#{Program.cfgjson.InsidersChannel}> without being notified about new builds.") + .WithContent($"{Program.cfgjson.Emoji.Insider} Choose your Insider roles here! Or, you can choose to chat in {insidersChannelMention} without being notified about new builds.") .AddComponents(buttons); await ctx.CreateResponseAsync(builder);