mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2024-12-23 00:03:09 +02:00
upload
This commit is contained in:
parent
adc1b002e7
commit
524ebaa767
@ -57,10 +57,8 @@ module.exports = {
|
|||||||
|
|
||||||
if (!command) {
|
if (!command) {
|
||||||
const notCmd = new Discord.RichEmbed()
|
const notCmd = new Discord.RichEmbed()
|
||||||
.setAuthor(`${client.user.username}`, client.user.avatarURL)
|
|
||||||
.setColor("#E74C3C")
|
.setColor("#E74C3C")
|
||||||
.setDescription(`:x: **Invalid command name** (\`${config.prefix}help\`)`)
|
.setDescription(`:x: **Invalid command name** (\`${config.prefix}help\`)`)
|
||||||
.setFooter(`${client.guilds.get(config.guildID).name} : DiscordTickets by Eartharoid`);
|
|
||||||
return message.channel.send(notCmd)
|
return message.channel.send(notCmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
const Discord = require('discord.js');
|
const Discord = require('discord.js');
|
||||||
const config = require('../config.json');
|
const config = require('../config.json');
|
||||||
const leeks = require('leeks.js');
|
const leeks = require('leeks.js');
|
||||||
const randomString = require('random-string');
|
// const randomString = require('random-string');
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'new',
|
name: 'new',
|
||||||
description: 'Create a new ticket',
|
description: 'Create a new ticket',
|
||||||
@ -11,20 +11,60 @@ module.exports = {
|
|||||||
args: true,
|
args: true,
|
||||||
cooldown: config.cooldown,
|
cooldown: config.cooldown,
|
||||||
guildOnly: true,
|
guildOnly: true,
|
||||||
execute(message, args) {
|
execute(message, args) {
|
||||||
const client = message.client;
|
const client = message.client;
|
||||||
// command starts here
|
// command starts here
|
||||||
message.delete();
|
message.delete();
|
||||||
const ticketChannel = "channel";
|
const ticketChannel = "channel";
|
||||||
let topic = args.join(" ");
|
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({
|
// if(message.guild.channels.some(channel => `ticket-${id}`)) {
|
||||||
length: 4,
|
if(message.guild.channels.some(includes(`ticket-${id}`))) {
|
||||||
numeric: true,
|
const err1 = new Discord.RichEmbed()
|
||||||
letters: false,
|
.setColor("#E74C3C")
|
||||||
special: false,
|
.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
|
// log
|
||||||
@ -39,7 +79,7 @@ module.exports = {
|
|||||||
// } else {
|
// } else {
|
||||||
// client.channels.get(config.logChannel).send(`New ticket created by **${message.author.tag} (${message.author.id})**`);
|
// 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
|
// command ends here
|
||||||
},
|
},
|
||||||
|
11
index.js
11
index.js
@ -84,12 +84,7 @@ client.once('ready', () => { // after bot has logged in
|
|||||||
}
|
}
|
||||||
console.log(leeks.colors.green(`Connected to Discord API`))
|
console.log(leeks.colors.green(`Connected to Discord API`))
|
||||||
console.log(leeks.colors.green(`Logged in as ${client.user.tag}`))
|
console.log(leeks.colors.green(`Logged in as ${client.user.tag}`))
|
||||||
client.user.setPresence({
|
client.user.setPresence({game: {name: config.playing, type: config.activityType},status: config.status})
|
||||||
game: {
|
|
||||||
name: config.playing
|
|
||||||
},
|
|
||||||
status: 'online'
|
|
||||||
})
|
|
||||||
// .then(console.log)
|
// .then(console.log)
|
||||||
.catch(console.error);
|
.catch(console.error);
|
||||||
// console.log(leeks.colors.green(`Set playing status as `) + leeks.colors.yellow(`'${config.playing}${config.prefix}help'`));
|
// console.log(leeks.colors.green(`Set playing status as `) + leeks.colors.yellow(`'${config.playing}${config.prefix}help'`));
|
||||||
@ -199,10 +194,8 @@ client.on('message', async message => {
|
|||||||
// return message.channel.send(reply);
|
// return message.channel.send(reply);
|
||||||
if (config.useEmbeds) {
|
if (config.useEmbeds) {
|
||||||
const embed = new Discord.RichEmbed()
|
const embed = new Discord.RichEmbed()
|
||||||
.setAuthor(`${client.user.username}`, client.user.avatarURL)
|
|
||||||
.setColor("#E74C3C")
|
.setColor("#E74C3C")
|
||||||
.setDescription(`\n**Usage:** \`${config.prefix}${command.name} ${command.usage}\`\nType \`${config.prefix}help ${command.name}\` for more information`)
|
.setDescription(`\n**Usage:** \`${config.prefix}${command.name} ${command.usage}\`\nType \`${config.prefix}help ${command.name}\` for more information`)
|
||||||
.setFooter(`${client.guilds.get(config.guildID).name} : DiscordTickets by Eartharoid`);
|
|
||||||
return message.channel.send({embed})
|
return message.channel.send({embed})
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -225,10 +218,8 @@ client.on('message', async message => {
|
|||||||
const timeLeft = (expirationTime - now) / 1000;
|
const timeLeft = (expirationTime - now) / 1000;
|
||||||
if (config.useEmbeds) {
|
if (config.useEmbeds) {
|
||||||
const embed = new Discord.RichEmbed()
|
const embed = new Discord.RichEmbed()
|
||||||
.setAuthor(`${client.user.username}`, client.user.avatarURL)
|
|
||||||
.setColor("#E74C3C")
|
.setColor("#E74C3C")
|
||||||
.setDescription(`:x: **Please do not spam commands** (wait ${timeLeft.toFixed(1)}s)`)
|
.setDescription(`:x: **Please do not spam commands** (wait ${timeLeft.toFixed(1)}s)`)
|
||||||
.setFooter(`${client.guilds.get(config.guildID).name} : DiscordTickets by Eartharoid`);
|
|
||||||
return message.channel.send({embed})
|
return message.channel.send({embed})
|
||||||
} else {
|
} else {
|
||||||
return message.reply(`please do not spam commands (wait ${timeLeft.toFixed(1)}s)`);
|
return message.reply(`please do not spam commands (wait ${timeLeft.toFixed(1)}s)`);
|
||||||
|
Loading…
Reference in New Issue
Block a user