From cdffbfebd012df6fad3ffe3e7fcdc3d4912063de Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Thu, 16 Jul 2020 20:23:46 -0400 Subject: [PATCH] Report Respond Command --- README.md | 1 + commands/util/report-respond.js | 52 +++++++++++++++++++++++++++++++++ package.json | 2 +- 3 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 commands/util/report-respond.js diff --git a/README.md b/README.md index 67caec68..8f52d1fe 100644 --- a/README.md +++ b/README.md @@ -280,6 +280,7 @@ Total: 535 * **generate-fun-information:** Generates the "Fun Information" for Xiao's README. (Owner-Only) * **generate-process-env:** Generates a backup list of Xiao's `process.env`. (Owner-Only) * **ip:** Responds with the IP address the bot's server is running on. (Owner-Only) +* **report-respond:** Responds to a submitted report. (Owner-Only) * **shutdown:** Shuts down the bot. (Owner-Only) * **webhook:** Posts a message to the webhook defined in the bot owner's `process.env`. (Owner-Only) diff --git a/commands/util/report-respond.js b/commands/util/report-respond.js new file mode 100644 index 00000000..868dba22 --- /dev/null +++ b/commands/util/report-respond.js @@ -0,0 +1,52 @@ +const Command = require('../../structures/Command'); +const { MessageEmbed } = require('discord.js'); +const { list } = require('../../util/Util'); +const types = ['reject', 'info', 'approve']; +const typesColors = ['RED', 'YELLOW', 'GREEN']; +const displaytypes = ['❌ Rejected', '❓ Need More Info', '✅ Accepted/Fixed']; + +module.exports = class ReportRespondCommand extends Command { + constructor(client) { + super(client, { + name: 'report-respond', + aliases: ['report-res'], + group: 'util', + memberName: 'report-respond', + description: 'Responds to a submitted report.', + details: 'Only the bot owner(s) may use this command.', + guarded: true, + ownerOnly: true, + args: [ + { + key: 'user', + prompt: 'What user do you want to respond to?', + type: 'user' + }, + { + key: 'type', + prompt: `What is the reason for your report? Either ${list(types, 'or')}.`, + type: 'string', + oneOf: types, + parse: type => types.indexOf(type.toLowerCase()) + }, + { + key: 'message', + prompt: 'What response do you want to send?', + type: 'string' + } + ] + }); + } + + async run(msg, { user, type, message }) { + const embed = new MessageEmbed() + .setDescription(message) + .setTitle(displaytypes[type]) + .setAuthor(msg.author.tag) + .setFooter(`ID: ${msg.author.id}`) + .setTimestamp() + .setColor(typesColors[type]); + await user.send('Your report has been evaluated with the following message:', { embed }); + return msg.say(`${displaytypes[type]} sent to ${user.tag}.`); + } +}; diff --git a/package.json b/package.json index 28c9bc1d..e7f879c8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "119.17.5", + "version": "119.18.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {