Untitled

 avatar
unknown
plain_text
2 years ago
2.7 kB
4
Indexable
const { MessageEmbed, MessageButton, MessageActionRow } = require('discord.js');

// Ticket Generale
module.exports = {
    name: "interactionCreate",
    execute(interaction) {
        if (interaction.customId == "Tickethypercreative") {
            if (interaction.guild.channels.cache.find(canale => canale.topic == `HUser ID: ${interaction.user.id}`)) {
                interaction.reply({ content: `<@${interaction.user.id}>, Hai già un ticket aperto!`, ephemeral: true })
                return
            }

            interaction.guild.channels.create(`ticket-${interaction.user.username}`, {
                type: "text",
                topic: `HUser ID: ${interaction.user.id}`,
                parent: "1064119389013684285", //Settare la categoria
                permissionOverwrites: [
                    {
                        id: interaction.guild.id,
                        deny: ["VIEW_CHANNEL", "SEND_MESSAGES"]
                    },
                    {
                        id: interaction.user.id,
                        allow: ["VIEW_CHANNEL", "SEND_MESSAGES", "READ_MESSAGE_HISTORY"]
                    },
                    {
                        id: "979423088787730452", // 💻│PC SERVICE
                        allow: ["VIEW_CHANNEL", "SEND_MESSAGES", "ADD_REACTIONS", "READ_MESSAGE_HISTORY"]
                    },
                    {
                        id: "1065297167574646804", // 🎮 │Officina del PAD
                        allow: ["VIEW_CHANNEL", "SEND_MESSAGES", "ADD_REACTIONS", "READ_MESSAGE_HISTORY"]
                    }
                ]
            }).then(canale => {

                const embed1 = new MessageEmbed()
                    .setColor('BLUE')
                    .setTitle(`> Ticket Hyper Creative`)
                    .setDescription(`> Benvenuto nel tuo ticket <@${interaction.user.id}>\n> Descrivici gentilmente per quale servizio ci hai contattato!`)
                    .setFooter({ text: 'MAZE - Hyper Creative', iconURL: 'https://cdn.discordapp.com/attachments/1061877160941461565/1062442140296286238/icona.png' });

                let button1 = new MessageButton()
                    .setLabel("CHIUDI")
                    .setCustomId("close")
                    .setStyle("DANGER")

                let row = new MessageActionRow()
                    .addComponents(button1)

                canale.send("<@&979423088787730452>");
                canale.send({ embeds: [embed1], components: [row] })

                interaction.reply({ content: `<@${interaction.user.id}> Hai aperto un ticket con successo! <#${canale.id}>`, ephemeral: true })
            })
        }
    }
}
Editor is loading...