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 | |
| parent | de4c3dcaf172804d34ae708be1ed3e75af42f4d5 (diff) | |
| download | tanzanite-453683b57b8ff013ff25e2aaa4aa1d2e047edcb7.tar.gz tanzanite-453683b57b8ff013ff25e2aaa4aa1d2e047edcb7.tar.bz2 tanzanite-453683b57b8ff013ff25e2aaa4aa1d2e047edcb7.zip | |
a few small changes
Diffstat (limited to 'src')
90 files changed, 2150 insertions, 1955 deletions
diff --git a/src/arguments/messageLink.ts b/src/arguments/messageLink.ts new file mode 100644 index 0000000..d270abd --- /dev/null +++ b/src/arguments/messageLink.ts @@ -0,0 +1,19 @@ +import { type BushArgumentTypeCaster } from '../lib'; + +export const messageLink: BushArgumentTypeCaster = async (_, phrase) => { + const match = client.consts.regex.messageLink.exec(phrase); + if (!match || !match.groups) return null; + + const { guild_id, channel_id, message_id } = match.groups; + + if (!guild_id || !channel_id || message_id) return null; + + const guild = client.guilds.cache.get(guild_id); + if (!guild) return null; + + const channel = guild.channels.cache.get(channel_id); + if (!channel || (!channel.isText() && !channel.isThread())) return null; + + const message = await channel.messages.fetch(message_id).catch(() => null); + return message; +}; 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'], |
