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 | |
| parent | de4c3dcaf172804d34ae708be1ed3e75af42f4d5 (diff) | |
| download | tanzanite-453683b57b8ff013ff25e2aaa4aa1d2e047edcb7.tar.gz tanzanite-453683b57b8ff013ff25e2aaa4aa1d2e047edcb7.tar.bz2 tanzanite-453683b57b8ff013ff25e2aaa4aa1d2e047edcb7.zip | |
a few small changes
Diffstat (limited to 'src/commands')
72 files changed, 1286 insertions, 1521 deletions
diff --git a/src/commands/_fake-command/ironmoon.ts b/src/commands/_fake-command/ironmoon.ts index b13d1d3..428b554 100644 --- a/src/commands/_fake-command/ironmoon.ts +++ b/src/commands/_fake-command/ironmoon.ts @@ -4,7 +4,9 @@ export default class IronmoonCommand extends BushCommand { public constructor() { super('ironmoon', { category: 'fake-commands', - description: { content: '', examples: [''], usage: [''] }, + description: '', + examples: [''], + usage: [''], pseudo: true, clientPermissions: [], userPermissions: [] diff --git a/src/commands/admin/channelPermissions.ts b/src/commands/admin/channelPermissions.ts index befa3ea..b44ae21 100644 --- a/src/commands/admin/channelPermissions.ts +++ b/src/commands/admin/channelPermissions.ts @@ -7,79 +7,50 @@ export default class ChannelPermissionsCommand extends BushCommand { aliases: ['channel-perms', 'cperms', 'cperm', 'chanperms', 'chanperm', 'channel-permissions'], category: 'admin', typing: true, - description: { - content: 'Use to mass change the channel permissions.', - usage: ['channel-perms <role_id> <perm> <state>'], - examples: ['channel-perms 783794633129197589 read_messages deny'] - }, + description: 'Use to mass change the channel permissions.', + usage: ['channel-perms <role_id> <perm> <state>'], + examples: ['channel-perms 783794633129197589 read_messages deny'], args: [ { id: 'target', - customType: util.arg.union('member', 'member'), - prompt: { - start: 'What user/role would you like to change?', - retry: '{error} Choose a valid user/role to change.' - } + description: 'The user/role to change the permissions of.', + customType: util.arg.union('member', 'role'), + readableType: 'member|role', + prompt: 'What user/role would you like to change?', + retry: '{error} Choose a valid user/role to change.', + slashType: 'MENTIONABLE' }, { id: 'permission', + description: 'The permission to change for the target user/role.', type: 'permission', - prompt: { - start: 'What permission would you like to change?', - retry: '{error} Choose a valid permission.' - } + prompt: 'What permission would you like to change?', + retry: '{error} Choose a valid permission.', + slashType: 'STRING' }, { id: 'state', + description: 'The state that the permission should be set to for the target.', customType: [ ['true', '1', 'yes', 'enable', 'allow'], ['false', '0', 'no', 'disable', 'disallow', 'deny'], ['neutral', 'remove', 'none'] ], - prompt: { - start: 'What should that permission be set to?', - retry: '{error} Set the state to either `enable`, `disable`, or `remove`.' - } + readableType: "'enable'|'disable'|'remove'", + prompt: 'What should that permission be set to?', + retry: '{error} Set the state to either `enable`, `disable`, or `remove`.', + slashType: 'STRING', + choices: [ + { name: 'Enabled', value: 'true' }, + { name: 'Disabled', value: 'false' }, + { name: 'Neutral', value: 'neutral' } + ] } ], clientPermissions: (m) => util.clientSendAndPermCheck(m, ['MANAGE_CHANNELS']), userPermissions: ['ADMINISTRATOR'], channel: 'guild', - slash: true, - slashOptions: [ - { - name: 'target', - description: 'What user/role would you like to change?', - type: 'MENTIONABLE', - required: true - }, - { - name: 'permission', - description: 'What permission would you like to change?', - type: 'STRING', - required: true - }, - { - name: 'state', - description: 'What should that permission be set to?', - type: 'STRING', - choices: [ - { - name: 'Enabled', - value: 'true' - }, - { - name: 'Disabled', - value: 'false' - }, - { - name: 'Neutral', - value: 'neutral' - } - ], - required: true - } - ] + slash: true }); } diff --git a/src/commands/admin/roleAll.ts b/src/commands/admin/roleAll.ts index 3c6b629..585e6cc 100644 --- a/src/commands/admin/roleAll.ts +++ b/src/commands/admin/roleAll.ts @@ -6,46 +6,34 @@ export default class RoleAllCommand extends BushCommand { super('roleAll', { aliases: ['role-all', 'rall'], category: 'admin', - description: { - content: 'Give a role to every member on the server.', - usage: ['role-all <role> [--bots]'], - examples: ['role-all 783794633129197589 --bots'] - }, + description: 'Give a role to every member on the server.', + usage: ['role-all <role> [--bots]'], + examples: ['role-all 783794633129197589 --bots'], args: [ { id: 'role', + description: 'The role to assigned to every member on the server.', type: 'role', - prompt: { - start: 'What role would you like to give to every member on the server?', - retry: '{error} Pick a valid role.' - } + prompt: 'What role would you like to give to every member on the server?', + retry: '{error} Pick a valid role.', + slashType: 'ROLE' }, { id: 'bots', + description: 'Also give the role to bots.', match: 'flag', + prompt: 'Would you like to also give roles to bots?', flag: '--bots', - default: false + default: false, + slashType: 'BOOLEAN', + optional: true } ], channel: 'guild', clientPermissions: (m) => util.clientSendAndPermCheck(m, ['MANAGE_ROLES']), userPermissions: ['ADMINISTRATOR'], typing: true, - slash: true, - slashOptions: [ - { - name: 'role', - description: 'What role would you like to give to every member on the server?', - type: 'ROLE', - required: true - }, - { - name: 'bots', - description: 'Would you like to also give roles to bots?', - type: 'BOOLEAN', - required: false - } - ] + slash: true }); } diff --git a/src/commands/config/blacklist.ts b/src/commands/config/blacklist.ts index f0173a4..8bb778c 100644 --- a/src/commands/config/blacklist.ts +++ b/src/commands/config/blacklist.ts @@ -6,45 +6,43 @@ export default class BlacklistCommand extends BushCommand { super('blacklist', { aliases: ['blacklist', 'unblacklist'], category: 'config', - description: { - content: 'A command to blacklist users and channels.', - usage: ['blacklist|unblacklist <user|channel>'], - examples: ['blacklist @user', 'unblacklist #channel'] - }, + description: 'A command to blacklist users and channels.', + usage: ['blacklist|unblacklist <user|channel>'], + examples: ['blacklist @user', 'unblacklist #channel'], args: [ { + id: 'action', + description: 'Whether to blacklist or unblacklist the target.', + readableType: "'blacklist'|'unblacklist'", + prompt: 'Would you like to add or remove someone or something from/to the blacklist?', + slashType: 'STRING', + choices: [ + { name: 'blacklist', value: 'blacklist' }, + { name: 'unblacklist', value: 'unblacklist' } + ], + only: 'slash' + }, + { id: 'target', + description: 'The channel/user to blacklist.', customType: util.arg.union('channel', 'user'), - prompt: { - start: 'What channel or user that you would like to blacklist/unblacklist?', - retry: '{error} Pick a valid user or channel.' - } + readableType: 'channel|user', + prompt: 'What channel or user that you would like to blacklist/unblacklist?', + retry: '{error} Pick a valid user or channel.', + slashType: 'STRING' }, { id: 'global', + description: 'Blacklist the target globally.', match: 'flag', - flag: '--global' + flag: '--global', + optional: true, + slashType: false, + only: 'text', + ownerOnly: true } ], slash: true, - slashOptions: [ - { - name: 'action', - description: 'Would you like to add or remove someone or something from/to the blacklist?', - type: 'STRING', - choices: [ - { name: 'blacklist', value: 'blacklist' }, - { name: 'unblacklist', value: 'unblacklist' } - ], - required: true - }, - { - name: 'target', - description: 'What channel or user that you would like to blacklist/unblacklist?', - type: 'STRING', - required: true - } - ], channel: 'guild', clientPermissions: (m) => util.clientSendAndPermCheck(m), userPermissions: ['MANAGE_GUILD'] @@ -82,14 +80,14 @@ export default class BlacklistCommand extends BushCommand { .catch(() => false); if (!success) return await message.util.reply({ - content: `${util.emojis.error} There was an error globally ${action}ing ${util.format.bold( + content: `${util.emojis.error} There was an error globally ${action}ing ${util.format.input( target?.tag ?? target.name )}.`, allowedMentions: AllowedMentions.none() }); else return await message.util.reply({ - content: `${util.emojis.success} Successfully ${action}ed ${util.format.bold(target?.tag ?? target.name)} globally.`, + content: `${util.emojis.success} Successfully ${action}ed ${util.format.input(target?.tag ?? target.name)} globally.`, allowedMentions: AllowedMentions.none() }); // guild disable @@ -110,12 +108,12 @@ export default class BlacklistCommand extends BushCommand { .catch(() => false); if (!success) return await message.util.reply({ - content: `${util.emojis.error} There was an error ${action}ing ${util.format.bold(target?.tag ?? target.name)}.`, + content: `${util.emojis.error} There was an error ${action}ing ${util.format.input(target?.tag ?? target.name)}.`, allowedMentions: AllowedMentions.none() }); else return await message.util.reply({ - content: `${util.emojis.success} Successfully ${action}ed ${util.format.bold(target?.tag ?? target.name)}.`, + content: `${util.emojis.success} Successfully ${action}ed ${util.format.input(target?.tag ?? target.name)}.`, allowedMentions: AllowedMentions.none() }); } diff --git a/src/commands/config/config.ts b/src/commands/config/config.ts index 2ce4246..6af5895 100644 --- a/src/commands/config/config.ts +++ b/src/commands/config/config.ts @@ -22,15 +22,11 @@ export default class SettingsCommand extends BushCommand { super('config', { aliases: ['config', 'settings', 'setting', 'configure'], category: 'config', - description: { - content: 'Configure server settings.', - usage: [ - `settings (${settingsArr.map((s) => `\`${s}\``).join(', ')}) (${['view', 'set', 'add', 'remove'].map( - (s) => `\`${s}\`` - )})` - ], - examples: ['settings', 'config prefix set -'] - }, + description: 'Configure server settings.', + usage: [ + `settings (${settingsArr.map((s) => `\`${s}\``).join(', ')}) (${['view', 'set', 'add', 'remove'].map((s) => `\`${s}\``)})` + ], + examples: ['settings', 'config prefix set -'], slash: true, slashOptions: settingsArr.map((setting) => { return { diff --git a/src/commands/config/customAutomodPhrases.ts b/src/commands/config/customAutomodPhrases.ts index 9fbebf5..cf37595 100644 --- a/src/commands/config/customAutomodPhrases.ts +++ b/src/commands/config/customAutomodPhrases.ts @@ -5,11 +5,9 @@ // super('customAutomodPhrases', { // aliases: ['custom-automod-phrases'], // category: 'config', -// description: { -// content: 'Configure additional phrases to be used for automod.', -// usage: ['custom-automod-phrases <requiredArg> [optionalArg]'], -// examples: ['custom-automod-phrases 1 2'] -// }, +// description: 'Configure additional phrases to be used for automod.', +// usage: ['custom-automod-phrases <requiredArg> [optionalArg]'], +// examples: ['custom-automod-phrases 1 2'], // args: [ // { // id: 'required_argument', diff --git a/src/commands/config/disable.ts b/src/commands/config/disable.ts index 83b4608..333ae19 100644 --- a/src/commands/config/disable.ts +++ b/src/commands/config/disable.ts @@ -5,52 +5,40 @@ export default class DisableCommand extends BushCommand { super('disable', { aliases: ['disable', 'enable'], category: 'config', - description: { - content: 'A command to disable and enable commands.', - usage: ['disable|enable <command>'], - examples: ['enable ban', 'disable kick'] - }, + description: 'A command to disable and enable commands.', + usage: ['disable|enable <command>'], + examples: ['enable ban', 'disable kick'], args: [ { + id: 'action', + description: 'Whether to disable or enable the command.', + readableType: "'blacklist'|'unblacklist", + prompt: 'Would you like to disable or enable a command?', + slashType: 'STRING', + choices: ['blacklist', 'unblacklist'].map((v) => ({ name: v, value: v })), + only: 'slash' + }, + { id: 'command', + description: 'The command to disable/enable.', customType: util.arg.union('commandAlias', 'command'), - prompt: { - start: 'What command would you like to enable/disable?', - retry: '{error} Pick a valid command.', - optional: false - } + readableType: 'command|commandAlias', + prompt: 'What command would you like to enable/disable?', + retry: '{error} Pick a valid command.', + slashType: 'STRING' }, { id: 'global', + description: 'Disable the command globally.', match: 'flag', - flag: '--global' + flag: '--global', + optional: true, + slashType: false, + only: 'text', + ownerOnly: true } ], slash: true, - slashOptions: [ - { - name: 'action', - description: 'Would you like to disable or enable a command?', - type: 'STRING', - choices: [ - { - name: 'enable', - value: 'enable' - }, - { - name: 'disable', - value: 'disable' - } - ], - required: true - }, - { - name: 'command', - description: 'What command would you like to enable/disable?', - type: 'STRING', - required: true - } - ], channel: 'guild', clientPermissions: (m) => util.clientSendAndPermCheck(m), userPermissions: ['MANAGE_GUILD'] @@ -67,57 +55,31 @@ export default class DisableCommand extends BushCommand { const global = args.global && message.author.isOwner(); const commandID = (args.command as BushCommand).id; - if (global) { - if (action === 'toggle') { - const disabledCommands = ( - (await Global.findByPk(client.config.environment)) ?? (await Global.create({ environment: client.config.environment })) - ).disabledCommands; - action = disabledCommands.includes(commandID) ? 'disable' : 'enable'; - } - const success = await util - .insertOrRemoveFromGlobal(action === 'disable' ? 'remove' : 'add', 'disabledCommands', commandID) - .catch(() => false); - if (!success) - return await message.util.reply({ - content: `${util.emojis.error} There was an error globally **${action.substring( - 0, - action.length - 2 - )}ing** the **${commandID}** command.`, - allowedMentions: AllowedMentions.none() - }); - else - return await message.util.reply({ - content: `${util.emojis.success} Successfully **${action.substring( - 0, - action.length - 2 - )}ed** the **${commandID}** command globally.`, - allowedMentions: AllowedMentions.none() - }); + const disabledCommands = global + ? ((await Global.findByPk(client.config.environment)) ?? (await Global.create({ environment: client.config.environment }))) + .disabledCommands + : await message.guild!.getSetting('disabledCommands'); - // guild disable - } else { - const disabledCommands = await message |
