mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2025-09-02 08:41:25 +03:00
upload
This commit is contained in:
@@ -57,10 +57,8 @@ module.exports = {
|
||||
|
||||
if (!command) {
|
||||
const notCmd = new Discord.RichEmbed()
|
||||
.setAuthor(`${client.user.username}`, client.user.avatarURL)
|
||||
.setColor("#E74C3C")
|
||||
.setDescription(`:x: **Invalid command name** (\`${config.prefix}help\`)`)
|
||||
.setFooter(`${client.guilds.get(config.guildID).name} : DiscordTickets by Eartharoid`);
|
||||
return message.channel.send(notCmd)
|
||||
}
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
const Discord = require('discord.js');
|
||||
const config = require('../config.json');
|
||||
const leeks = require('leeks.js');
|
||||
const randomString = require('random-string');
|
||||
// const randomString = require('random-string');
|
||||
module.exports = {
|
||||
name: 'new',
|
||||
description: 'Create a new ticket',
|
||||
@@ -11,20 +11,60 @@ module.exports = {
|
||||
args: true,
|
||||
cooldown: config.cooldown,
|
||||
guildOnly: true,
|
||||
execute(message, args) {
|
||||
execute(message, args) {
|
||||
const client = message.client;
|
||||
// command starts here
|
||||
message.delete();
|
||||
const ticketChannel = "channel";
|
||||
let topic = args.join(" ");
|
||||
|
||||
// let num = randomString({
|
||||
// length: 4,
|
||||
// numeric: true,
|
||||
// letters: false,
|
||||
// special: false,
|
||||
// });
|
||||
let id = message.author.id.toString().substr(0,4) + message.author.discriminator;
|
||||
|
||||
let num = randomString({
|
||||
length: 4,
|
||||
numeric: true,
|
||||
letters: false,
|
||||
special: false,
|
||||
});
|
||||
// if(message.guild.channels.some(channel => `ticket-${id}`)) {
|
||||
if(message.guild.channels.some(includes(`ticket-${id}`))) {
|
||||
const err1 = new Discord.RichEmbed()
|
||||
.setColor("#E74C3C")
|
||||
.setDescription(`:x: You already have a ticket open.`)
|
||||
return message.channel.send(err1)
|
||||
};
|
||||
|
||||
message.guild.createChannel(`ticket-${id}`).then(async c => {
|
||||
c.setParent(config.ticketsCat);
|
||||
// let supportrole = message.guild.roles.find(`id`, config.supportRole)
|
||||
let supportrole = message.guild.roles.get(config.supportRole)
|
||||
if(!supportrole) return message.channel.send(":x: No **Support Team** role found.");
|
||||
|
||||
|
||||
// c.overwritePermissions(message.guild.defaultRole, {
|
||||
// VIEW_CHANNEL: false,
|
||||
// SEND_MESSAGES: false
|
||||
// })
|
||||
// c.overwritePermissions(message.member, {
|
||||
// VIEW_CHANNEL: true,
|
||||
// SEND_MESSAGES: true
|
||||
// })
|
||||
// c.overwritePermissions(supportrole, {
|
||||
// VIEW_CHANNEL: true,
|
||||
// SEND_MESSAGES: true
|
||||
// })
|
||||
// c.setTopic(`${message.author} | ${topic}`);
|
||||
//
|
||||
// const embed2 = new Discord.RichEmbed()
|
||||
// .setColor(colour)
|
||||
// .setDescription(`Your ticket (${c}) has been created.`)
|
||||
// .setTimestamp()
|
||||
// .setFooter(`${config.footer}`, config.logo);
|
||||
//
|
||||
// message.channel.send(embed2)
|
||||
// c.send(`<@&${config.supportRole}>\n`)
|
||||
// c.send(embed3)
|
||||
})
|
||||
|
||||
|
||||
// log
|
||||
@@ -39,7 +79,7 @@ module.exports = {
|
||||
// } else {
|
||||
// client.channels.get(config.logChannel).send(`New ticket created by **${message.author.tag} (${message.author.id})**`);
|
||||
// }
|
||||
console.log(leeks.colors.cyan(`${message.author.tag} created a new ticket (#ticket-${num})`))
|
||||
console.log(leeks.colors.cyan(`${message.author.tag} created a new ticket (#ticket-${id})`))
|
||||
|
||||
// command ends here
|
||||
},
|
||||
|
Reference in New Issue
Block a user