aboutsummaryrefslogtreecommitdiff
path: root/src/commands/info/color.ts
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-14 21:22:09 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-07-14 21:22:09 -0400
commit53d2b18f7f73d5696fb7cd86d1c164a790dfdcc3 (patch)
treef95f23aad382879b35860d4d3be3642068fac8a2 /src/commands/info/color.ts
parenteaaae08aeee1fa16a4e1ad0b26fceb42885bfcde (diff)
downloadtanzanite-53d2b18f7f73d5696fb7cd86d1c164a790dfdcc3.tar.gz
tanzanite-53d2b18f7f73d5696fb7cd86d1c164a790dfdcc3.tar.bz2
tanzanite-53d2b18f7f73d5696fb7cd86d1c164a790dfdcc3.zip
started moving over some other commands
Diffstat (limited to 'src/commands/info/color.ts')
-rw-r--r--src/commands/info/color.ts42
1 files changed, 42 insertions, 0 deletions
diff --git a/src/commands/info/color.ts b/src/commands/info/color.ts
new file mode 100644
index 0000000..4db20e7
--- /dev/null
+++ b/src/commands/info/color.ts
@@ -0,0 +1,42 @@
+import { BushCommand, BushMessage, BushSlashMessage } from '@lib';
+import { Constants } from 'discord-akairo';
+import { ColorResolvable, MessageEmbed } from 'discord.js';
+
+export default class ColorCommand extends BushCommand {
+ public constructor() {
+ super('color', {
+ aliases: ['color'],
+ category: 'info',
+ description: {
+ content: 'See what color a hex code is.',
+ usage: 'color <color>',
+ examples: ['color #0000FF']
+ },
+ args: [
+ {
+ id: 'color',
+ type: /^#?(?<code>[0-9A-F]{6})$/i,
+ match: Constants.ArgumentMatches.PHRASE,
+ prompt: {
+ start: 'What color value would you like to see the color of',
+ retry: '{error} Choose a valid hex color code.'
+ }
+ }
+ ],
+ channel: 'guild',
+ clientPermissions: ['EMBED_LINKS', 'SEND_MESSAGES']
+ });
+ }
+
+ public async exec(
+ message: BushMessage | BushSlashMessage,
+ { color: { match } }: { color: { match: RegExpMatchArray; matches: RegExpMatchArray[] } }
+ ): Promise<unknown> {
+ const embed = new MessageEmbed()
+ .addField('Hex', match.groups.code, false)
+ .addField('RGB', this.client.util.hexToRgb(match.groups.code), false)
+ .setColor(match.groups.code as ColorResolvable);
+
+ return await message.util.reply({ embeds: [embed] });
+ }
+}