Skip to content

Commit cbf6116

Browse files
/solved: Remove a tag if needed to add Solved tag
1 parent 324b69c commit cbf6116

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

Commands/TechSupportCmds.cs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,17 +142,14 @@ public async Task MarkTechSupportPostSolved(SlashCommandContext ctx)
142142
List<ulong> tags = channel.AppliedTags.Select(x => x.Id).ToList();
143143
if (tags.All(x => x != solvedTagId))
144144
{
145+
if (tags.Count == 5)
146+
tags.RemoveAt(4);
147+
145148
tags.Add(solvedTagId);
146149
try
147150
{
148151
await channel.ModifyAsync(t => t.AppliedTags = tags);
149152
}
150-
catch (BadRequestException bre)
151-
{
152-
errorOccurred = true;
153-
await ctx.RespondAsync($"{Program.cfgjson.Emoji.Error} I couldn't add the Solved tag to this post! Please add it manually. If this post has 5 tags, you may need to remove one first.");
154-
Program.discord.Logger.LogWarning(bre, "A BadRequestException occurred while attempting to mark this post as solved: {threadLink}:", $"https://discord.com/channels/{ctx.Guild.Id}/{ctx.Channel.Id}");
155-
}
156153
catch (Exception ex)
157154
{
158155
errorOccurred = true;

0 commit comments

Comments
 (0)