aboutsummaryrefslogtreecommitdiff
path: root/src/commands/config
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-12-27 13:12:49 -0500
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-12-27 13:12:49 -0500
commite05f25f4b98cac3c2409cee9a664ab5ea6251467 (patch)
treef8e3dc4fde8f6deaa543b910acb9a725abbac999 /src/commands/config
parent84f246ebb5ddee984012d3043dcc67ffae806856 (diff)
downloadtanzanite-e05f25f4b98cac3c2409cee9a664ab5ea6251467.tar.gz
tanzanite-e05f25f4b98cac3c2409cee9a664ab5ea6251467.tar.bz2
tanzanite-e05f25f4b98cac3c2409cee9a664ab5ea6251467.zip
better typings and some other stuff
Diffstat (limited to 'src/commands/config')
-rw-r--r--src/commands/config/blacklist.ts6
-rw-r--r--src/commands/config/config.ts12
-rw-r--r--src/commands/config/disable.ts4
-rw-r--r--src/commands/config/log.ts8
4 files changed, 20 insertions, 10 deletions
diff --git a/src/commands/config/blacklist.ts b/src/commands/config/blacklist.ts
index a6e6a3d..d119774 100644
--- a/src/commands/config/blacklist.ts
+++ b/src/commands/config/blacklist.ts
@@ -1,5 +1,5 @@
-import { AllowedMentions, BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
-import { GuildTextBasedChannel, User } from 'discord.js';
+import { AllowedMentions, ArgType, BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
+import { User } from 'discord.js';
export default class BlacklistCommand extends BushCommand {
public constructor() {
@@ -51,7 +51,7 @@ export default class BlacklistCommand extends BushCommand {
public override async exec(
message: BushMessage | BushSlashMessage,
- args: { action?: 'blacklist' | 'unblacklist'; target: GuildTextBasedChannel | User | string; global: boolean }
+ args: { action?: 'blacklist' | 'unblacklist'; target: ArgType<'channel'> | ArgType<'user'> | string; global: boolean }
) {
let action: 'blacklist' | 'unblacklist' | 'toggle' =
args.action ?? (message?.util?.parsed?.alias as 'blacklist' | 'unblacklist' | undefined) ?? 'toggle';
diff --git a/src/commands/config/config.ts b/src/commands/config/config.ts
index b88147d..9377dd0 100644
--- a/src/commands/config/config.ts
+++ b/src/commands/config/config.ts
@@ -1,4 +1,12 @@
-import { BushCommand, guildSettingsObj, settingsArr, type BushMessage, type BushSlashMessage, type GuildSettings } from '#lib';
+import {
+ ArgType,
+ BushCommand,
+ guildSettingsObj,
+ settingsArr,
+ type BushMessage,
+ type BushSlashMessage,
+ type GuildSettings
+} from '#lib';
import { type ArgumentOptions, type Flag } from 'discord-akairo';
import {
Channel,
@@ -172,7 +180,7 @@ export default class SettingsCommand extends BushCommand {
subcommandGroup?: GuildSettings;
action?: Action;
subcommand?: Action;
- value: string | Channel | Role;
+ value: ArgType<'channel'> | ArgType<'role'> | string;
}
) {
if (!message.guild) return await message.util.reply(`${util.emojis.error} This command can only be used in servers.`);
diff --git a/src/commands/config/disable.ts b/src/commands/config/disable.ts
index 44c28d3..f6bce3a 100644
--- a/src/commands/config/disable.ts
+++ b/src/commands/config/disable.ts
@@ -1,4 +1,4 @@
-import { AllowedMentions, BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
+import { AllowedMentions, ArgType, BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
export default class DisableCommand extends BushCommand {
private static blacklistedCommands = ['eval', 'disable'];
@@ -49,7 +49,7 @@ export default class DisableCommand extends BushCommand {
public override async exec(
message: BushMessage | BushSlashMessage,
- args: { action?: 'enable' | 'disable'; command: BushCommand | string; global: boolean }
+ args: { action?: 'enable' | 'disable'; command: ArgType<'commandAlias'> | string; global: boolean }
) {
let action = (args.action ?? message?.util?.parsed?.alias ?? 'toggle') as 'disable' | 'enable' | 'toggle';
const global = args.global && message.author.isOwner();
diff --git a/src/commands/config/log.ts b/src/commands/config/log.ts
index 52cb8f5..c61a6d5 100644
--- a/src/commands/config/log.ts
+++ b/src/commands/config/log.ts
@@ -1,6 +1,5 @@
-import { BushCommand, guildLogsArr, type BushMessage, type BushSlashMessage, type GuildLogType } from '#lib';
+import { ArgType, BushCommand, guildLogsArr, type BushMessage, type BushSlashMessage, type GuildLogType } from '#lib';
import { type ArgumentOptions, type Flag } from 'discord-akairo';
-import { type TextChannel } from 'discord.js';
export default class LogCommand extends BushCommand {
public constructor() {
@@ -62,7 +61,10 @@ export default class LogCommand extends BushCommand {
return { log_type, channel };
}
- public override async exec(message: BushMessage | BushSlashMessage, args: { log_type: GuildLogType; channel: TextChannel }) {
+ public override async exec(
+ message: BushMessage | BushSlashMessage,
+ args: { log_type: GuildLogType; channel: ArgType<'textChannel'> }
+ ) {
if (!message.guild) return await message.util.reply(`${util.emojis.error} This command can only be used in servers.`);
const currentLogs = await message.guild.getSetting('logChannels');
const oldChannel = currentLogs[args.log_type] ?? undefined;