Skip to content

Commit 4d34994

Browse files
Check whether insidersChannel is set in config before using it
1 parent baf81d9 commit 4d34994

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

Commands/InteractionCommands/InsidersInteractions.cs

+12-1
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,19 @@ public static async Task SendInsidersInfoButtonMessage(InteractionContext ctx)
1818
new DiscordButtonComponent(DiscordButtonStyle.Secondary, "insiders-info-chat-btn-callback", "I just want to chat for now")
1919
];
2020

21+
string insidersChannelMention;
22+
if (Program.cfgjson.InsidersChannel == 0)
23+
{
24+
insidersChannelMention = "#insiders";
25+
Program.discord.Logger.LogWarning("#insiders-info message sent with hardcoded #insiders mention! Is insidersChannel set in config.json?");
26+
}
27+
else
28+
{
29+
insidersChannelMention = $"<#{Program.cfgjson.InsidersChannel}>";
30+
}
31+
2132
var builder = new DiscordInteractionResponseBuilder()
22-
.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.")
33+
.WithContent($"{Program.cfgjson.Emoji.Insider} Choose your Insider roles here! Or, you can choose to chat in {insidersChannelMention} without being notified about new builds.")
2334
.AddComponents(buttons);
2435

2536
await ctx.CreateResponseAsync(builder);

0 commit comments

Comments
 (0)