Skip to content

Commit

Permalink
Check whether insidersChannel is set in config before using it
Browse files Browse the repository at this point in the history
  • Loading branch information
FloatingMilkshake committed Jan 2, 2025
1 parent baf81d9 commit 4d34994
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Commands/InteractionCommands/InsidersInteractions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 4d34994

Please sign in to comment.