diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-06-18 18:44:53 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-06-18 18:44:53 -0400 |
commit | c946774f10f64bdf39074310f5df82bfa59fc322 (patch) | |
tree | 63f90d08a38b310389afc2fc31f02621588016c8 | |
parent | 8725cff3e370b54b7d372dda9e1991d81fc25b25 (diff) | |
download | tanzanite-c946774f10f64bdf39074310f5df82bfa59fc322.tar.gz tanzanite-c946774f10f64bdf39074310f5df82bfa59fc322.tar.bz2 tanzanite-c946774f10f64bdf39074310f5df82bfa59fc322.zip |
use new textBasedChannel arg type
-rw-r--r-- | src/commands/moderation/lockdown.ts | 18 | ||||
-rw-r--r-- | src/commands/moderation/unlockdown.ts | 25 | ||||
-rw-r--r-- | src/commands/utilities/viewRaw.ts | 16 | ||||
-rw-r--r-- | yarn.lock | 6 |
4 files changed, 17 insertions, 48 deletions
diff --git a/src/commands/moderation/lockdown.ts b/src/commands/moderation/lockdown.ts index 76d61d0..1224763 100644 --- a/src/commands/moderation/lockdown.ts +++ b/src/commands/moderation/lockdown.ts @@ -1,6 +1,5 @@ import { AllowedMentions, - Arg, BushCommand, clientSendAndPermCheck, colors, @@ -15,8 +14,8 @@ import { import assert from 'assert'; import { ApplicationCommandOptionType, - ChannelType, Collection, + Constants, NewsChannel, PermissionFlagsBits, TextChannel, @@ -36,17 +35,10 @@ export default class LockdownCommand extends BushCommand { { id: 'channel', description: 'Specify a different channel to lockdown instead of the one you trigger the command in.', - type: Arg.union('textChannel', 'newsChannel', 'threadChannel', 'voiceChannel'), + type: 'textBasedChannel', prompt: 'What channel would you like to lockdown?', slashType: ApplicationCommandOptionType.Channel, - channelTypes: [ - ChannelType.GuildText, - ChannelType.GuildNews, - ChannelType.GuildNewsThread, - ChannelType.GuildPublicThread, - ChannelType.GuildPrivateThread, - ChannelType.GuildVoice - ], + channelTypes: Constants.TextBasedChannelTypes, optional: true }, { @@ -79,7 +71,7 @@ export default class LockdownCommand extends BushCommand { public override async exec( message: CommandMessage | SlashMessage, args: { - channel: OptArgType<'textChannel' | 'newsChannel' | 'threadChannel' | 'voiceChannel'>; + channel: OptArgType<'textBasedChannel'>; reason: OptArgType<'string'>; all: ArgType<'flag'>; } @@ -90,7 +82,7 @@ export default class LockdownCommand extends BushCommand { public static async lockdownOrUnlockdown( message: CommandMessage | SlashMessage, args: { - channel: OptArgType<'textChannel' | 'newsChannel' | 'threadChannel' | 'voiceChannel'>; + channel: OptArgType<'textBasedChannel'>; reason: OptArgType<'string'>; all: ArgType<'flag'>; }, diff --git a/src/commands/moderation/unlockdown.ts b/src/commands/moderation/unlockdown.ts index db1a09d..873ea87 100644 --- a/src/commands/moderation/unlockdown.ts +++ b/src/commands/moderation/unlockdown.ts @@ -1,14 +1,6 @@ import { LockdownCommand } from '#commands'; -import { - Arg, - BushCommand, - clientSendAndPermCheck, - type ArgType, - type CommandMessage, - type OptArgType, - type SlashMessage -} from '#lib'; -import { ApplicationCommandOptionType, ChannelType, PermissionFlagsBits } from 'discord.js'; +import { BushCommand, clientSendAndPermCheck, type ArgType, type CommandMessage, type OptArgType, type SlashMessage } from '#lib'; +import { ApplicationCommandOptionType, Constants, PermissionFlagsBits } from 'discord.js'; export default class UnlockdownCommand extends BushCommand { public constructor() { @@ -22,17 +14,10 @@ export default class UnlockdownCommand extends BushCommand { { id: 'channel', description: 'Specify a different channel to unlockdown instead of the one you trigger the command in.', - type: Arg.union('textChannel', 'newsChannel', 'threadChannel', 'voiceChannel'), + type: 'textBasedChannel', prompt: 'What channel would you like to unlockdown?', slashType: ApplicationCommandOptionType.Channel, - channelTypes: [ - ChannelType.GuildText, - ChannelType.GuildNews, - ChannelType.GuildNewsThread, - ChannelType.GuildPublicThread, - ChannelType.GuildPrivateThread, - ChannelType.GuildVoice - ], + channelTypes: Constants.TextBasedChannelTypes, optional: true }, { @@ -64,7 +49,7 @@ export default class UnlockdownCommand extends BushCommand { public override async exec( message: CommandMessage | SlashMessage, args: { - channel: OptArgType<'textChannel' | 'newsChannel' | 'threadChannel' | 'voiceChannel'>; + channel: OptArgType<'textBasedChannel'>; reason: OptArgType<'string'>; all: ArgType<'flag'>; } diff --git a/src/commands/utilities/viewRaw.ts b/src/commands/utilities/viewRaw.ts index 057d86d..d2aef0d 100644 --- a/src/commands/utilities/viewRaw.ts +++ b/src/commands/utilities/viewRaw.ts @@ -11,7 +11,7 @@ import { type SlashMessage } from '#lib'; import assert from 'assert'; -import { ApplicationCommandOptionType, ChannelType, EmbedBuilder, Message, PermissionFlagsBits } from 'discord.js'; +import { ApplicationCommandOptionType, Constants, EmbedBuilder, Message, PermissionFlagsBits } from 'discord.js'; export default class ViewRawCommand extends BushCommand { public constructor() { @@ -34,20 +34,12 @@ export default class ViewRawCommand extends BushCommand { { id: 'channel', description: 'The channel that the message is in.', - type: Arg.union('textChannel', 'newsChannel', 'threadChannel', 'voiceChannel'), + type: 'textBasedChannel', prompt: 'What channel is the message in?', retry: '{error} Choose a valid channel.', optional: true, slashType: ApplicationCommandOptionType.Channel, - channelTypes: [ - ChannelType.GuildText, - ChannelType.DM, - ChannelType.GuildNews, - ChannelType.GuildNewsThread, - ChannelType.GuildPublicThread, - ChannelType.GuildPrivateThread, - ChannelType.GuildVoice - ] + channelTypes: Constants.TextBasedChannelTypes }, { id: 'json', @@ -79,7 +71,7 @@ export default class ViewRawCommand extends BushCommand { message: CommandMessage | SlashMessage, args: { message: ArgType<'message' | 'messageLink'>; - channel: OptArgType<'textChannel' | 'newsChannel' | 'threadChannel' | 'voiceChannel'>; + channel: OptArgType<'textBasedChannel'>; json: ArgType<'flag'>; js: ArgType<'flag'>; } @@ -1545,9 +1545,9 @@ __metadata: linkType: hard "discord-akairo@npm:@notenoughupdates/discord-akairo@dev": - version: 9.1.3-dev.1655515392.64743a1 - resolution: "@notenoughupdates/discord-akairo@npm:9.1.3-dev.1655515392.64743a1" - checksum: b597b534be4c00b2bee83f6b887a0c878674acbdb9e83cbde69b428834c28165978d2ed33643b2ae29b702f0969658804e2148049afc9f0acfcc1e44404a1c72 + version: 9.1.3-dev.1655521909.d87c26d + resolution: "@notenoughupdates/discord-akairo@npm:9.1.3-dev.1655521909.d87c26d" + checksum: b1e03bae5ddfadd190de2230904f04b9f434ba2580ecd4780c926f40173d2a85bee570640143584c3b2cd534c1a679cab7a0ab5bb4dc5402c0eb6e6e881bec88 languageName: node linkType: hard |