var discord = require("discord.js") module.exports = { config: { name: "new", aliases: [] }, run: async(reaction, user) => { try { reaction.message.guild.channels.create(`Sollicitatie ` + `${user.username}`, { type: 'text' }).then( (chan) => { const chw = chan; const complete = new discord.MessageEmbed() .setTitle("..") .setColor("#3286ed") .setDescription("Je sollicitatie ticket is succesvol aangemaakt!") .addField("Ticket", `<#${chan.id}>`) .setThumbnail(`${user.displayAvatarURL()}`) .setTimestamp() .setFooter('', ''); user.send(complete) chan.setParent("800674875743928380").then( (chan2) => { chan2.overwritePermissions([{ id: reaction.message.guild.id, deny: ['VIEW_CHANNEL', "SEND_MESSAGES"], }, { id: user.id, allow: ['VIEW_CHANNEL', "SEND_MESSAGES"], }, { id: "769487453739810817", allow: ['VIEW_CHANNEL', "SEND_MESSAGES"], }, ]); let embed = new discord.MessageEmbed() .setTitle("Myt") .setColor("#3286ed") .setDescription("Hallo, " + `${user}` + "!\n\n") .setTimestamp() .setThumbnail(`${user.displayAvatarURL()}`) chan2.send(embed) }) }) } catch (error) { return reaction.message.channel.send("error:" + error) } } }