From 256ec32279986fe1a3e527669016646fe3425033 Mon Sep 17 00:00:00 2001 From: Dragon Fire Date: Tue, 9 Jun 2020 11:57:21 -0400 Subject: [PATCH] Person Command, Split util to where eval is owner --- README.md | 7 +++-- Xiao.js | 4 +-- commands/random-img/person.js | 27 +++++++++++++++++++ commands/{util => util-public}/changelog.js | 2 +- commands/{util => util-public}/cloc.js | 2 +- .../command-leaderboard.js | 2 +- commands/{util => util-public}/credit.js | 2 +- commands/{util => util-public}/donate.js | 2 +- commands/{util => util-public}/help.js | 2 +- commands/{util => util-public}/info.js | 2 +- commands/{util => util-public}/invite.js | 2 +- commands/{util => util-public}/options.js | 2 +- commands/{util => util-public}/ping.js | 2 +- commands/{util => util-public}/report.js | 2 +- .../{util => util-public}/unknown-command.js | 2 +- commands/{util => util-public}/uses.js | 2 +- .../command-leaderboard-export.js | 2 +- .../command-leaderboard-import.js | 2 +- .../{util-owner => util}/generate-commands.js | 2 +- .../{util-owner => util}/generate-credit.js | 2 +- .../generate-process-env.js | 2 +- commands/{util-owner => util}/ip.js | 2 +- commands/{util-owner => util}/shutdown.js | 2 +- commands/{util-owner => util}/webhook.js | 2 +- package.json | 2 +- 25 files changed, 56 insertions(+), 26 deletions(-) create mode 100644 commands/random-img/person.js rename commands/{util => util-public}/changelog.js (98%) rename commands/{util => util-public}/cloc.js (98%) rename commands/{util => util-public}/command-leaderboard.js (98%) rename commands/{util => util-public}/credit.js (97%) rename commands/{util => util-public}/donate.js (96%) rename commands/{util => util-public}/help.js (99%) rename commands/{util => util-public}/info.js (98%) rename commands/{util => util-public}/invite.js (96%) rename commands/{util => util-public}/options.js (97%) rename commands/{util => util-public}/ping.js (96%) rename commands/{util => util-public}/report.js (98%) rename commands/{util => util-public}/unknown-command.js (98%) rename commands/{util => util-public}/uses.js (96%) rename commands/{util-owner => util}/command-leaderboard-export.js (97%) rename commands/{util-owner => util}/command-leaderboard-import.js (97%) rename commands/{util-owner => util}/generate-commands.js (97%) rename commands/{util-owner => util}/generate-credit.js (98%) rename commands/{util-owner => util}/generate-process-env.js (97%) rename commands/{util-owner => util}/ip.js (96%) rename commands/{util-owner => util}/shutdown.js (97%) rename commands/{util-owner => util}/webhook.js (97%) diff --git a/README.md b/README.md index eee813f8..49a665ff 100644 --- a/README.md +++ b/README.md @@ -226,11 +226,10 @@ in the appropriate channel's topic to use it. ## Commands -Total: 465 +Total: 466 ### Utility: -* **eval:** Executes JavaScript code. (Owner-Only) * **changelog:** Responds with the bot's latest 10 commits. * **cloc:** Responds with the bot's code line count. * **command-leaderboard:** Responds with the bot's most used commands. @@ -246,6 +245,7 @@ Total: 465 ### Utility (Owner): +* **eval:** Executes JavaScript code. (Owner-Only) * **command-leaderboard-export:** Exports a command leaderboard JSON file. (Owner-Only) * **command-leaderboard-import:** Imports a command leaderboard JSON file. (Owner-Only) * **generate-commands:** Generates the commands list for Xiao's README. (Owner-Only) @@ -338,6 +338,7 @@ Total: 465 * **light-novel-cover:** Responds with a randomly generated Light Novel cover. (NSFW) * **lorem-picsum:** Responds with a random image of a certain size. * **meme:** Responds with a random meme. +* **person:** Responds with a randomly generated person. * **porn:** Responds with a random porn image. (NSFW) * **potato:** Responds with a random potato image. * **shiba:** Responds with a random image of a Shiba Inu. @@ -1397,6 +1398,8 @@ here. * newspaper (API) - [The Onion](https://www.theonion.com/) * the-onion ([RSS Feed](https://www.theonion.com/rss)) +- [This Person Does Not Exist](https://thispersondoesnotexist.com/) + * person (API) - [This Waifu Does Not Exist](https://www.thiswaifudoesnotexist.net/) * waifu (API) - [Tim's Printables](https://www.timvandevall.com/) diff --git a/Xiao.js b/Xiao.js index daaa9637..4f5bc1fe 100644 --- a/Xiao.js +++ b/Xiao.js @@ -16,8 +16,8 @@ client.registry .registerDefaultTypes() .registerTypesIn(path.join(__dirname, 'types')) .registerGroups([ - ['util', 'Utility'], - ['util-owner', 'Utility (Owner)'], + ['util-public', 'Utility'], + ['util', 'Utility (Owner)'], ['info', 'Discord Information'], ['random-res', 'Random Response'], ['random-img', 'Random Image'], diff --git a/commands/random-img/person.js b/commands/random-img/person.js new file mode 100644 index 00000000..42e7d892 --- /dev/null +++ b/commands/random-img/person.js @@ -0,0 +1,27 @@ +const Command = require('../../structures/Command'); +const request = require('node-superfetch'); + +module.exports = class PersonCommand extends Command { + constructor(client) { + super(client, { + name: 'person', + aliases: ['this-person-does-not-exist'], + group: 'random-img', + memberName: 'person', + description: 'Responds with a randomly generated person.', + clientPermissions: ['ATTACH_FILES'], + credit: [ + { + name: 'This Person Does Not Exist', + url: 'https://thispersondoesnotexist.com/', + reason: 'API' + } + ] + }); + } + + async run(msg) { + const { body } = await request.get('https://thispersondoesnotexist.com/image'); + return msg.say({ files: [{ attachment: body, name: 'this-person-does-not-exist.jpg' }] }); + } +}; diff --git a/commands/util/changelog.js b/commands/util-public/changelog.js similarity index 98% rename from commands/util/changelog.js rename to commands/util-public/changelog.js index d3049c94..bc837df7 100644 --- a/commands/util/changelog.js +++ b/commands/util-public/changelog.js @@ -9,7 +9,7 @@ module.exports = class ChangelogCommand extends Command { super(client, { name: 'changelog', aliases: ['updates', 'commits'], - group: 'util', + group: 'util-public', memberName: 'changelog', description: 'Responds with the bot\'s latest 10 commits.', guarded: true, diff --git a/commands/util/cloc.js b/commands/util-public/cloc.js similarity index 98% rename from commands/util/cloc.js rename to commands/util-public/cloc.js index f79514a3..6bb26a6d 100644 --- a/commands/util/cloc.js +++ b/commands/util-public/cloc.js @@ -9,7 +9,7 @@ module.exports = class ClocCommand extends Command { constructor(client) { super(client, { name: 'cloc', - group: 'util', + group: 'util-public', memberName: 'cloc', description: 'Responds with the bot\'s code line count.', guarded: true, diff --git a/commands/util/command-leaderboard.js b/commands/util-public/command-leaderboard.js similarity index 98% rename from commands/util/command-leaderboard.js rename to commands/util-public/command-leaderboard.js index 609f10b0..79f75e6f 100644 --- a/commands/util/command-leaderboard.js +++ b/commands/util-public/command-leaderboard.js @@ -6,7 +6,7 @@ module.exports = class CommandLeaderboardCommand extends Command { super(client, { name: 'command-leaderboard', aliases: ['cmd-lb', 'cmd-leaderboard', 'command-lb'], - group: 'util', + group: 'util-public', memberName: 'command-leaderboard', description: 'Responds with the bot\'s most used commands.', guarded: true, diff --git a/commands/util/credit.js b/commands/util-public/credit.js similarity index 97% rename from commands/util/credit.js rename to commands/util-public/credit.js index df573a02..bbb39e87 100644 --- a/commands/util/credit.js +++ b/commands/util-public/credit.js @@ -6,7 +6,7 @@ module.exports = class CreditCommand extends Command { constructor(client) { super(client, { name: 'credit', - group: 'util', + group: 'util-public', memberName: 'credit', description: 'Responds with a command\'s credits list.', guarded: true, diff --git a/commands/util/donate.js b/commands/util-public/donate.js similarity index 96% rename from commands/util/donate.js rename to commands/util-public/donate.js index 501b76c4..e1528372 100644 --- a/commands/util/donate.js +++ b/commands/util-public/donate.js @@ -6,7 +6,7 @@ module.exports = class DonateCommand extends Command { super(client, { name: 'donate', aliases: ['paypal'], - group: 'util', + group: 'util-public', memberName: 'donate', description: 'Responds with the bot\'s donation links.', guarded: true, diff --git a/commands/util/help.js b/commands/util-public/help.js similarity index 99% rename from commands/util/help.js rename to commands/util-public/help.js index d2dcec54..2d38be7d 100644 --- a/commands/util/help.js +++ b/commands/util-public/help.js @@ -8,7 +8,7 @@ module.exports = class HelpCommand extends Command { super(client, { name: 'help', aliases: ['commands', 'command-list'], - group: 'util', + group: 'util-public', memberName: 'help', description: 'Displays a list of available commands, or detailed information for a specific command.', guarded: true, diff --git a/commands/util/info.js b/commands/util-public/info.js similarity index 98% rename from commands/util/info.js rename to commands/util-public/info.js index 96d62568..edb754da 100644 --- a/commands/util/info.js +++ b/commands/util-public/info.js @@ -14,7 +14,7 @@ module.exports = class InfoCommand extends Command { super(client, { name: 'info', aliases: ['stats', 'uptime'], - group: 'util', + group: 'util-public', memberName: 'info', description: 'Responds with detailed bot information.', guarded: true, diff --git a/commands/util/invite.js b/commands/util-public/invite.js similarity index 96% rename from commands/util/invite.js rename to commands/util-public/invite.js index d7b3e0f2..61886452 100644 --- a/commands/util/invite.js +++ b/commands/util-public/invite.js @@ -6,7 +6,7 @@ module.exports = class InviteCommand extends Command { constructor(client) { super(client, { name: 'invite', - group: 'util', + group: 'util-public', memberName: 'invite', description: 'Responds with the bot\'s invite links.', guarded: true diff --git a/commands/util/options.js b/commands/util-public/options.js similarity index 97% rename from commands/util/options.js rename to commands/util-public/options.js index d22b2d07..753bb34e 100644 --- a/commands/util/options.js +++ b/commands/util-public/options.js @@ -6,7 +6,7 @@ module.exports = class OptionsCommand extends Command { super(client, { name: 'options', aliases: ['options-list'], - group: 'util', + group: 'util-public', memberName: 'options', description: 'Responds with a list of server options.', guarded: true diff --git a/commands/util/ping.js b/commands/util-public/ping.js similarity index 96% rename from commands/util/ping.js rename to commands/util-public/ping.js index 20c286f7..d5e676fc 100644 --- a/commands/util/ping.js +++ b/commands/util-public/ping.js @@ -7,7 +7,7 @@ module.exports = class PingCommand extends Command { super(client, { name: 'ping', aliases: ['pong', 'ping-pong'], - group: 'util', + group: 'util-public', memberName: 'ping', description: 'Checks the bot\'s ping to the Discord server.', guarded: true diff --git a/commands/util/report.js b/commands/util-public/report.js similarity index 98% rename from commands/util/report.js rename to commands/util-public/report.js index 13e3f0d0..f418b92e 100644 --- a/commands/util/report.js +++ b/commands/util-public/report.js @@ -11,7 +11,7 @@ module.exports = class ReportCommand extends Command { super(client, { name: 'report', aliases: ['bug', 'report-bug', 'feedback', 'contact', 'suggest', 'suggestion'], - group: 'util', + group: 'util-public', memberName: 'report', description: 'Reports something to the bot owner(s).', guarded: true, diff --git a/commands/util/unknown-command.js b/commands/util-public/unknown-command.js similarity index 98% rename from commands/util/unknown-command.js rename to commands/util-public/unknown-command.js index 7a6d8a69..8825d1d9 100644 --- a/commands/util/unknown-command.js +++ b/commands/util-public/unknown-command.js @@ -6,7 +6,7 @@ module.exports = class UnknownCommandCommand extends Command { constructor(client) { super(client, { name: 'unknown-command', - group: 'util', + group: 'util-public', memberName: 'unknown-command', description: 'Displays help information for when an unknown command is used.', unknown: true, diff --git a/commands/util/uses.js b/commands/util-public/uses.js similarity index 96% rename from commands/util/uses.js rename to commands/util-public/uses.js index d0d3d22e..f19d1d46 100644 --- a/commands/util/uses.js +++ b/commands/util-public/uses.js @@ -4,7 +4,7 @@ module.exports = class UsesCommand extends Command { constructor(client) { super(client, { name: 'uses', - group: 'util', + group: 'util-public', memberName: 'uses', description: 'Responds with a command\'s usage stats.', guarded: true, diff --git a/commands/util-owner/command-leaderboard-export.js b/commands/util/command-leaderboard-export.js similarity index 97% rename from commands/util-owner/command-leaderboard-export.js rename to commands/util/command-leaderboard-export.js index 97af70ba..2f398af4 100644 --- a/commands/util-owner/command-leaderboard-export.js +++ b/commands/util/command-leaderboard-export.js @@ -13,7 +13,7 @@ module.exports = class CommandLeaderboardExportCommand extends Command { 'export-command-lb', 'export-command-leaderboard' ], - group: 'util-owner', + group: 'util', memberName: 'command-leaderboard-export', description: 'Exports a command leaderboard JSON file.', details: 'Only the bot owner(s) may use this command.', diff --git a/commands/util-owner/command-leaderboard-import.js b/commands/util/command-leaderboard-import.js similarity index 97% rename from commands/util-owner/command-leaderboard-import.js rename to commands/util/command-leaderboard-import.js index 2de08b08..22e087f3 100644 --- a/commands/util-owner/command-leaderboard-import.js +++ b/commands/util/command-leaderboard-import.js @@ -13,7 +13,7 @@ module.exports = class CommandLeaderboardImportCommand extends Command { 'import-command-lb', 'import-command-leaderboard' ], - group: 'util-owner', + group: 'util', memberName: 'command-leaderboard-import', description: 'Imports a command leaderboard JSON file.', details: 'Only the bot owner(s) may use this command.', diff --git a/commands/util-owner/generate-commands.js b/commands/util/generate-commands.js similarity index 97% rename from commands/util-owner/generate-commands.js rename to commands/util/generate-commands.js index c06831e8..2d1ccdae 100644 --- a/commands/util-owner/generate-commands.js +++ b/commands/util/generate-commands.js @@ -5,7 +5,7 @@ module.exports = class GenerateCommandsCommand extends Command { super(client, { name: 'generate-commands', aliases: ['gen-commands', 'generate-cmds', 'gen-cmds'], - group: 'util-owner', + group: 'util', memberName: 'generate-commands', description: 'Generates the commands list for Xiao\'s README.', details: 'Only the bot owner(s) may use this command.', diff --git a/commands/util-owner/generate-credit.js b/commands/util/generate-credit.js similarity index 98% rename from commands/util-owner/generate-credit.js rename to commands/util/generate-credit.js index 91e1772f..e92089df 100644 --- a/commands/util-owner/generate-credit.js +++ b/commands/util/generate-credit.js @@ -6,7 +6,7 @@ module.exports = class GenerateCreditCommand extends Command { super(client, { name: 'generate-credit', aliases: ['gen-credit'], - group: 'util-owner', + group: 'util', memberName: 'generate-credit', description: 'Generates the credit list for Xiao\'s README.', details: 'Only the bot owner(s) may use this command.', diff --git a/commands/util-owner/generate-process-env.js b/commands/util/generate-process-env.js similarity index 97% rename from commands/util-owner/generate-process-env.js rename to commands/util/generate-process-env.js index e1db2bf3..66ab48ae 100644 --- a/commands/util-owner/generate-process-env.js +++ b/commands/util/generate-process-env.js @@ -7,7 +7,7 @@ module.exports = class GenerateProcessEnvCommand extends Command { super(client, { name: 'generate-process-env', aliases: ['gen-process-env', 'generate-env', 'gen-env'], - group: 'util-owner', + group: 'util', memberName: 'generate-process-env', description: 'Generates a backup list of Xiao\'s `process.env`.', details: 'Only the bot owner(s) may use this command.', diff --git a/commands/util-owner/ip.js b/commands/util/ip.js similarity index 96% rename from commands/util-owner/ip.js rename to commands/util/ip.js index 566af305..be07029e 100644 --- a/commands/util-owner/ip.js +++ b/commands/util/ip.js @@ -5,7 +5,7 @@ module.exports = class IpCommand extends Command { constructor(client) { super(client, { name: 'ip', - group: 'util-owner', + group: 'util', memberName: 'ip', description: 'Responds with the IP address the bot\'s server is running on.', details: 'Only the bot owner(s) may use this command.', diff --git a/commands/util-owner/shutdown.js b/commands/util/shutdown.js similarity index 97% rename from commands/util-owner/shutdown.js rename to commands/util/shutdown.js index 87624974..b95c65da 100644 --- a/commands/util-owner/shutdown.js +++ b/commands/util/shutdown.js @@ -5,7 +5,7 @@ module.exports = class ShutdownCommand extends Command { super(client, { name: 'shutdown', aliases: ['die', 'restart', 'process.exit'], - group: 'util-owner', + group: 'util', memberName: 'shutdown', description: 'Shuts down the bot.', details: 'Only the bot owner(s) may use this command.', diff --git a/commands/util-owner/webhook.js b/commands/util/webhook.js similarity index 97% rename from commands/util-owner/webhook.js rename to commands/util/webhook.js index ae8d5d04..54d8b931 100644 --- a/commands/util-owner/webhook.js +++ b/commands/util/webhook.js @@ -5,7 +5,7 @@ module.exports = class WebhookCommand extends Command { super(client, { name: 'webhook', aliases: ['rin', 'rin-say'], - group: 'util-owner', + group: 'util', memberName: 'webhook', description: 'Posts a message to the webhook defined in the bot owner\'s `process.env`.', details: 'Only the bot owner(s) may use this command.', diff --git a/package.json b/package.json index 41eb3921..c5d26a36 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "116.9.8", + "version": "116.10.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {