diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-02-23 21:38:40 -0500 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-02-23 21:38:40 -0500 |
commit | 084a815f3799764d2dd697e8c693c7f80e0c7ab7 (patch) | |
tree | 7c62c41824d8ab25a67fe35016b6514744d33402 /src/commands/utilities/highlight-block.ts | |
parent | d64563e89034b8e016d1b0a24e2b44280900b14c (diff) | |
download | tanzanite-084a815f3799764d2dd697e8c693c7f80e0c7ab7.tar.gz tanzanite-084a815f3799764d2dd697e8c693c7f80e0c7ab7.tar.bz2 tanzanite-084a815f3799764d2dd697e8c693c7f80e0c7ab7.zip |
feat(hl): make functional, no cool downs yet, restrcited to su
Diffstat (limited to 'src/commands/utilities/highlight-block.ts')
-rw-r--r-- | src/commands/utilities/highlight-block.ts | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/commands/utilities/highlight-block.ts b/src/commands/utilities/highlight-block.ts index f546958..efc5437 100644 --- a/src/commands/utilities/highlight-block.ts +++ b/src/commands/utilities/highlight-block.ts @@ -33,11 +33,16 @@ export default class HighlightBlockCommand extends BushCommand { public override async exec( message: BushMessage | BushSlashMessage, - args: { target: ArgType<'user'> | ArgType<'role'> | ArgType<'member'> } + args: { target: string | ArgType<'member'> | ArgType<'channel'> } ) { assert(message.inGuild()); - if (!(args.target instanceof GuildMember || args.target instanceof Channel)) + args.target = + typeof args.target === 'string' + ? (await util.arg.cast(util.arg.union('member', 'channel'), message, args.target))! + : args.target; + + if (!args.target || !(args.target instanceof GuildMember || args.target instanceof Channel)) return await message.util.reply(`${util.emojis.error} You can only block users or channels.`); if (args.target instanceof Channel && !args.target.isTextBased()) @@ -54,6 +59,7 @@ export default class HighlightBlockCommand extends BushCommand { if (highlight[key].includes(args.target.id)) return await message.util.reply({ + // eslint-disable-next-line @typescript-eslint/no-base-to-string content: `${util.emojis.error} You have already blocked ${args.target}.`, allowedMentions: AllowedMentions.none() }); @@ -62,6 +68,7 @@ export default class HighlightBlockCommand extends BushCommand { await highlight.save(); return await message.util.reply({ + // eslint-disable-next-line @typescript-eslint/no-base-to-string content: `${util.emojis.success} Successfully blocked ${args.target} from triggering your highlights.`, allowedMentions: AllowedMentions.none() }); |