Improved error detection when moving a ticket to a different category

This commit is contained in:
Toastie 2024-12-27 01:29:32 +13:00
parent 3feaf50b59
commit f0e48cc2ab
Signed by: toastie_t0ast
GPG key ID: 27F3B6855AFD40A4

View file

@ -64,6 +64,17 @@ public class MoveCommand
return;
}
if (categoryChannel.Children.Count == 50)
{
Logger.Warn("Could not move ticket " + ticket.id.ToString("00000") + " to the category '" + categoryChannel.Name + "', likely because it is full.");
await command.RespondAsync(new DiscordEmbedBuilder
{
Color = DiscordColor.Red,
Description = "Error: Unable to move ticket to that category, is it full?"
}, true);
return;
}
try
{
await command.Channel.ModifyAsync(modifiedAttributes => modifiedAttributes.Parent = categoryChannel);
@ -77,6 +88,16 @@ public class MoveCommand
}, true);
return;
}
catch (BadRequestException)
{
Logger.Warn("Could not move ticket " + ticket.id.ToString("00000") + " to the category '" + categoryChannel.Name + "', likely because it is full.");
await command.RespondAsync(new DiscordEmbedBuilder
{
Color = DiscordColor.Red,
Description = "Error: Unable to move ticket to that category, is it full?"
}, true);
return;
}
await command.RespondAsync(new DiscordEmbedBuilder
{