diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-07-30 19:38:16 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2021-07-30 19:38:16 -0400 |
commit | 70fac30661ee06b07baceed6e44880b16e244626 (patch) | |
tree | 44b4c573043fc369ba9c79ef368da2f08f34e442 /src/commands | |
parent | f5c2b7b946487c2828365cc63bc6f471dd6cfc2f (diff) | |
download | tanzanite-70fac30661ee06b07baceed6e44880b16e244626.tar.gz tanzanite-70fac30661ee06b07baceed6e44880b16e244626.tar.bz2 tanzanite-70fac30661ee06b07baceed6e44880b16e244626.zip |
general clean up and fix automod
Diffstat (limited to 'src/commands')
28 files changed, 43 insertions, 74 deletions
diff --git a/src/commands/admin/channelPermissions.ts b/src/commands/admin/channelPermissions.ts index 08d0068..1cc44ca 100644 --- a/src/commands/admin/channelPermissions.ts +++ b/src/commands/admin/channelPermissions.ts @@ -1,4 +1,3 @@ -import { Argument, Constants } from 'discord-akairo'; import { GuildChannel, GuildMember, MessageEmbed, Role } from 'discord.js'; import { BushCommand, BushMessage } from '../../lib'; @@ -16,8 +15,7 @@ export default class ChannelPermissionsCommand extends BushCommand { args: [ { id: 'target', - type: Argument.union(Constants.ArgumentTypes.ROLE, Constants.ArgumentTypes.MEMBER), - match: Constants.ArgumentMatches.PHRASE, + customType: util.arg.union('member', 'member'), prompt: { start: 'What user/role would you like to change?', retry: 'Invalid response. What user/role would you like to change?' @@ -26,7 +24,6 @@ export default class ChannelPermissionsCommand extends BushCommand { { id: 'permission', type: 'permission', - match: Constants.ArgumentMatches.PHRASE, prompt: { start: 'What permission would you like to change?', retry: '{error} Choose a valid permission.' @@ -34,12 +31,11 @@ export default class ChannelPermissionsCommand extends BushCommand { }, { id: 'state', - type: [ + customType: [ ['true', '1', 'yes', 'enable', 'allow'], ['false', '0', 'no', 'disable', 'disallow', 'deny'], ['neutral', 'remove', 'none'] ], - match: Constants.ArgumentMatches.PHRASE, prompt: { start: 'What should that permission be set to?', retry: '{error} Set the state to either `enable`, `disable`, or `remove`.' diff --git a/src/commands/config/blacklist.ts b/src/commands/config/blacklist.ts index 8093d83..150a1b7 100644 --- a/src/commands/config/blacklist.ts +++ b/src/commands/config/blacklist.ts @@ -15,8 +15,8 @@ export default class BlacklistCommand extends BushCommand { args: [ { id: 'target', - type: Argument.union('channel', 'user'), - match: 'phrase', + customType: Argument.union('channel', 'user'), + prompt: { start: 'What channel or user that you would like to blacklist/unblacklist?', retry: '{error} Pick a valid command.', diff --git a/src/commands/config/disable.ts b/src/commands/config/disable.ts index 41ca8a4..5d2e4dd 100644 --- a/src/commands/config/disable.ts +++ b/src/commands/config/disable.ts @@ -1,5 +1,4 @@ import { AllowedMentions, BushCommand, BushMessage, BushSlashMessage, Global } from '@lib'; -import { Argument } from 'discord-akairo'; export default class DisableCommand extends BushCommand { public constructor() { @@ -14,8 +13,7 @@ export default class DisableCommand extends BushCommand { args: [ { id: 'command', - type: Argument.union('commandAlias', 'command'), - match: 'phrase', + customType: util.arg.union('commandAlias', 'command'), prompt: { start: 'What command would you like to enable/disable?', retry: '{error} Pick a valid command.', diff --git a/src/commands/dev/__template.ts b/src/commands/dev/__template.ts index 1e65457..35c57db 100644 --- a/src/commands/dev/__template.ts +++ b/src/commands/dev/__template.ts @@ -14,7 +14,7 @@ export default class TemplateCommand extends BushCommand { { id: 'required_argument', type: 'string', - match: 'phrase', + prompt: { start: 'What would you like to set your first argument to be?', retry: '{error} Pick a valid argument.', @@ -24,7 +24,7 @@ export default class TemplateCommand extends BushCommand { { id: 'optional_argument', type: 'string', - match: 'phrase', + prompt: { start: 'What would you like to set your second argument to be?', retry: '{error} Pick a valid argument.', diff --git a/src/commands/dev/sh.ts b/src/commands/dev/sh.ts index ed1dfd7..b8c8379 100644 --- a/src/commands/dev/sh.ts +++ b/src/commands/dev/sh.ts @@ -1,7 +1,6 @@ import { BushCommand, BushMessage, BushSlashMessage } from '@lib'; import chalk from 'chalk'; import { exec } from 'child_process'; -import { Constants } from 'discord-akairo'; import { MessageEmbed, Util } from 'discord.js'; import { promisify } from 'util'; @@ -25,8 +24,8 @@ export default class ShCommand extends BushCommand { args: [ { id: 'command', - type: Constants.ArgumentTypes.STRING, - match: Constants.ArgumentMatches.REST, + type: 'string', + match: 'rest', prompt: { start: 'What would you like run', retry: '{error} Invalid command to run.' diff --git a/src/commands/dev/superUser.ts b/src/commands/dev/superUser.ts index 9071a8d..eade861 100644 --- a/src/commands/dev/superUser.ts +++ b/src/commands/dev/superUser.ts @@ -1,5 +1,4 @@ import { BushCommand, BushMessage, BushSlashMessage, Global } from '@lib'; -import { Constants } from 'discord-akairo'; import { User } from 'discord.js'; export default class SuperUserCommand extends BushCommand { @@ -20,7 +19,6 @@ export default class SuperUserCommand extends BushCommand { const action = yield { id: 'action', type: ['add', 'remove'], - match: Constants.ArgumentMatches.PHRASE, prompt: { start: 'Would you like to `add` or `remove` a user from the superuser list?', retry: '{error} Choose if you would like to `add` or `remove` a user.', @@ -29,8 +27,8 @@ export default class SuperUserCommand extends BushCommand { }; const user = yield { id: 'user', - type: Constants.ArgumentTypes.USER, - match: Constants.ArgumentMatches.REST_CONTENT, + type: 'user', + match: 'restContent', prompt: { start: `Who would you like to ${action || 'add/remove'} from the superuser list?`, retry: `Choose a valid user to ${action || 'add/remove'} from the superuser list.`, diff --git a/src/commands/dev/test.ts b/src/commands/dev/test.ts index 3a27be0..6b49dce 100644 --- a/src/commands/dev/test.ts +++ b/src/commands/dev/test.ts @@ -1,6 +1,5 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import { BushCommand, BushMessage } from '@lib'; -import { Constants } from 'discord-akairo'; import { Constants as jsConstants, MessageActionRow, MessageButton, MessageEmbed } from 'discord.js'; export default class TestCommand extends BushCommand { @@ -18,8 +17,8 @@ export default class TestCommand extends BushCommand { args: [ { id: 'feature', - type: Constants.ArgumentTypes.STRING, - match: Constants.ArgumentMatches.REST, + type: 'string', + match: 'rest', prompt: { start: 'start prompt', retry: 'retry prompt', diff --git a/src/commands/info/avatar.ts b/src/commands/info/avatar.ts index 4f7449b..eefdc02 100644 --- a/src/commands/info/avatar.ts +++ b/src/commands/info/avatar.ts @@ -1,4 +1,3 @@ -import { Constants } from 'discord-akairo'; import { MessageEmbed, User } from 'discord.js'; import { BushCommand, BushMessage, BushSlashMessage } from '../../lib'; @@ -15,8 +14,7 @@ export default class AvatarCommand extends BushCommand { args: [ { id: 'user', - type: Constants.ArgumentTypes.USER, - match: Constants.ArgumentMatches.PHRASE, + type: 'user', prompt: { start: 'Who would you like to see the avatar of?', retry: '{error} Choose a valid user.', diff --git a/src/commands/info/color.ts b/src/commands/info/color.ts index 61790ad..e995d79 100644 --- a/src/commands/info/color.ts +++ b/src/commands/info/color.ts @@ -24,7 +24,7 @@ export default class ColorCommand extends BushCommand { args: [ { id: 'color', - type: Argument.union(isValidTinyColor, 'role', 'member'), + customType: Argument.union(isValidTinyColor, 'role', 'member'), prompt: { start: 'What color code, role, or user would you like to find the color of?', retry: '{error} Choose a valid color, role, or member.' diff --git a/src/commands/info/guildInfo.ts b/src/commands/info/guildInfo.ts index 577086b..6ce4d76 100644 --- a/src/commands/info/guildInfo.ts +++ b/src/commands/info/guildInfo.ts @@ -1,4 +1,3 @@ -import { Argument, Constants } from 'discord-akairo'; import { BaseGuildVoiceChannel, Guild, GuildPreview, MessageEmbed, Snowflake, Vanity } from 'discord.js'; import { BushCommand, BushMessage, BushSlashMessage } from '../../lib'; @@ -15,8 +14,7 @@ export default class GuildInfoCommand extends BushCommand { args: [ { id: 'guild', - type: Argument.union(Constants.ArgumentTypes.GUILD, Constants.ArgumentTypes.BIGINT), - match: Constants.ArgumentMatches.PHRASE, + customType: util.arg.union('guild', 'bigint'), prompt: { start: 'What server would you like to find information about?', retry: '{error} Choose a valid server to find information about.', diff --git a/src/commands/info/userInfo.ts b/src/commands/info/userInfo.ts index e36e92b..cecf5ec 100644 --- a/src/commands/info/userInfo.ts +++ b/src/commands/info/userInfo.ts @@ -1,7 +1,7 @@ import { BushCommand, BushMessage, BushSlashMessage } from '@lib'; import { GuildMember, MessageEmbed } from 'discord.js'; -// TODO: Allow looking up a user not in the guild and not cached +// TODO: Allow looking up a user not in the guild and not cached (if possible) // TODO: Re-Implement Status Emojis // TODO: Add bot information export default class UserInfoCommand extends BushCommand { diff --git a/src/commands/moderation/_lockdown.ts b/src/commands/moderation/_lockdown.ts index db074b1..df5a9b4 100644 --- a/src/commands/moderation/_lockdown.ts +++ b/src/commands/moderation/_lockdown.ts @@ -13,7 +13,7 @@ export default class LockdownCommand extends BushCommand { args: [ { id: 'all', - type: 'flag', + match: 'flag', flag: '--all' } ], diff --git a/src/commands/moderation/ban.ts b/src/commands/moderation/ban.ts index 3736165..9239f2a 100644 --- a/src/commands/moderation/ban.ts +++ b/src/commands/moderation/ban.ts @@ -10,7 +10,7 @@ export default class BanCommand extends BushCommand { description: { content: 'Ban a member from the server.', usage: 'ban <member> <reason> [--delete ]', - examples: ['ban 322862723090219008 1 day commands in #general --delete 7'] + examples: ['ban ironm00n 1 day commands in #general --delete 7'] }, args: [ { @@ -35,7 +35,7 @@ export default class BanCommand extends BushCommand { id: 'days', flag: '--days', match: 'option', - type: Argument.range('integer', 0, 7, true), + customType: util.arg.range('integer', 0, 7, true), default: 0 }, { diff --git a/src/commands/moderation/modlog.ts b/src/commands/moderation/modlog.ts index c55b9a3..4850a4d 100644 --- a/src/commands/moderation/modlog.ts +++ b/src/commands/moderation/modlog.ts @@ -1,5 +1,4 @@ import { BushCommand, BushMessage, BushSlashMessage, BushUser, ModLog } from '@lib'; -import { Argument } from 'discord-akairo'; import { MessageEmbed, User } from 'discord.js'; export default class ModlogCommand extends BushCommand { @@ -15,7 +14,7 @@ export default class ModlogCommand extends BushCommand { args: [ { id: 'search', - type: Argument.union('user', 'string'), + customType: util.arg.union('user', 'string'), prompt: { start: 'What case id or user would you like to see?', retry: '{error} Choose a valid case id or user.' diff --git a/src/commands/moderation/mute.ts b/src/commands/moderation/mute.ts index 31cd233..7f3edbb 100644 --- a/src/commands/moderation/mute.ts +++ b/src/commands/moderation/mute.ts @@ -9,7 +9,7 @@ export default class MuteCommand extends BushCommand { description: { content: 'Mute a user.', usage: 'mute <member> [reason] [duration]', - examples: ['mute 322862723090219008 1 day commands in #general'] + examples: ['mute ironm00n 1 day commands in #general'] }, args: [ { diff --git a/src/commands/moderation/removeReactionEmoji.ts b/src/commands/moderation/removeReactionEmoji.ts index cb1be04..de5e8ce 100644 --- a/src/commands/moderation/removeReactionEmoji.ts +++ b/src/commands/moderation/removeReactionEmoji.ts @@ -1,5 +1,4 @@ import { BushCommand, BushMessage } from '@lib'; -import { Argument } from 'discord-akairo'; import { Emoji } from 'discord.js'; export default class RemoveReactionEmojiCommand extends BushCommand { @@ -25,7 +24,7 @@ export default class RemoveReactionEmojiCommand extends BushCommand { }, { id: 'emoji', - type: Argument.union('emoji', 'bigint'), + customType: util.arg.union('emoji', 'bigint'), match: 'restContent', prompt: { start: 'What emoji would you like to remove?', diff --git a/src/commands/moderation/role.ts b/src/commands/moderation/role.ts index fe8724d..bd8cf8d 100644 --- a/src/commands/moderation/role.ts +++ b/src/commands/moderation/role.ts @@ -14,7 +14,7 @@ export default class RoleCommand extends BushCommand { args: [ { id: 'action', - type: [['add'], ['remove']], + customType: [['add'], ['remove']], prompt: { start: 'Would you like to `add` or `remove` a role?', retry: '{error} Choose whether you would you like to `add` or `remove` a role.' diff --git a/src/commands/moderation/slowmode.ts b/src/commands/moderation/slowmode.ts index 9b0d300..441a0ac 100644 --- a/src/commands/moderation/slowmode.ts +++ b/src/commands/moderation/slowmode.ts @@ -15,7 +15,7 @@ export default class SlowModeCommand extends BushCommand { args: [ { id: 'length', - type: Argument.union('duration', 'off', 'none', 'disable'), + customType: Argument.union('duration', 'off', 'none', 'disable'), default: 0, prompt: { start: 'What would you like to set the slowmode to?', diff --git a/src/commands/moderation/warn.ts b/src/commands/moderation/warn.ts index c5b4f43..3f9e9b5 100644 --- a/src/commands/moderation/warn.ts +++ b/src/commands/moderation/warn.ts @@ -21,7 +21,6 @@ export default class WarnCommand extends BushCommand { }, { id: 'reason', - type: 'content', match: 'rest', prompt: { start: 'Why should this user be warned?', diff --git a/src/commands/moulberry-bush/capePerms.ts b/src/commands/moulberry-bush/capePerms.ts index d613217..7a021ed 100644 --- a/src/commands/moulberry-bush/capePerms.ts +++ b/src/commands/moulberry-bush/capePerms.ts @@ -1,5 +1,4 @@ import { BushCommand, BushMessage, BushSlashMessage } from '@lib'; -import { Constants } from 'discord-akairo'; import { MessageEmbed } from 'discord.js'; import got from 'got'; @@ -16,8 +15,7 @@ export default class CapePermissionsCommand extends BushCommand { args: [ { id: 'ign', - type: Constants.ArgumentTypes.STRING, - match: Constants.ArgumentMatches.PHRASE, + type: 'string', prompt: { start: 'Who would you like to see the cape permissions of?', retry: '{error} Choose someone to see the capes their available capes.', diff --git a/src/commands/moulberry-bush/report.ts b/src/commands/moulberry-bush/report.ts index 4c6adc1..2ee02bd 100644 --- a/src/commands/moulberry-bush/report.ts +++ b/src/commands/moulberry-bush/report.ts @@ -1,4 +1,3 @@ -import { Constants } from 'discord-akairo'; import { GuildMember, MessageEmbed, TextChannel } from 'discord.js'; import moment from 'moment'; import { AllowedMentions, BushCommand, BushMessage } from '../../lib'; @@ -16,8 +15,7 @@ export default class ReportCommand extends BushCommand { args: [ { id: 'member', - type: Constants.ArgumentTypes.MEMBER, - match: Constants.ArgumentMatches.PHRASE, + type: 'member', prompt: { start: 'Who would you like to report?', retry: `{error} Choose a valid user to report.`, @@ -26,8 +24,8 @@ export default class ReportCommand extends BushCommand { }, { id: 'evidence', - type: Constants.ArgumentTypes.STRING, - match: Constants.ArgumentMatches.REST, + type: 'string', + match: 'rest', prompt: { start: 'What evidence do you have?', retry: `{error} Provide what did they do wrong.`, diff --git a/src/commands/moulberry-bush/rule.ts b/src/commands/moulberry-bush/rule.ts index 1681a1b..41dd8de 100644 --- a/src/commands/moulberry-bush/rule.ts +++ b/src/commands/moulberry-bush/rule.ts @@ -1,4 +1,3 @@ -import { Argument, Constants } from 'discord-akairo'; import { MessageEmbed, User } from 'discord.js'; import { AllowedMentions, BushCommand, BushMessage } from '../../lib'; @@ -65,8 +64,7 @@ export default class RuleCommand extends BushCommand { args: [ { id: 'rule', - type: Argument.range(Constants.ArgumentTypes.INTEGER, 1, rules.length, true), - match: Constants.ArgumentMatches.PHRASE, + customType: util.arg.range('integer', 1, rules.length, true), prompt: { start: 'What rule would you like to have cited?', retry: '{error} Choose a valid rule.', @@ -76,7 +74,6 @@ export default class RuleCommand extends BushCommand { { id: 'user', type: 'user', - match: Constants.ArgumentMatches.PHRASE, prompt: { start: 'What user would you like to mention?', retry: '{error} Choose a valid user to mention.', diff --git a/src/commands/skyblock-reborn/chooseColor.ts b/src/commands/skyblock-reborn/chooseColor.ts index 2b72301..9b4b7c9 100644 --- a/src/commands/skyblock-reborn/chooseColor.ts +++ b/src/commands/skyblock-reborn/chooseColor.ts @@ -1,5 +1,4 @@ import { AllowedMentions, BushCommand, BushGuildMember, BushMessage, BushSlashMessage } from '@lib'; -import { Constants } from 'discord-akairo'; import { CommandInteraction, Role, RoleResolvable, Snowflake } from 'discord.js'; const roleColorMap = [ @@ -94,7 +93,7 @@ export default class ChooseColorCommand extends BushCommand { { id: 'color', type: 'role', - match: Constants.ArgumentMatches.REST, + match: 'rest', prompt: { start: 'Please choose a valid color.', retry: `{error} Provide what did they do wrong.`, diff --git a/src/commands/utilities/decode.ts b/src/commands/utilities/decode.ts index aa3d455..cab23d8 100644 --- a/src/commands/utilities/decode.ts +++ b/src/commands/utilities/decode.ts @@ -18,7 +18,7 @@ export default class DecodeCommand extends BushCommand { args: [ { id: 'from', - type: encodingTypesArray, + customType: encodingTypesArray, prompt: { start: 'What is the encoding of the original data?', retry: `{error} Choose one of the following ${encodingTypesString} for the encoding of the original data.` @@ -26,7 +26,7 @@ export default class DecodeCommand extends BushCommand { }, { id: 'to', - type: encodingTypesArray, + customType: encodingTypesArray, prompt: { start: 'What would you like the encoding of the resulting data to be?', retry: `{error} Choose one of the following ${encodingTypesString} for the encoding of the resulting data.` diff --git a/src/commands/utilities/hash.ts b/src/commands/utilities/hash.ts index 4b5b01c..fcf2da3 100644 --- a/src/commands/utilities/hash.ts +++ b/src/commands/utilities/hash.ts @@ -1,5 +1,4 @@ import crypto from 'crypto'; -import { Constants } from 'discord-akairo'; import got from 'got'; import { BushCommand, BushMessage } from '../../lib'; @@ -16,8 +15,7 @@ export default class HashCommand extends BushCommand { args: [ { id: 'url', - type: Constants.ArgumentTypes.URL, - match: Constants.ArgumentMatches.PHRASE, + type: 'url', prompt: { start: 'What url would you like to find the hash of?', retry: '{error} Enter a valid url.' diff --git a/src/commands/utilities/price.ts b/src/commands/utilities/price.ts index d04544b..38cd8ca 100644 --- a/src/commands/utilities/price.ts +++ b/src/commands/utilities/price.ts @@ -1,4 +1,3 @@ -import { Constants } from 'discord-akairo'; import { MessageEmbed } from 'discord.js'; import Fuse from 'fuse.js'; import fetch from 'node-fetch'; @@ -66,8 +65,8 @@ export default class PriceCommand extends BushCommand { args: [ { id: 'item', - match: Constants.ArgumentMatches.CONTENT, - type: Constants.ArgumentTypes.STRING, + type: 'string', + match: 'content', prompt: { start: 'What item would you like to find the price of?', retry: '{error} Choose a valid item.' @@ -75,7 +74,7 @@ export default class PriceCommand extends BushCommand { }, { id: 'strict', - match: Constants.ArgumentMatches.FLAG, + match: 'flag', flag: '--strict', default: false } diff --git a/src/commands/utilities/uuid.ts b/src/commands/utilities/uuid.ts index 7ff80d2..02ca506 100644 --- a/src/commands/utilities/uuid.ts +++ b/src/commands/utilities/uuid.ts @@ -1,4 +1,3 @@ -import { Constants } from 'discord-akairo'; import { BushCommand, BushMessage } from '../../lib'; export default class UuidCommand extends BushCommand { @@ -14,8 +13,8 @@ export default class UuidCommand extends BushCommand { args: [ { id: 'ign', - type: /\w{1,16}/im, - match: Constants.ArgumentMatches.PHRASE, + customType: /\w{1,16}/im, + prompt: { start: 'What ign would you like to find the uuid of?', retry: '{error} Choose a valid ign.', diff --git a/src/commands/utilities/viewraw.ts b/src/commands/utilities/viewraw.ts index ca5b2de..ca21b4b 100644 --- a/src/commands/utilities/viewraw.ts +++ b/src/commands/utilities/viewraw.ts @@ -1,4 +1,3 @@ -import { Argument, Constants } from 'discord-akairo'; import { DMChannel, Message, MessageEmbed, NewsChannel, Snowflake, TextChannel } from 'discord.js'; import { inspect } from 'util'; import { BushCommand, BushMessage, BushSlashMessage } from '../../lib'; @@ -17,8 +16,8 @@ export default class ViewRawCommand extends BushCommand { args: [ { id: 'message', - type: Argument.union(Constants.ArgumentTypes.MESSAGE, Constants.ArgumentTypes.BIGINT), - match: Constants.ArgumentMatches.PHRASE, + customType: util.arg.union('message', 'bigint'), + prompt: { start: 'What message would you like to view?', retry: '{error} Choose a valid message.', @@ -27,8 +26,7 @@ export default class ViewRawCommand extends BushCommand { }, { id: 'channel', - type: Constants.ArgumentTypes.CHANNEL, - match: Constants.ArgumentMatches.PHRASE, + type: 'channel', prompt: { start: 'What channel is the message in?', retry: '{error} Choose a valid channel.', @@ -38,7 +36,7 @@ export default class ViewRawCommand extends BushCommand { }, { id: 'json', - match: Constants.ArgumentMatches.FLAG, + match: 'flag', flag: '--json' } ] |