From c336c8e1cffebe70a694bd0280a37e77323fd676 Mon Sep 17 00:00:00 2001 From: Pascal Young Date: Wed, 31 Jul 2019 09:04:06 -0700 Subject: [PATCH 01/41] added better help command. general cleanup. --- src/bot.js | 3 +- src/commands/dev/ping.js | 23 +++++ src/commands/general/help.js | 58 ++++++++++++ src/commands/general/tzList.js | 22 ----- src/commands/moderation/ban.js | 41 --------- src/commands/moderation/clean.js | 92 ------------------- src/commands/moderation/kick.js | 41 --------- .../moderation/{status.js => logs.js} | 16 ++-- src/commands/moderation/unban.js | 44 --------- src/config.json | 6 +- 10 files changed, 94 insertions(+), 252 deletions(-) create mode 100644 src/commands/dev/ping.js create mode 100644 src/commands/general/help.js delete mode 100644 src/commands/general/tzList.js delete mode 100644 src/commands/moderation/ban.js delete mode 100644 src/commands/moderation/clean.js delete mode 100644 src/commands/moderation/kick.js rename src/commands/moderation/{status.js => logs.js} (82%) delete mode 100644 src/commands/moderation/unban.js diff --git a/src/bot.js b/src/bot.js index bf94dc1..87fb99d 100644 --- a/src/bot.js +++ b/src/bot.js @@ -64,7 +64,8 @@ client.registry ['dev', 'Developer'], ['moderation', 'Moderation'] ]) - .registerDefaults() + .registerDefaultTypes() + .registerDefaultGroups() .registerTypesIn(path.join(__dirname, 'types')) .registerCommandsIn(path.join(__dirname, 'commands')) diff --git a/src/commands/dev/ping.js b/src/commands/dev/ping.js new file mode 100644 index 0000000..1cda404 --- /dev/null +++ b/src/commands/dev/ping.js @@ -0,0 +1,23 @@ +var { Command } = require('discord.js-commando') + +module.exports = class PingCommand extends Command { + constructor(client) { + super(client, { + name: 'ping', + aliases: ['ping'], + group: 'dev', + memberName: 'ping', + description: 'Checks API latency', + guildOnly: false + }) + } + + hasPermission(msg) { + return this.client.isOwner(msg.author) + } + + async run(msg) { + let m = await msg.channel.send("Pinging..") + m.edit(`Pong! Latency is ${m.createdTimestamp - msg.createdTimestamp}ms. API Latency is ${Math.round(this.client.ping)}ms`) + } +} diff --git a/src/commands/general/help.js b/src/commands/general/help.js new file mode 100644 index 0000000..5eceaae --- /dev/null +++ b/src/commands/general/help.js @@ -0,0 +1,58 @@ +var { Command } = require('discord.js-commando') +var { stripIndents } = require('common-tags') +var { RichEmbed } = require('discord.js') + +module.exports = class HelpCommand extends Command { + constructor(client) { + super(client, { + name: 'help', + aliases: ['help', 'commands', 'cmds'], + group: 'general', + memberName: 'help', + description: 'Responds with list of commands', + guildOnly: false + }) + } + + hasPermission(msg) { + return msg.member.hasPermission('MANAGE_MESSAGES') + } + + async run(msg) { + let embed = new RichEmbed + embed.setColor('RANDOM') + embed.setAuthor('Command List') + embed.setFooter(`Created by atom#0001 for the True Colors Administration`) + + embed.setDescription(stripIndents` + **add**: Attaches evidence to a log. + Usage: !add + + **comment**: Adds a staff comment to a log. + Usage: !comment + + **convert**: Converts UTC time to any timezone. + Usage: !convert