From 92d5ad0e712812d28f3c7b32c306662650682c28 Mon Sep 17 00:00:00 2001 From: "Jonny_Bro (Nikita)" Date: Fri, 18 Aug 2023 22:01:38 +0500 Subject: [PATCH] more reliable way to find a ticket creator --- commands/Tickets/closeticket.js | 2 +- commands/Tickets/createticketembed.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/commands/Tickets/closeticket.js b/commands/Tickets/closeticket.js index b815628f..8d24508b 100644 --- a/commands/Tickets/closeticket.js +++ b/commands/Tickets/closeticket.js @@ -112,7 +112,7 @@ class CloseTicket extends BaseCommand { await interaction.reply({ content: interaction.translate("misc:CANT_DM"), ephemeral: true }); } - const member = interaction.guild.members.cache.find(u => u.user.username.includes(interaction.channel.name.split("-")[0])); + const member = interaction.guild.members.cache.find(u => u.user.id === interaction.channel.topic); await interaction.channel.permissionOverwrites.edit(member, { ViewChannel: false, SendMessages: null }); await interaction.channel.setName(`${interaction.channel.name}-closed`); } diff --git a/commands/Tickets/createticketembed.js b/commands/Tickets/createticketembed.js index feed0471..8a64173e 100644 --- a/commands/Tickets/createticketembed.js +++ b/commands/Tickets/createticketembed.js @@ -49,6 +49,7 @@ class CreateTicketEmbed extends BaseCommand { const channel = await interaction.guild.channels.create({ name: `${interaction.user.username}-support-${guildData.plugins.tickets.count}`, + topic: interaction.user.id, type: ChannelType.GuildText, parent: ticketsCategory, permissionOverwrites: [ @@ -167,7 +168,7 @@ class CreateTicketEmbed extends BaseCommand { await interaction.reply({ content: interaction.translate("misc:CANT_DM"), ephemeral: true }); } - const member = interaction.guild.members.cache.find(u => u.user.username.includes(interaction.channel.name.split("-")[0])); + const member = interaction.guild.members.cache.find(u => u.user.id === interaction.channel.topic); await interaction.channel.permissionOverwrites.edit(member, { ViewChannel: false, SendMessages: null }); await interaction.channel.setName(`${interaction.channel.name}-closed`); }