client.on('messageCreate', async (message) => { if (message.author.bot) return; if (message.content !== 'ping') return; const firstButton = new ButtonBuilder() .setLabel('Support Ticket') .setStyle(ButtonStyle.Primary) .setCustomId('first-button'); const secondButton = new ButtonBuilder() .setLabel('Player Report Ticket') .setStyle(ButtonStyle.Danger) .setCustomId('second-button'); const thirdButton = new ButtonBuilder() .setLabel('Staff Report Ticket') .setStyle(ButtonStyle.Danger) .setCustomId('third-button'); const fourthButton = new ButtonBuilder() .setLabel('Dev Ticket') .setStyle(ButtonStyle.Success) .setCustomId('fourth-button'); const fithButton = new ButtonBuilder() .setLabel('Ban Appeal Ticket') .setStyle(ButtonStyle.Danger) .setCustomId('fith-button'); const buttonRow = new ActionRowBuilder().addComponents(firstButton, secondButton, thirdButton, fourthButton, fithButton); const embed = new EmbedBuilder() .setColor(0x0099FF) .setTitle('Ticket Selection') .setAuthor({ name: 'Made By Crocodile', iconURL: 'https://cdn.discordapp.com/avatars/1186412772112740563/f8e163290447e73fd426a0ef1641039d.webp?size=1024&width=0&height=256' }) .setDescription('Welcome to the Ticket System for our server.\n\nPlease select the ticket below to contact the correct members within our departments.\n\nHere is a quick run down of our tickets.\n\n**Support Tickets**\nSupport tickets are if your having a problem ingame and need help with it.\n\n**Player Report Ticket**\nThis is where you want to report a player when there not online. If there online use /report. **Must have proof of them doing this if your making this ticket**\n\n**Staff Report Tickets** \nBasically the same thing as a Player Report Ticket but with staff and we will make sure that the Staff Player being reported is not in the ticket.\n\n**Dev Ticket** \nThe Dev Ticket is a developer ticket for needing a car that you bought / won or got it somehow. It can also be other things though.\n\n**Ban Appeal Ticket** \nThe Ban Appeal Ticket will be only used for users who are banned. You should explain why you are banned in there.') .setThumbnail('https://cdn.discordapp.com/avatars/1186412772112740563/f8e163290447e73fd426a0ef1641039d.webp?size=1024&width=0&height=256') .setTimestamp() .setFooter({ text: 'Ticket Buttons V1', iconURL: 'https://cdn.discordapp.com/avatars/1186412772112740563/f8e163290447e73fd426a0ef1641039d.webp?size=1024&width=0&height=256' }); await message.channel.send({ content: ' ', embeds: [embed], components: [buttonRow] }); client.on(Events.InteractionCreate, async (interaction) => { if (interaction.customId === 'second-button') { const member = interaction.guild.members.cache.get(interaction.user.id); const parent_ID = '1176621648225513622'; // Replace with your category ID const guild = message.guild; const everyone_ID = guild.roles.everyone.id; try { const username = member.user.username; // Replace spaces with dashes and make it lowercase const channelName = `${username.toLowerCase()}-ticket`; const newChannel = await interaction.guild.channels.create( { type: 0, parent: parent_ID, name: channelName, permissionOverwrites: [ { id: member.id, allow: [PermissionsBitField.Flags.ViewChannel, PermissionsBitField.Flags.SendMessages, PermissionsBitField.Flags.ReadMessageHistory], }, { id: everyone_ID, deny: [PermissionsBitField.Flags.ViewChannel, PermissionsBitField.Flags.SendMessages, PermissionsBitField.Flags.ReadMessageHistory], }, ], }) // Send a welcome message to the new channel const welcomeEmbed = new EmbedBuilder() .setColor(0x0099FF) .setTitle('Role Selection') .setDescription('Welcome to your Player Report ticket ticket. Please give us everything we would need to help you. We will get back to you as soon as we can and try and resolve this.') .setTimestamp() .setFooter({ text: 'Ticket Buttons V1', iconURL: 'https://cdn.discordapp.com/avatars/1186412772112740563/f8e163290447e73fd426a0ef1641039d.webp?size=1024&width=0&height=256' }); await newChannel.send({ embeds: [welcomeEmbed] }); interaction.reply({ content: `Ticket channel created! Check out your new ticket channel: <#${newChannel.id}>`, ephemeral: true }); } catch (error) { console.error(error); interaction.reply({ content: 'Failed to create ticket channel.', ephemeral: true }); } }}) client.on(Events.InteractionCreate, async (interaction) => { if (interaction.customId === 'first-button') { const member = interaction.guild.members.cache.get(interaction.user.id); const parent_ID = '1176620800493752332'; // Replace with your category ID const guild = message.guild; const everyone_ID = guild.roles.everyone.id; try { const username = member.user.username; // Replace spaces with dashes and make it lowercase const channelName = `${username.toLowerCase()}-ticket`; const newChannel = await interaction.guild.channels.create( { type: 0, parent: parent_ID, name: channelName, permissionOverwrites: [ { id: member.id, allow: [PermissionsBitField.Flags.ViewChannel, PermissionsBitField.Flags.SendMessages, PermissionsBitField.Flags.ReadMessageHistory], }, { id: everyone_ID, deny: [PermissionsBitField.Flags.ViewChannel, PermissionsBitField.Flags.SendMessages, PermissionsBitField.Flags.ReadMessageHistory], }, ], }) // Send a welcome message to the new channel const welcomeEmbed = new EmbedBuilder() .setColor(0x0099FF) .setTitle('Support Ticket') .setDescription('Welcome to your Support ticket. Please give us everything we would need to help you. We will get back to you as soon as we can and help you with whatever you need.') .setTimestamp() .setFooter({ text: 'Ticket Buttons V1', iconURL: 'https://cdn.discordapp.com/avatars/1186412772112740563/f8e163290447e73fd426a0ef1641039d.webp?size=1024&width=0&height=256' }); await newChannel.send({ embeds: [welcomeEmbed] }); interaction.reply({ content: `Ticket channel created! Check out your new ticket channel: <#${newChannel.id}>`, ephemeral: true }); } catch (error) { console.error(error); interaction.reply({ content: 'Failed to create ticket channel.', ephemeral: true }); } }}) client.on(Events.InteractionCreate, async (interaction) => { if (interaction.customId === 'third-button') { const member = interaction.guild.members.cache.get(interaction.user.id); const parent_ID = '1176621492541341737'; // Replace with your category ID const guild = message.guild; const everyone_ID = guild.roles.everyone.id; try { const username = member.user.username; // Replace spaces with dashes and make it lowercase const channelName = `${username.toLowerCase()}-ticket`; const newChannel = await interaction.guild.channels.create( { type: 0, parent: parent_ID, name: channelName, permissionOverwrites: [ { id: member.id, allow: [PermissionsBitField.Flags.ViewChannel, PermissionsBitField.Flags.SendMessages, PermissionsBitField.Flags.ReadMessageHistory], }, { id: everyone_ID, deny: [PermissionsBitField.Flags.ViewChannel, PermissionsBitField.Flags.SendMessages, PermissionsBitField.Flags.ReadMessageHistory], }, ], }) // Send a welcome message to the new channel const welcomeEmbed = new EmbedBuilder() .setColor(0x0099FF) .setTitle('Staff Report Ticket') .setDescription('Welcome to your Staff Report ticket. Please give us everything we would need to help you. We will get back to you as soon as we can and help you with whatever you need.') .setTimestamp() .setFooter({ text: 'Ticket Buttons V1', iconURL: 'https://cdn.discordapp.com/avatars/1186412772112740563/f8e163290447e73fd426a0ef1641039d.webp?size=1024&width=0&height=256' }); await newChannel.send({ embeds: [welcomeEmbed] }); interaction.reply({ content: `Ticket channel created! Check out your new ticket channel: <#${newChannel.id}>`, ephemeral: true }); } catch (error) { console.error(error); interaction.reply({ content: 'Failed to create ticket channel.', ephemeral: true }); } }}) client.on(Events.InteractionCreate, async (interaction) => { if (interaction.customId === 'fourth-button') { const member = interaction.guild.members.cache.get(interaction.user.id); const parent_ID = '1187125286584713286'; // Replace with your category ID const guild = message.guild; const everyone_ID = guild.roles.everyone.id; try { const username = member.user.username; // Replace spaces with dashes and make it lowercase const channelName = `${username.toLowerCase()}-ticket`; const newChannel = await interaction.guild.channels.create( { type: 0, parent: parent_ID, name: channelName, permissionOverwrites: [ { id: member.id, allow: [PermissionsBitField.Flags.ViewChannel, PermissionsBitField.Flags.SendMessages, PermissionsBitField.Flags.ReadMessageHistory], }, { id: everyone_ID, deny: [PermissionsBitField.Flags.ViewChannel, PermissionsBitField.Flags.SendMessages, PermissionsBitField.Flags.ReadMessageHistory], }, ], }) // Send a welcome message to the new channel const welcomeEmbed = new EmbedBuilder() .setColor(0x0099FF) .setTitle('Dev Ticket') .setDescription('Welcome to your Developer ticket. Please give us everything we would need to help you. We will get back to you as soon as we can and help you with whatever you need.') .setTimestamp() .setFooter({ text: 'Ticket Buttons V1', iconURL: 'https://cdn.discordapp.com/avatars/1186412772112740563/f8e163290447e73fd426a0ef1641039d.webp?size=1024&width=0&height=256' }); await newChannel.send({ embeds: [welcomeEmbed] }); interaction.reply({ content: `Ticket channel created! Check out your new ticket channel: <#${newChannel.id}>`, ephemeral: true }); } catch (error) { console.error(error); interaction.reply({ content: 'Failed to create ticket channel.', ephemeral: true }); } }}) client.on(Events.InteractionCreate, async (interaction) => { if (interaction.customId === 'fith-button') { const member = interaction.guild.members.cache.get(interaction.user.id); const parent_ID = '1176621818610712647'; const guild = message.guild; const everyone_ID = guild.roles.everyone.id; try { const username = member.user.username; const channelName = `${username.toLowerCase()}-ticket`; const newChannel = await interaction.guild.channels.create( { type: 0, parent: parent_ID, name: channelName, permissionOverwrites: [ { id: member.id, allow: [PermissionsBitField.Flags.ViewChannel, PermissionsBitField.Flags.SendMessages, PermissionsBitField.Flags.ReadMessageHistory], }, { id: everyone_ID, deny: [PermissionsBitField.Flags.ViewChannel, PermissionsBitField.Flags.SendMessages, PermissionsBitField.Flags.ReadMessageHistory], }, ], }) const welcomeEmbed = new EmbedBuilder() .setColor(0x0099FF) .setTitle('Ban Appeal Ticket') .setDescription('Welcome to your Ban Appeal ticket. Please give us the following information.\n\nWhy were you banned?\nHow long is your ban?\n What staff member banend you?\nWhy should we appeal your ban?') .setTimestamp() .setFooter({ text: 'Ticket Buttons V1', iconURL: 'https://cdn.discordapp.com/avatars/1186412772112740563/f8e163290447e73fd426a0ef1641039d.webp?size=1024&width=0&height=256' }); await newChannel.send({ embeds: [welcomeEmbed] }); interaction.reply({ content: `Ticket channel created! Check out your new ticket channel: <#${newChannel.id}>`, ephemeral: true }); } catch (error) { console.error(error); interaction.reply({ content: 'Failed to create ticket channel.', ephemeral: true }); }}})});