Update ticket.js

This commit is contained in:
ItzEmerald authored and GitHub committed 2020-01-29 19:08:00 +00:00
1 parent 68340a8b02
commit 9b0b0d10a1
1 file changed
+18 -13
+18 -13
View File
@@ -13,19 +13,24 @@ const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'))
exports.run = (bot, message, args) => {
console.log(`\u001b[33m`, `[${supportbot.Bot_Name}] > `, `\u001b[31;1m`, `${message.author.tag}`, `\u001b[32;1m`, `has executed`, `\u001b[31;1m`, `${supportbot.Prefix}${supportbot.Ticket_Command}`);
// Ticket Number ID Settings
const TicketNumberID = require('../utils/TicketNumber.js');
let TicketNumberID = TicketId.pad(message.guild.id);
// Ticket Subject Settings
const subject = args.join(" ") || `${supportbot.Default_Ticket_Reason}`;
const ID = Math.floor(Math.random() * 10) + 2000;
const subject = args.join(" ") || `${supportbot.Default_Ticket_Reason}`;
const alreadyopen = new Discord.RichEmbed()
.setDescription(`:x: Cannot create a ticket because **${supportbot.Ticket_Channel_Name}-${ID}** already exists.`)
.setColor(supportbot.EmbedColour)
// Ticket Limitiations
const alreadyopen = new Discord.RichEmbed()
.setDescription(`:x: Cannot create a ticket because **${supportbot.Ticket_Channel_Name}-${TicketNumberID}** already exists.`)
.setColor(supportbot.EmbedColour)
if (message.guild.channels.find(TicketChannel => TicketChannel.name === `${supportbot.Ticket_Channel_Name}-` + message.author.username)) return message.channel.send(alreadyopen);
message.guild.createChannel(`${supportbot.Ticket_Channel_Name}-${ID}`, {
type: 'text',
}).then(TicketChannel => {
// Ticket Creation
if (message.guild.channels.find(TicketChannel => TicketChannel.name === `${supportbot.Ticket_Channel_Name}-` + message.author.username)) return message.channel.send(alreadyopen);
message.guild.createChannel(`${supportbot.Ticket_Channel_Name}-${TicketNumberID}`, {
type: 'text',
}).then(TicketChannel => {
// Roles
let staff = message.guild.roles.find(supportRole => supportRole.name === `${supportbot.StaffRole}`)
@@ -121,9 +126,9 @@ exports.run = (bot, message, args) => {
// Ticket Logging
const logEmbed = new Discord.RichEmbed()
.setTitle(":ticket: Logistics of your Ticket")
.addField("Ticket ID", ID, true)
.addField("Ticket ID", TicketNumberID, true)
.addField("User", `<@${message.author.id}>`, true)
.addField("Channel", `ticket#${ID}`, true)
.addField("Channel", `ticket#${TicketNumberID}`, true)
.setColor(supportbot.EmbedColour)
.setFooter(supportbot.EmbedFooter)