From b32d038e0b9b5418e7455f5804e370b1e55c7a3d Mon Sep 17 00:00:00 2001 From: Eartharoid Date: Sat, 4 May 2019 12:20:26 +0100 Subject: [PATCH] update --- commands/example-command.js.example | 21 +++++++++++++++++++++ commands/help.js | 1 + commands/new.js | 4 ++++ example-config.json | 2 +- index.js | 12 +++++++++++- 5 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 commands/example-command.js.example diff --git a/commands/example-command.js.example b/commands/example-command.js.example new file mode 100644 index 0000000..303f51f --- /dev/null +++ b/commands/example-command.js.example @@ -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 + }, +}; diff --git a/commands/help.js b/commands/help.js index d37364a..99902ab 100644 --- a/commands/help.js +++ b/commands/help.js @@ -6,6 +6,7 @@ module.exports = { description: 'Displays help menu', usage: '[command]', aliases: ['command', 'commands'], + example: 'help new', args: false, cooldown: config.cooldown, execute(message, args) { diff --git a/commands/new.js b/commands/new.js index ffb151f..588b002 100644 --- a/commands/new.js +++ b/commands/new.js @@ -1,9 +1,13 @@ +const Discord = require('discord.js'); +const config = require('../config.json'); module.exports = { name: 'new', description: 'Create a new ticket', usage: '', aliases: ['ticket'], + example: 'new I found an error', args: true, + cooldown: config.cooldown, execute(message, args) { // command starts here message.delete(); diff --git a/example-config.json b/example-config.json index c2adfc2..28ad99b 100644 --- a/example-config.json +++ b/example-config.json @@ -10,5 +10,5 @@ "playing": "with tickets (!help)", "useEmbeds": true, "logDMs": true, - "cooldown": 3 + "cooldown": 5 } diff --git a/index.js b/index.js index 071fd50..e0c8741 100644 --- a/index.js +++ b/index.js @@ -201,7 +201,17 @@ client.on('message', message => { if (now < expirationTime) { 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);