more reliable way to find a ticket creator

This commit is contained in:
Jonny_Bro (Nikita) 2023-08-18 22:01:38 +05:00
parent c16ab0d6a5
commit 92d5ad0e71
2 changed files with 3 additions and 2 deletions

View file

@ -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`);
}

View file

@ -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`);
}