Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const discord = require("discord.js");
- module.exports.run = async (bot, message, args) => {
- const ticketid = "624182873775144961" // ID of ticket category
- let userName = message.author.username;
- let userDiscriminator = message.author.discriminator;
- if (message.guild.channels.exists('name', `ticket-${message.author.id}`)) return message.channel.send(new discord.RichEmbed().setColor("RED").setTitle("Error!").setDescription("You already have a ticket open!"));
- message.guild.createChannel(`ticket-${message.author.id}`, 'text').then(c => {
- let everyone = message.guild.defaultRole;
- let staff = message.guild.roles.find(c => c.name == "Support");
- c.overwritePermissions(everyone, {
- SEND_MESSAGES: false,
- READ_MESSAGES: false
- });
- c.overwritePermissions(staff, {
- SEND_MESSAGES: true,
- READ_MESSAGES: true
- });
- c.overwritePermissions(message.author, {
- SEND_MESSAGES: true,
- READ_MESSAGES: true
- });
- message.channel.send(new discord.RichEmbed().setColor("GREEN").setTitle("Success!").setDescription(`Your ticket has been created, <#${c.id}>!`));
- let em = new discord.RichEmbed()
- .setColor("BLUE")
- .setTitle("Vatrix Ticket System")
- .addField(`${message.author.username} requested`, args[0] ? args[0] : "None set.")
- .addField(`Happy with your response?`, `Get a support member to close this ticket.`);
- c.send({ embed: em });
- }).catch(console.error);
- }
- module.exports.help = {
- name:"new"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement