From a8d85178767880cbba7f9ee17dd42e83dd7edd3b Mon Sep 17 00:00:00 2001 From: "Jonny_Bro (Nikita)" Date: Thu, 30 Nov 2023 17:36:02 +0500 Subject: [PATCH] should be good --- commands/Tickets/createticketembed.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/commands/Tickets/createticketembed.js b/commands/Tickets/createticketembed.js index 222b6f1b..2f2416ba 100644 --- a/commands/Tickets/createticketembed.js +++ b/commands/Tickets/createticketembed.js @@ -41,6 +41,12 @@ class CreateTicketEmbed extends BaseCommand { const button = interaction.component; if (button.customId === "support_ticket") { + if (interaction.guild.channels.cache.get(ticketsCategory).children.cache.size >= 50) { + const sorted = interaction.guild.channels.cache.get(ticketsCategory).children.cache.sort((ch1, ch2) => ch1.createdTimestamp - ch2.createdTimestamp); + + await sorted.first().delete(); + } + if (guildData.plugins.tickets.count === undefined) guildData.plugins.tickets.count = 0; guildData.plugins.tickets.count++;