SHARE
TWEET

Untitled

a guest Aug 25th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //This is the bots required node modules, certain aspects of the code will not work without this.
  2. const Discord = require("discord.js");
  3. const client = new Discord.Client({
  4.   disableEveryone : true,
  5.   fetchAllMembers : true
  6. });
  7.  
  8. const config = require("../data/config.json");
  9. const fs = require("fs");
  10. const snekfetch = require('snekfetch');
  11.  
  12. //This SHOULD allow us to use the "client, message & args" async functions.(Example: message.author.id)
  13. exports.run = async (client, message, args) => {
  14.  
  15. //This is your Command or Discord Rich Embed code Line followed by the end of the command. OR close "}" bracket
  16. let Tembed2 = new Discord.RichEmbed()
  17.       .setColor("0xff0000")
  18.       .setTitle(":no_entry: Error :no_entry:")
  19.       .setDescription(`<@${message.author.id}>` + " There wasn't a tickets category so i created one! :thumbsup: Please execute the command again to open your ticket");
  20.       message.delete().catch();
  21.      
  22.  let Tembed3 = new Discord.RichEmbed()
  23.       .setColor("0xff0000")
  24.       .setTitle(":no_entry: Error :no_entry:")
  25.       .setDescription(`<@${message.author.id}>` + " This server doesn't have a ``Support Team`` role made, so the ticket won't be opened.\nIf you are an administrator, make one with that name exactly and give it to users that should be able to see tickets.");
  26.       message.delete().catch();
  27.      
  28. let Tembed4 = new Discord.RichEmbed()
  29.       .setColor("0xff0000")
  30.       .setTitle(":no_entry: Error :no_entry:")
  31.       .setDescription(`<@${message.author.id}>` + " You already have a ticket open. :shrug:");
  32.       message.delete().catch();
  33.      
  34.     const reason = message.content.split(" ").slice(1).join(" ");
  35.      if (!message.guild.channels.exists("name", "★★★★★★tickets★★★★★★", "category")) return message.channel.send(Tembed2) .then(message.guild.createChannel("★★★★★★tickets★★★★★★", "category"))
  36.     if (!message.guild.roles.exists("name", "Support Team")) return message.channel.send(Tembed3);
  37.     if (message.guild.channels.exists("name", "ticket-" + message.author.id)) return message.channel.send(Tembed4);
  38.        message.guild.createChannel(`ticket-${message.author.id}`, "text",).then(c => {
  39.         let role = message.guild.roles.find("name", "Support Team");
  40.         let role2 = message.guild.roles.find("name", "@everyone");
  41.         let category = message.guild.channels.find(c => c.name == "★★★★★★tickets★★★★★★" && c.type == "category");
  42.         c.setParent(category);
  43.         c.overwritePermissions(role, {
  44.             SEND_MESSAGES: true,
  45.             READ_MESSAGES: true
  46.         });
  47.         c.overwritePermissions(role2, {
  48.             SEND_MESSAGES: false,
  49.             READ_MESSAGES: false
  50.         });
  51.         c.overwritePermissions(message.author, {
  52.             SEND_MESSAGES: true,
  53.             READ_MESSAGES: true
  54.         });
  55.            
  56.   let Tembed5 = new Discord.RichEmbed()
  57.       .setColor(53380)
  58.       .setTitle(":white_check_mark: Success :white_check_mark:")
  59.       .setDescription(`<@${message.author.id}>` + "Your ticket has been created")
  60.       .addField(`Your Ticket Channel`, `#${c.name}.`);  
  61.       message.delete().catch();
  62.            
  63.         message.channel.send(Tembed5)
  64.  
  65.         const embed = new Discord.RichEmbed()
  66.     .setTitle("Support Ticket")
  67.         .setColor(0x00AE86)
  68.     .setDescription(`Hey <@${message.author.id}>`)
  69.         .addField("Please try to explain why you opened this ticket with as much detail as possible. Our **Support Team** will be here soon to help.")
  70.         .setTimestamp();
  71.         c.send({ embed: embed });
  72.     }).catch(console.error);
  73. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top