This commit is contained in:
Eartharoid 2019-05-04 12:20:26 +01:00
parent ddbc940bd5
commit b32d038e0b
5 changed files with 38 additions and 2 deletions

View File

@ -0,0 +1,21 @@
const Discord = require('discord.js');
const config = require('../config.json');
module.exports = {
name: 'example-command',
description: 'An example command',
usage: '[args]',
aliases: ['command', 'commands'],
example: 'example-command',
args: false,
cooldown: config.cooldown,
execute(message, args) {
const client = message.client;
// command starts here
message.delete();
// command ends here
},
};

View File

@ -6,6 +6,7 @@ module.exports = {
description: 'Displays help menu', description: 'Displays help menu',
usage: '[command]', usage: '[command]',
aliases: ['command', 'commands'], aliases: ['command', 'commands'],
example: 'help new',
args: false, args: false,
cooldown: config.cooldown, cooldown: config.cooldown,
execute(message, args) { execute(message, args) {

View File

@ -1,9 +1,13 @@
const Discord = require('discord.js');
const config = require('../config.json');
module.exports = { module.exports = {
name: 'new', name: 'new',
description: 'Create a new ticket', description: 'Create a new ticket',
usage: '<brief description>', usage: '<brief description>',
aliases: ['ticket'], aliases: ['ticket'],
example: 'new I found an error',
args: true, args: true,
cooldown: config.cooldown,
execute(message, args) { execute(message, args) {
// command starts here // command starts here
message.delete(); message.delete();

View File

@ -10,5 +10,5 @@
"playing": "with tickets (!help)", "playing": "with tickets (!help)",
"useEmbeds": true, "useEmbeds": true,
"logDMs": true, "logDMs": true,
"cooldown": 3 "cooldown": 5
} }

View File

@ -201,7 +201,17 @@ client.on('message', message => {
if (now < expirationTime) { if (now < expirationTime) {
const timeLeft = (expirationTime - now) / 1000; const timeLeft = (expirationTime - now) / 1000;
return message.reply(`please wait ${timeLeft.toFixed(1)} more second(s) before reusing the \`${command.name}\` command.`); if (config.useEmbeds) {
const embed = new Discord.RichEmbed()
.setAuthor(`${client.user.username}`, client.user.avatarURL)
.setColor("#E74C3C")
.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})
} else {
return message.reply(`please do not spam commands (wait ${timeLeft.toFixed(1)}s)`);
}
} }
} }
timestamps.set(message.author.id, now); timestamps.set(message.author.id, now);