Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Discord = require("discord.js");
- const footer = "Master [Code-Docs]"
- module.exports.run = async (bot, message, args) => {
- message.delete();
- // ID van de categorie van de tickets.
- const categoryId = "676054997552857111";
- // Verkrijg Gebruikersnaam
- var userName = message.author.username;
- // Verkrijg discriminator
- var userDiscriminator = message.author.discriminator;
- // Als ticket al gemaakt is
- var bool = false;
- // Kijk na als ticket al gemaakt is.
- message.guild.channels.cache.forEach((channel) => {
- // Als ticket is gemaakt, zend bericht.
- if (channel.name == userName.toLowerCase() + "-" + userDiscriminator) {
- message.channel.send("You have already created a ticket");
- bool = true;
- }
- });
- // Als ticket return code.
- if (bool == true) return;
- let Sender = message.author;
- const sayMessage = args.join(" ");
- if(!sayMessage) return message.channel.send(":x: " + "`| Please mention the issues in your ticket, more info we got that way we can find the best solution for you Usage: m!ticketopen <message>`").then(msg => msg.delete(5000))
- message.delete();
- var embedCreateTicket = new Discord.MessageEmbed()
- .setAuthor('Master [Code-Docs] Support Server', 'https://thumbs.gfycat.com/DeliciousJoyfulAustralianshelduck-max-1mb.gif')
- .setColor("#1f264d")
- .setTitle(message.author.username)
- .setFooter("Your ticket has been created Succesfully!!!!")
- .setTimestamp();
- message.channel.send(embedCreateTicket);
- // Maak kanaal en zet in juiste categorie.
- message.guild.channels.create(userName + "-" + userDiscriminator, "text").then((createdChan) => { // Maak kanaal
- createdChan.setParent(categoryId).then((settedParent) => { // Zet kanaal in category.
- // Zet perms voor iedereen
- settedParent.overwritePermissions(message.guild.roles.cache.find('name', "@everyone"), { "READ_MESSAGES": false });
- // Zet perms voor de gebruiker die ticket heeft aangemaakt.
- settedParent.overwritePermissions(message.author, {
- "READ_MESSAGES": true, "SEND_MESSAGES": true,
- "ATTACH_FILES": true, "CONNECT": true,
- "CREATE_INSTANT_INVITE": false, "ADD_REACTIONS": true
- });
- var embedParent = new Discord.MessageEmbed()
- .setColor("#1f264d")
- .setAuthor('Master [Code-Docs] Support Server Ticket Message!', 'https://thumbs.gfycat.com/DeliciousJoyfulAustralianshelduck-max-1mb.gif')
- .setTitle("Hey, " + message.author.username.toString())
- .setDescription("Ticket System")
- .addField("Ticket sent by", Sender, true)
- .addField("Ticket: ", sayMessage)
- .setFooter("Your ticket has been created Succesfully!!!!")
- .setTimestamp()
- settedParent.send(embedParent);
- }).catch(err => {
- message.channel.send("Something went wrong.");
- });
- }).catch(err => {
- message.channel.send("Something went wrong.");
- });
- message.delete();
- }
- module.exports.config = {
- name: "ticket",
- aliases: ["ticketopen", "topen"],
- accessableby: "Members",
- description: "Create a Ticket"
- }
Add Comment
Please, Sign In to add comment