diff --git a/Commands/MuteCmds.cs b/Commands/MuteCmds.cs index 4a2bc31..e12517a 100644 --- a/Commands/MuteCmds.cs +++ b/Commands/MuteCmds.cs @@ -223,16 +223,17 @@ public async Task TqsMuteSlashCommand( return; } - // Only allow usage in #tech-support, #tech-support-forum, and their threads + // Only allow usage in #tech-support, #tech-support-forum, and their threads + #bot-commands if (ctx.Channel.Id != Program.cfgjson.TechSupportChannel && ctx.Channel.Id != Program.cfgjson.SupportForumId && ctx.Channel.Parent.Id != Program.cfgjson.TechSupportChannel && - ctx.Channel.Parent.Id != Program.cfgjson.SupportForumId) + ctx.Channel.Parent.Id != Program.cfgjson.SupportForumId && + ctx.Channel.Id != Program.cfgjson.BotCommandsChannel) { if (ctx is SlashCommandContext) await ctx.EditResponseAsync(new DiscordWebhookBuilder().WithContent($"{Program.cfgjson.Emoji.Error} This command can only be used in <#{Program.cfgjson.TechSupportChannel}>, <#{Program.cfgjson.SupportForumId}>, and threads in those channels!")); else - await ctx.RespondAsync($"{Program.cfgjson.Emoji.Error} This command can only be used in <#{Program.cfgjson.TechSupportChannel}>, <#{Program.cfgjson.SupportForumId}>, and threads in those channels!"); + await ctx.RespondAsync($"{Program.cfgjson.Emoji.Error} This command can only be used in <#{Program.cfgjson.TechSupportChannel}>, <#{Program.cfgjson.SupportForumId}>, their threads, and <#{Program.cfgjson.BotCommandsChannel}>!"); return; } @@ -248,7 +249,12 @@ public async Task TqsMuteSlashCommand( } catch (DSharpPlus.Exceptions.NotFoundException) { - // handled below + // couldn't fetch member, fail + if (ctx is SlashCommandContext) + await ctx.EditResponseAsync($"{Program.cfgjson.Emoji.Error} That user doesn't appear to be in the server!"); + else + await ctx.RespondAsync($"{Program.cfgjson.Emoji.Error} That user doesn't appear to be in the server!"); + return; } if (await Program.db.HashExistsAsync("mutes", targetUser.Id) && targetMember is not null && targetMember.Roles.Contains(tqsMutedRole)) @@ -270,14 +276,6 @@ public async Task TqsMuteSlashCommand( else await ctx.RespondAsync($"{Program.cfgjson.Emoji.Success} Successfully unmuted {targetUser.Mention}!"); } - else if (targetMember is null) - { - // couldn't fetch member, fail - if (ctx is SlashCommandContext) - await ctx.EditResponseAsync($"{Program.cfgjson.Emoji.Error} That user doesn't appear to be in the server!"); - else - await ctx.RespondAsync($"{Program.cfgjson.Emoji.Error} That user doesn't appear to be in the server!"); - } else { // member is not TQS-muted, fail diff --git a/Structs.cs b/Structs.cs index b039c03..0b134ce 100644 --- a/Structs.cs +++ b/Structs.cs @@ -336,6 +336,9 @@ public ulong InsidersChannel [JsonProperty("githubWorkflowSucessString")] public string GithubWorkflowSucessString { get; private set; } = ""; + + [JsonProperty("botCommandsChannel")] + public ulong BotCommandsChannel { get; private set; } } public enum Level { Information, Warning, Error, Debug, Verbose } diff --git a/config.json b/config.json index 16f0355..ee06774 100644 --- a/config.json +++ b/config.json @@ -348,5 +348,6 @@ 450181490345508884 ], "pingBotOwnersOnBadErrors": true, - "githubWorkflowSucessString": "[lists:main] 1 new commit" + "githubWorkflowSucessString": "[lists:main] 1 new commit", + "botCommandsChannel": 740272437719072808 }