Tengo algunos problemas para otorgar al message.author y al personal permiso para ver el canal justo después de que se crea, el problema es que, cuando se cambia el canal principal (categoría), sincroniza los permisos del canal principal (categoría), que no permite que el usuario y el personal vean el canal, no estoy seguro de cómo solucionar esto, desearía haberlo explicado bien, si tiene alguna pregunta, por favor pregunte.
Aquí está mi código:
module.exports = { name: 'new', category: 'Ticket', description: 'Creates a new ticket.', aliases: ['newticket'], usage: 'New', userperms: [], botperms: [], run: async (client, message, args) => { if(message.author.bot) return; if(!message.channel.id == process.env.COMMAND_T) return; if(!client.userTickets) { client.userTickets = new Map(); const channels = message.guild.channels.cache.filter(channel => { if(channel) return channel.name.startsWith('t-'); }); if(channels) { for (i in Array.from(channels)) { client.userTickets.set(i, +i + 1); } } } console.log(client.userTickets) if(client.userTickets.has(message.author.id)) { return message.channel.send('<@' + message.author.id + 'You already have a ticket, please close it then run this command again!').then(m => m.delete({timeout: 10000})); } message.guild.channels.create(`t-${client.userTickets.size + 1}`, { permissionOverwrites: [ { id: message.author.id, allow: ['SEND_MESSAGES', 'VIEW_CHANNEL'], }, { id: process.env.ROLE_STAFF, allow: ['SEND_MESSAGES', 'VIEW_CHANNEL'], }, { id: process.env.ROLE_MEMBER, deny: ['VIEW_CHANNEL'] } ], type: 'text', }).then(async channel => { channel.setParent(process.env.TICKET_C); client.userTickets.set(message.author.id, client.userTickets.size + 1); message.channel.send(`<@` + message.author.id + `>, Done, go to your ticket! ${channel}`).then(m => m.delete({timeout: 10000})); client.users.cache.get(message.author.id).send(`Your ticket has been opened, go take a look: ${channel}`) channel.send(`Hi <@` + message.author.id + `>, Hello and welcome to your DwaCraft ticket!`); channel.send(`https://tenor.com/view/is-there-something-i-can-help-you-with-dan-levy-david-david-rose-schitts-creek-gif-20776045`); const logchannel = message.guild.channels.cache.find(channel => channel.id === process.env.TICKET_L); if(logchannel) { logchannel.send(`There was a new ticket created by <@${message.author.id}>! Channel: <#${channel.id}>`); } }); } }Nota: He investigado pero no he encontrado ninguna respuesta.
Gracias por tomarse el tiempo para leer esto.
Prueba esto
message.guild.channels.create(`t-${client.userTickets.size + 1}`, { type: 'GUILD_TEXT', permissionOverwrites: [ { id: process.env.ROLE_STAFF, allow: ['VIEW_CHANNEL'], }, { id: message.author.id, allow: ['VIEW_CHANNEL'], }, ], parent: process.env.CATEGORY });Este código es mío, pero está abreviado, si te gusta el completo envíame DM
PD: solo lo tengo para mi sistema de tickets.