From 41620b0470af98e9c6a9260b1c7fe7d10e289a6a Mon Sep 17 00:00:00 2001 From: FloatingMilkshake Date: Thu, 2 Jan 2025 14:14:55 -0500 Subject: [PATCH] config: Make insiderCommandLockedToChannel an alias of insidersChannel Also changes usages to InsidersChannel; config.json accepts both, but only InsidersChannel can be used in code --- Commands/InteractionCommands/AnnouncementInteractions.cs | 4 ++-- Structs.cs | 9 +++++++-- config.json | 1 - 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Commands/InteractionCommands/AnnouncementInteractions.cs b/Commands/InteractionCommands/AnnouncementInteractions.cs index 7c97a73c..4d77b21f 100644 --- a/Commands/InteractionCommands/AnnouncementInteractions.cs +++ b/Commands/InteractionCommands/AnnouncementInteractions.cs @@ -34,9 +34,9 @@ public async Task AnnounceBuildSlashCommand(InteractionContext ctx, [Option("lockdown", "Set 0 to not lock. Lock the channel for a certain period of time after announcing the build.")] string lockdownTime = "auto" ) { - if (Program.cfgjson.InsiderCommandLockedToChannel != 0 && ctx.Channel.Id != Program.cfgjson.InsiderCommandLockedToChannel) + if (Program.cfgjson.InsidersChannel != 0 && ctx.Channel.Id != Program.cfgjson.InsidersChannel) { - await ctx.RespondAsync($"{Program.cfgjson.Emoji.Error} This command only works in <#{Program.cfgjson.InsiderCommandLockedToChannel}>!", ephemeral: true); + await ctx.RespondAsync($"{Program.cfgjson.Emoji.Error} This command only works in <#{Program.cfgjson.InsidersChannel}>!", ephemeral: true); return; } diff --git a/Structs.cs b/Structs.cs index 16989aed..a32c7993 100644 --- a/Structs.cs +++ b/Structs.cs @@ -269,11 +269,16 @@ public class ConfigJson [JsonProperty("insiderAnnouncementChannel")] public ulong InsiderAnnouncementChannel { get; private set; } = 0; + private ulong insidersChannel; [JsonProperty("insidersChannel")] - public ulong InsidersChannel { get; private set; } + public ulong InsidersChannel + { + get => insidersChannel == 0 ? InsiderCommandLockedToChannel : insidersChannel; + private set => insidersChannel = value; + } [JsonProperty("insiderCommandLockedToChannel")] - public ulong InsiderCommandLockedToChannel { get; private set; } = 0; + private ulong InsiderCommandLockedToChannel { get; set; } = 0; [JsonProperty("dmAutoresponseTimeLimit")] public int DmAutoresponseTimeLimit { get; private set; } = 0; diff --git a/config.json b/config.json index 65068981..660dd1a9 100644 --- a/config.json +++ b/config.json @@ -318,7 +318,6 @@ "insiderAnnouncementChannel": 1043898319883219004, "insiderInfoChannel": 1279201622651572317, "insidersChannel": 187649467611086849, - "insiderCommandLockedToChannel": 187649467611086849, "dmAutoresponseTimeLimit": 6, "autoDeleteEmptyThreads": true, "insiderCanaryThread": 1082394217168523315,