diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-11-28 09:27:41 -0500 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-11-28 09:27:41 -0500 |
commit | 453683b57b8ff013ff25e2aaa4aa1d2e047edcb7 (patch) | |
tree | 8b98d2f30dbb6a8448602446cfacf9091667cc33 /src/commands/dev | |
parent | de4c3dcaf172804d34ae708be1ed3e75af42f4d5 (diff) | |
download | tanzanite-453683b57b8ff013ff25e2aaa4aa1d2e047edcb7.tar.gz tanzanite-453683b57b8ff013ff25e2aaa4aa1d2e047edcb7.tar.bz2 tanzanite-453683b57b8ff013ff25e2aaa4aa1d2e047edcb7.zip |
a few small changes
Diffstat (limited to 'src/commands/dev')
-rw-r--r-- | src/commands/dev/__template.ts | 41 | ||||
-rw-r--r-- | src/commands/dev/dm.ts | 46 | ||||
-rw-r--r-- | src/commands/dev/eval.ts | 103 | ||||
-rw-r--r-- | src/commands/dev/javascript.ts | 30 | ||||
-rw-r--r-- | src/commands/dev/reload.ts | 22 | ||||
-rw-r--r-- | src/commands/dev/say.ts | 14 | ||||
-rw-r--r-- | src/commands/dev/servers.ts | 10 | ||||
-rw-r--r-- | src/commands/dev/sh.ts | 16 | ||||
-rw-r--r-- | src/commands/dev/superUser.ts | 25 | ||||
-rw-r--r-- | src/commands/dev/test.ts | 19 |
10 files changed, 207 insertions, 119 deletions
diff --git a/src/commands/dev/__template.ts b/src/commands/dev/__template.ts index fe685ff..5bb29c8 100644 --- a/src/commands/dev/__template.ts +++ b/src/commands/dev/__template.ts @@ -5,46 +5,29 @@ export default class TemplateCommand extends BushCommand { super('template', { aliases: ['template'], category: 'template', - description: { - content: 'Command description.', - usage: ['template <requiredArg> [optionalArg]'], - examples: ['template 1 2'] - }, + description: 'Command description.', + usage: ['template <requiredArg> [optionalArg]'], + examples: ['template 1 2'], args: [ { id: 'required_argument', type: 'string', - prompt: { - start: 'What would you like to set your first argument to be?', - retry: '{error} Pick a valid argument.', - optional: false - } + description: 'This is the first argument.', + prompt: 'What would you like to set your first argument to be?', + retry: '{error} Pick a valid argument.', + slashType: 'STRING' }, { id: 'optional_argument', type: 'string', - prompt: { - start: 'What would you like to set your second argument to be?', - retry: '{error} Pick a valid argument.', - optional: true - } + description: 'This is the second argument.', + prompt: 'What would you like to set your second argument to be?', + retry: '{error} Pick a valid argument.', + optional: true, + slashType: 'STRING' } ], slash: false, //set this to true - slashOptions: [ - { - name: 'required_argument', - description: 'What would you like to set your first argument to be?', - type: 'STRING', - required: true - }, - { - name: 'optional_argument', - description: 'What would you like to set your second argument to be?', - type: 'STRING', - required: false - } - ], superUserOnly: true, ownerOnly: true, channel: 'guild', diff --git a/src/commands/dev/dm.ts b/src/commands/dev/dm.ts new file mode 100644 index 0000000..5031dfd --- /dev/null +++ b/src/commands/dev/dm.ts @@ -0,0 +1,46 @@ +import { BushCommand, BushUser, type BushMessage, type BushSlashMessage } from '#lib'; + +export default class DMCommand extends BushCommand { + public constructor() { + super('dm', { + aliases: ['dm'], + category: 'dev', + description: 'Send a direct message to a specified user from the bot.', + usage: ['dm <user> <content>'], + examples: ['dm IRONM00N hi'], + args: [ + { + id: 'user', + type: 'string', + description: 'The user to send the dm to.', + prompt: 'Who would you like to dm?', + retry: '{error} Pick a valid user to send a dm to.', + slashType: 'STRING' + }, + { + id: 'content', + type: 'string', + description: 'This is the second argument.', + prompt: 'What would you like to set your second argument to be?', + retry: '{error} Pick a valid argument.', + optional: true, + slashType: 'STRING' + } + ], + slash: false, + ownerOnly: true, + hidden: true, + clientPermissions: (m) => util.clientSendAndPermCheck(m), + userPermissions: [] + }); + } + public override async exec(message: BushMessage | BushSlashMessage, args: { user: BushUser; content: string }) { + try { + const u = await client.users.fetch(args.user.id); + await u.send(args.content); + } catch (e) { + return message.util.reply(`${util.emojis.error} There was an error sending ${util.format.input(args.user.tag)} a dm.`); + } + return message.util.reply(`${util.emojis.success} Successfully sent ${util.format.input(args.user.tag)} a dm.`); + } +} diff --git a/src/commands/dev/eval.ts b/src/commands/dev/eval.ts index b82534c..5b30d96 100644 --- a/src/commands/dev/eval.ts +++ b/src/commands/dev/eval.ts @@ -11,42 +11,95 @@ export default class EvalCommand extends BushCommand { super('eval', { aliases: ['eval', 'ev', 'evaluate'], category: 'dev', - description: { - content: 'Evaluate code.', - usage: ['eval <code> [--depth #] [--sudo] [--silent] [--delete] [--proto] [--hidden] [--ts]'], - examples: ['eval message.channel.delete()'] - }, + description: 'Evaluate code.', + usage: ['eval <code> [--depth #] [--sudo] [--silent] [--delete] [--proto] [--hidden] [--ts]'], + examples: ['eval message.channel.delete()'], args: [ - { id: 'sel_depth', match: 'option', type: 'integer', flag: '--depth', default: 0 }, - { id: 'sudo', match: 'flag', flag: '--sudo' }, - { id: 'delete_msg', match: 'flag', flag: '--delete' }, - { id: 'silent', match: 'flag', flag: '--silent' }, - { id: 'typescript', match: 'flag', flag: '--ts' }, - { id: 'hidden', match: 'flag', flag: '--hidden' }, - { id: 'show_proto', match: 'flag', flag: '--proto' }, + { + id: 'sel_depth', + description: 'How deep to inspect the output.', + match: 'option', + type: 'integer', + flag: '--depth', + default: 0, + prompt: 'How deep would you like to inspect the output?', + slashType: 'INTEGER', + optional: true + }, + { + id: 'sudo', + description: 'Whether or not to override checks.', + match: 'flag', + flag: '--sudo', + prompt: 'Would you like to override checks?', + slashType: 'BOOLEAN', + optional: true + }, + { + id: 'delete_msg', + description: 'Whether or not to delete the message that invoked the command.', + match: 'flag', + flag: '--delete', + prompt: 'Would you like to delete the message that invoked the command?', + slashType: false, + optional: true, + only: 'text' + }, + { + id: 'silent', + description: 'Whether or not to make the response silent', + match: 'flag', + flag: '--silent', + prompt: 'Would you like to make the response silent?', + slashType: 'BOOLEAN', + optional: true + }, + { + id: 'typescript', + description: 'Whether or not to treat the code as typescript and transpile it.', + match: 'flag', + flag: '--ts', + prompt: 'Is this code written in typescript?', + slashType: 'BOOLEAN', + optional: true + }, + { + id: 'hidden', + description: 'Whether or not to show hidden items.', + match: 'flag', + flag: '--hidden', + prompt: 'Would you like to show hidden items?', + slashType: 'BOOLEAN', + optional: true + }, + { + id: 'show_proto', + description: 'Whether or not to show the prototype of the output.', + match: 'flag', + flag: '--proto', + prompt: 'Would you like to show the prototype of the output?', + slashType: 'BOOLEAN', + optional: true + }, { id: 'show_methods', + description: 'Whether or not to inspect the prototype chain for methods.', match: 'flag', - flag: ['--func', '--function', '--functions', '--meth', '--method', '--methods'] + flag: ['--func', '--function', '--functions', '--meth', '--method', '--methods'], + prompt: 'Would you like to inspect the prototype chain to find methods?', + slashType: 'BOOLEAN', + optional: true }, { id: 'code', + description: 'The code you would like to evaluate.', match: 'rest', - type: 'string', - prompt: { start: 'What would you like to eval?', retry: '{error} Invalid code to eval.' } + prompt: 'What would you like to eval?', + retry: '{error} Invalid code to eval.', + slashType: 'STRING' } ], slash: true, - slashOptions: [ - { name: 'code', description: 'The code you would like to evaluate.', type: 'STRING', required: true }, - { name: 'sel_depth', description: 'How deep to display the output.', type: 'INTEGER', required: false }, - { name: 'sudo', description: 'Whether or not to override checks.', type: 'BOOLEAN', required: false }, - { name: 'silent', description: 'Whether or not to make the response silent', type: 'BOOLEAN', required: false }, - { name: 'typescript', description: 'Whether or not the code is typescript.', type: 'BOOLEAN', required: false }, - { name: 'hidden', description: 'Whether or not to show hidden items.', type: 'BOOLEAN', required: false }, - { name: 'show_proto', description: 'Show prototype.', type: 'BOOLEAN', required: false }, - { name: 'show_methods', description: 'Show class functions.', type: 'BOOLEAN', required: false } - ], ownerOnly: true, clientPermissions: (m) => util.clientSendAndPermCheck(m), userPermissions: [] diff --git a/src/commands/dev/javascript.ts b/src/commands/dev/javascript.ts index 8a47b23..5173cd1 100644 --- a/src/commands/dev/javascript.ts +++ b/src/commands/dev/javascript.ts @@ -7,25 +7,31 @@ export default class JavascriptCommand extends BushCommand { super('javascript', { aliases: ['javascript', 'js'], category: 'dev', - description: { - content: 'Evaluate code in a sand boxed environment.', - usage: ['javascript <code> [--depth #]'], - examples: ['javascript 9+10'] - }, + description: 'Evaluate code in a sand boxed environment.', + usage: ['javascript <code> [--depth #]'], + examples: ['javascript 9+10'], args: [ - { id: 'sel_depth', match: 'option', type: 'integer', flag: '--depth', default: 0 }, + { + id: 'sel_depth', + description: 'How deep to inspect the output.', + match: 'option', + type: 'integer', + flag: '--depth', + default: 0, + prompt: 'How deep would you like to inspect the output?', + slashType: 'INTEGER', + optional: true + }, { id: 'code', + description: 'The code you would like to run in a sand boxed environment.', match: 'rest', - type: 'string', - prompt: { start: 'What would you like to eval?', retry: '{error} Invalid code to eval.' } + prompt: 'What code would you like to run in a sand boxed environment?', + retry: '{error} Invalid code to run in a sand boxed environment.', + slashType: 'STRING' } ], slash: true, - slashOptions: [ - { name: 'code', description: 'The code you would like to evaluate.', type: 'STRING', required: true }, - { name: 'sel_depth', description: 'How deep to display the output.', type: 'INTEGER', required: false } - ], superUserOnly: true, clientPermissions: (m) => util.clientSendAndPermCheck(m), userPermissions: [] diff --git a/src/commands/dev/reload.ts b/src/commands/dev/reload.ts index f9b1867..6d030b7 100644 --- a/src/commands/dev/reload.ts +++ b/src/commands/dev/reload.ts @@ -5,29 +5,23 @@ export default class ReloadCommand extends BushCommand { super('reload', { aliases: ['reload'], category: 'dev', - description: { - content: 'Reloads the bot', - usage: ['reload'], - examples: ['reload'] - }, + description: 'Reloads the bot', + usage: ['reload'], + examples: ['reload'], // args: [ // { // id: 'fast', + // description: 'Whether or not to use esbuild for fast compiling.', // match: 'flag', - // flag: '--fast' + // flag: '--fast', + // prompt: 'Would you like to use esbuild for fast compiling?', + // optional: true, + // slashType:'BOOLEAN' // } // ], ownerOnly: true, typing: true, slash: true, - // slashOptions: [ - // { - // name: 'fast', - // description: 'Whether to use esbuild for fast compiling or not', - // type: 'BOOLEAN', - // required: false - // } - // ], clientPermissions: (m) => util.clientSendAndPermCheck(m), userPermissions: [] }); diff --git a/src/commands/dev/say.ts b/src/commands/dev/say.ts index 400a132..80cbbe2 100644 --- a/src/commands/dev/say.ts +++ b/src/commands/dev/say.ts @@ -5,20 +5,20 @@ export default class SayCommand extends BushCommand { super('say', { aliases: ['say'], category: 'dev', - description: { - content: 'A command make the bot say something.', - usage: ['say <message>'], - examples: ['say hello'] - }, + description: 'A command make the bot say something.', + usage: ['say <content>'], + examples: ['say hello'], args: [ { id: 'content', + description: 'The content of the message to send.', type: 'string', match: 'rest', - prompt: { start: 'What would you like the bot to say?', retry: '{error} Choose something valid to say.' } + prompt: 'What would you like the bot to say?', + retry: '{error} Choose something for the bot to send.', + slashType: 'STRING' } ], - slashOptions: [{ name: 'content', description: 'What would you like the bot to say?', type: 'STRING' }], ownerOnly: true, clientPermissions: (m) => util.clientSendAndPermCheck(m), userPermissions: [], diff --git a/src/commands/dev/servers.ts b/src/commands/dev/servers.ts index e8a2fe4..308d1db 100644 --- a/src/commands/dev/servers.ts +++ b/src/commands/dev/servers.ts @@ -6,11 +6,9 @@ export default class ServersCommand extends BushCommand { super('servers', { aliases: ['servers', 'guilds'], category: 'dev', - description: { - content: 'Displays all the severs the bot is in', - usage: ['servers'], - examples: ['servers'] - }, + description: 'Displays all the severs the bot is in', + usage: ['servers'], + examples: ['servers'], clientPermissions: (m) => util.clientSendAndPermCheck(m), userPermissions: [], ownerOnly: true @@ -25,7 +23,7 @@ export default class ServersCommand extends BushCommand { title: `Server List [\`${guilds.length.toLocaleString()}\`]`, color: util.colors.default, fields: chunk.map((guild) => ({ - name: util.format.bold(guild.name), + name: util.format.input(guild.name), value: [ `**ID:** ${guild.id}`, `**Owner:** ${client.users.cache.has(guild.ownerId) ? client.users.cache.get(guild.ownerId)!.tag : guild.ownerId}`, diff --git a/src/commands/dev/sh.ts b/src/commands/dev/sh.ts index 83432f4..5ef72b1 100644 --- a/src/commands/dev/sh.ts +++ b/src/commands/dev/sh.ts @@ -17,20 +17,18 @@ export default class ShCommand extends BushCommand { super('sh', { aliases: ['sh', 'shell', 'cmd'], category: 'dev', - description: { - content: 'Run shell commands.', - usage: ['sh <command>'], - examples: ['sh git pull'] - }, + description: 'Run shell commands.', + usage: ['sh <command>'], + examples: ['sh git pull'], args: [ { id: 'command', + description: 'The content you would like to run as a shell command.', type: 'string', match: 'rest', - prompt: { - start: 'What would you like run', - retry: '{error} Invalid command to run.' - } + prompt: 'What would you like run', + retry: '{error} Invalid command to run.', + slashType: 'STRING' } ], ownerOnly: true, diff --git a/src/commands/dev/superUser.ts b/src/commands/dev/superUser.ts index 17d81ac..e0328db 100644 --- a/src/commands/dev/superUser.ts +++ b/src/commands/dev/superUser.ts @@ -7,14 +7,27 @@ export default class SuperUserCommand extends BushCommand { super('superuser', { aliases: ['superuser', 'su'], category: 'dev', - description: { - content: 'A command to manage superusers.', - usage: ['superuser <add/remove> <user>'], - examples: ['superuser add IRONM00N'] - }, + description: 'A command to manage superusers.', + usage: ['superuser <add/remove> <user>'], + examples: ['superuser add IRONM00N'], clientPermissions: (m) => util.clientSendAndPermCheck(m), userPermissions: [], - ownerOnly: true + ownerOnly: true, + helpArgs: [ + { + id: 'action', + description: 'Whether to add or remove a user from the superuser list.', + readableType: 'add|remove', + slashType: false + }, + { + id: 'user', + description: 'The user to add/remove from the superuser list.', + type: 'user', + match: 'restContent', + slashType: false + } + ] }); } diff --git a/src/commands/dev/test.ts b/src/commands/dev/test.ts index 83dd592..f3ac627 100644 --- a/src/commands/dev/test.ts +++ b/src/commands/dev/test.ts @@ -13,21 +13,18 @@ export default class TestCommand extends BushCommand { super('test', { aliases: ['test'], category: 'dev', - description: { - content: 'A command to stuff.', - usage: ['test [feature]'], - examples: ['test lots of buttons', 'test buttons'] - }, + description: 'A command to test stuff.', + usage: ['test [feature]'], + examples: ['test lots of buttons', 'test buttons'], args: [ { id: 'feature', - type: 'string', + description: 'The feature to test.', match: 'rest', - prompt: { - start: 'start prompt', - retry: 'retry prompt', - optional: true - } + prompt: 'start prompt', + retry: 'retry prompt', + optional: true, + slashType: false } ], superUserOnly: true, |