aboutsummaryrefslogtreecommitdiff
path: root/src/commands/config/blacklist.ts
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-12-20 22:50:45 -0500
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-12-20 22:50:45 -0500
commit8fb88c737e49321ff2b612a9d0e0e059c64c272a (patch)
tree6d22573479b7e7e047eceb85dbb7520b616a5a45 /src/commands/config/blacklist.ts
parentd4a401ed2315a7b5e7dfa390836f2ebae1299976 (diff)
downloadtanzanite-8fb88c737e49321ff2b612a9d0e0e059c64c272a.tar.gz
tanzanite-8fb88c737e49321ff2b612a9d0e0e059c64c272a.tar.bz2
tanzanite-8fb88c737e49321ff2b612a9d0e0e059c64c272a.zip
do some fixes or something
Diffstat (limited to 'src/commands/config/blacklist.ts')
-rw-r--r--src/commands/config/blacklist.ts23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/commands/config/blacklist.ts b/src/commands/config/blacklist.ts
index 8bb778c..da4ad18 100644
--- a/src/commands/config/blacklist.ts
+++ b/src/commands/config/blacklist.ts
@@ -1,5 +1,6 @@
import { AllowedMentions, BushCommand, Global, type BushMessage, type BushSlashMessage } from '#lib';
-import { User, type Channel } from 'discord.js';
+import { GuildTextBasedChannels } from 'discord-akairo';
+import { User } from 'discord.js';
export default class BlacklistCommand extends BushCommand {
public constructor() {
@@ -25,7 +26,7 @@ export default class BlacklistCommand extends BushCommand {
{
id: 'target',
description: 'The channel/user to blacklist.',
- customType: util.arg.union('channel', 'user'),
+ type: util.arg.union('channel', 'user'),
readableType: 'channel|user',
prompt: 'What channel or user that you would like to blacklist/unblacklist?',
retry: '{error} Pick a valid user or channel.',
@@ -51,14 +52,14 @@ export default class BlacklistCommand extends BushCommand {
public override async exec(
message: BushMessage | BushSlashMessage,
- args: { action: 'blacklist' | 'unblacklist'; target: Channel | User | string; global: boolean }
+ args: { action: 'blacklist' | 'unblacklist'; target: GuildTextBasedChannels | User | string; global: boolean }
) {
let action: 'blacklist' | 'unblacklist' | 'toggle' =
args.action ?? (message?.util?.parsed?.alias as 'blacklist' | 'unblacklist') ?? 'toggle';
const global = args.global && message.author.isOwner();
const target =
typeof args.target === 'string'
- ? (await util.arg.cast('channel', message, args.target)) ?? (await util.arg.cast('user', message, args.target))
+ ? (await util.arg.cast('textChannel', message, args.target)) ?? (await util.arg.cast('user', message, args.target))
: args.target;
if (!target) return await message.util.reply(`${util.emojis.error} Choose a valid channel or user.`);
const targetID = target.id;
@@ -81,13 +82,15 @@ export default class BlacklistCommand extends BushCommand {
if (!success)
return await message.util.reply({
content: `${util.emojis.error} There was an error globally ${action}ing ${util.format.input(
- target?.tag ?? target.name
+ target instanceof User ? target.tag : target.name
)}.`,
allowedMentions: AllowedMentions.none()
});
else
return await message.util.reply({
- content: `${util.emojis.success} Successfully ${action}ed ${util.format.input(target?.tag ?? target.name)} globally.`,
+ content: `${util.emojis.success} Successfully ${action}ed ${util.format.input(
+ target instanceof User ? target.tag : target.name
+ )} globally.`,
allowedMentions: AllowedMentions.none()
});
// guild disable
@@ -108,12 +111,16 @@ 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.input(target?.tag ?? target.name)}.`,
+ content: `${util.emojis.error} There was an error ${action}ing ${util.format.input(
+ target instanceof User ? target.tag : target.name
+ )}.`,
allowedMentions: AllowedMentions.none()
});
else
return await message.util.reply({
- content: `${util.emojis.success} Successfully ${action}ed ${util.format.input(target?.tag ?? target.name)}.`,
+ content: `${util.emojis.success} Successfully ${action}ed ${util.format.input(
+ target instanceof User ? target.tag : target.name
+ )}.`,
allowedMentions: AllowedMentions.none()
});
}