aboutsummaryrefslogtreecommitdiff
path: root/src/commands
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
parent84f246ebb5ddee984012d3043dcc67ffae806856 (diff)
downloadtanzanite-e05f25f4b98cac3c2409cee9a664ab5ea6251467.tar.gz
tanzanite-e05f25f4b98cac3c2409cee9a664ab5ea6251467.tar.bz2
tanzanite-e05f25f4b98cac3c2409cee9a664ab5ea6251467.zip
better typings and some other stuff
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/admin/channelPermissions.ts8
-rw-r--r--src/commands/admin/roleAll.ts6
-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
-rw-r--r--src/commands/dev/__template.ts1
-rw-r--r--src/commands/dev/dm.ts7
-rw-r--r--src/commands/dev/eval.ts4
-rw-r--r--src/commands/dev/javascript.ts4
-rw-r--r--src/commands/dev/superUser.ts5
-rw-r--r--src/commands/fun/minesweeper.ts10
-rw-r--r--src/commands/info/avatar.ts6
-rw-r--r--src/commands/info/color.ts6
-rw-r--r--src/commands/info/guildInfo.ts9
-rw-r--r--src/commands/info/help.ts4
-rw-r--r--src/commands/info/pronouns.ts7
-rw-r--r--src/commands/info/snowflake.ts5
-rw-r--r--src/commands/info/userInfo.ts6
-rw-r--r--src/commands/leveling/leaderboard.ts4
-rw-r--r--src/commands/leveling/level.ts3
-rw-r--r--src/commands/leveling/setLevel.ts8
-rw-r--r--src/commands/leveling/setXp.ts8
-rw-r--r--src/commands/moderation/ban.ts18
-rw-r--r--src/commands/moderation/kick.ts4
-rw-r--r--src/commands/moderation/modlog.ts28
-rw-r--r--src/commands/moderation/mute.ts4
-rw-r--r--src/commands/moderation/purge.ts4
-rw-r--r--src/commands/moderation/removeReactionEmoji.ts9
-rw-r--r--src/commands/moderation/role.ts18
-rw-r--r--src/commands/moderation/slowmode.ts15
-rw-r--r--src/commands/moderation/unban.ts7
-rw-r--r--src/commands/moderation/unmute.ts7
-rw-r--r--src/commands/moderation/warn.ts7
-rw-r--r--src/commands/moulberry-bush/capePerms.ts4
-rw-r--r--src/commands/moulberry-bush/capes.ts4
-rw-r--r--src/commands/moulberry-bush/moulHammer.ts6
-rw-r--r--src/commands/moulberry-bush/report.ts6
-rw-r--r--src/commands/moulberry-bush/rule.ts13
-rw-r--r--src/commands/utilities/activity.ts6
-rw-r--r--src/commands/utilities/steal.ts6
-rw-r--r--src/commands/utilities/uuid.ts5
-rw-r--r--src/commands/utilities/viewRaw.ts23
-rw-r--r--src/commands/utilities/whoHasRole.ts6
44 files changed, 205 insertions, 136 deletions
diff --git a/src/commands/admin/channelPermissions.ts b/src/commands/admin/channelPermissions.ts
index 17bea40..b94094c 100644
--- a/src/commands/admin/channelPermissions.ts
+++ b/src/commands/admin/channelPermissions.ts
@@ -1,5 +1,5 @@
-import { BushCommand, ButtonPaginator, type BushMessage, type BushSlashMessage } from '#lib';
-import { MessageEmbed, type GuildMember, type PermissionString, type Role } from 'discord.js';
+import { ArgType, BushCommand, ButtonPaginator, type BushMessage, type BushSlashMessage } from '#lib';
+import { MessageEmbed } from 'discord.js';
export default class ChannelPermissionsCommand extends BushCommand {
public constructor() {
@@ -57,8 +57,8 @@ export default class ChannelPermissionsCommand extends BushCommand {
public override async exec(
message: BushMessage | BushSlashMessage,
args: {
- target: Role | GuildMember;
- permission: PermissionString;
+ target: ArgType<'member'> | ArgType<'role'>;
+ permission: ArgType<'permission'>;
state: 'true' | 'false' | 'neutral';
}
) {
diff --git a/src/commands/admin/roleAll.ts b/src/commands/admin/roleAll.ts
index 585e6cc..a946e33 100644
--- a/src/commands/admin/roleAll.ts
+++ b/src/commands/admin/roleAll.ts
@@ -1,5 +1,5 @@
-import { AllowedMentions, BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
-import { type GuildMember, type Role } from 'discord.js';
+import { AllowedMentions, ArgType, BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
+import { type GuildMember } from 'discord.js';
export default class RoleAllCommand extends BushCommand {
public constructor() {
@@ -37,7 +37,7 @@ export default class RoleAllCommand extends BushCommand {
});
}
- public override async exec(message: BushMessage | BushSlashMessage, args: { role: Role; bots: boolean }) {
+ public override async exec(message: BushMessage | BushSlashMessage, args: { role: ArgType<'role'>; bots: boolean }) {
if (!message.guild) return await message.util.reply(`${util.emojis.error} This command can only be run in a server.`);
if (!message.member!.permissions.has('ADMINISTRATOR') && !message.member!.user.isOwner())
return await message.util.reply(`${util.emojis.error} You must have admin perms to use this command.`);
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;
diff --git a/src/commands/dev/__template.ts b/src/commands/dev/__template.ts
index 5bb29c8..4341198 100644
--- a/src/commands/dev/__template.ts
+++ b/src/commands/dev/__template.ts
@@ -36,6 +36,7 @@ export default class TemplateCommand extends BushCommand {
userPermissions: []
});
}
+
public override async exec(
message: BushMessage | BushSlashMessage,
args: { required_argument: string; optional_argument: string }
diff --git a/src/commands/dev/dm.ts b/src/commands/dev/dm.ts
index 5031dfd..4133b96 100644
--- a/src/commands/dev/dm.ts
+++ b/src/commands/dev/dm.ts
@@ -1,4 +1,4 @@
-import { BushCommand, BushUser, type BushMessage, type BushSlashMessage } from '#lib';
+import { ArgType, BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
export default class DMCommand extends BushCommand {
public constructor() {
@@ -11,7 +11,7 @@ export default class DMCommand extends BushCommand {
args: [
{
id: 'user',
- type: 'string',
+ type: 'user',
description: 'The user to send the dm to.',
prompt: 'Who would you like to dm?',
retry: '{error} Pick a valid user to send a dm to.',
@@ -20,6 +20,7 @@ export default class DMCommand extends BushCommand {
{
id: 'content',
type: 'string',
+ match: 'rest',
description: 'This is the second argument.',
prompt: 'What would you like to set your second argument to be?',
retry: '{error} Pick a valid argument.',
@@ -34,7 +35,7 @@ export default class DMCommand extends BushCommand {
userPermissions: []
});
}
- public override async exec(message: BushMessage | BushSlashMessage, args: { user: BushUser; content: string }) {
+ public override async exec(message: BushMessage | BushSlashMessage, args: { user: ArgType<'user'>; content: string }) {
try {
const u = await client.users.fetch(args.user.id);
await u.send(args.content);
diff --git a/src/commands/dev/eval.ts b/src/commands/dev/eval.ts
index 2393a9b..f97f00d 100644
--- a/src/commands/dev/eval.ts
+++ b/src/commands/dev/eval.ts
@@ -1,4 +1,4 @@
-import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
+import { ArgType, BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
import { exec } from 'child_process';
import { MessageEmbed as _MessageEmbed } from 'discord.js';
import ts from 'typescript';
@@ -119,7 +119,7 @@ export default class EvalCommand extends BushCommand {
public override async exec(
message: BushMessage | BushSlashMessage,
args: {
- sel_depth: number;
+ sel_depth: ArgType<'integer'>;
code: string;
sudo: boolean;
silent: boolean;
diff --git a/src/commands/dev/javascript.ts b/src/commands/dev/javascript.ts
index d832c09..2a6a87b 100644
--- a/src/commands/dev/javascript.ts
+++ b/src/commands/dev/javascript.ts
@@ -1,4 +1,4 @@
-import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
+import { ArgType, BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
import { MessageEmbed } from 'discord.js';
import { VM } from 'vm2';
@@ -51,7 +51,7 @@ export default class JavascriptCommand extends BushCommand {
public override async exec(
message: BushMessage | BushSlashMessage,
args: {
- sel_depth: number;
+ sel_depth: ArgType<'integer'>;
code: string;
}
) {
diff --git a/src/commands/dev/superUser.ts b/src/commands/dev/superUser.ts
index f38419f..35e98aa 100644
--- a/src/commands/dev/superUser.ts
+++ b/src/commands/dev/superUser.ts
@@ -1,6 +1,5 @@
-import { BushCommand, Global, type BushMessage, type BushSlashMessage } from '#lib';
+import { ArgType, BushCommand, Global, type BushMessage, type BushSlashMessage } from '#lib';
import { type ArgumentOptions, type Flag } from 'discord-akairo';
-import { type User } from 'discord.js';
export default class SuperUserCommand extends BushCommand {
public constructor() {
@@ -56,7 +55,7 @@ export default class SuperUserCommand extends BushCommand {
public override async exec(
message: BushMessage | BushSlashMessage,
- { action, user }: { action: 'add' | 'remove'; user: User }
+ { action, user }: { action: 'add' | 'remove'; user: ArgType<'user'> }
) {
if (!message.author.isOwner())
return await message.util.reply(`${util.emojis.error} Only my developers can run this command.`);
diff --git a/src/commands/fun/minesweeper.ts b/src/commands/fun/minesweeper.ts
index 16352ce..0b6c89c 100644
--- a/src/commands/fun/minesweeper.ts
+++ b/src/commands/fun/minesweeper.ts
@@ -1,4 +1,4 @@
-import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
+import { ArgType, BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
import { Minesweeper } from '@notenoughupdates/discord.js-minesweeper';
export default class MinesweeperCommand extends BushCommand {
@@ -67,7 +67,13 @@ export default class MinesweeperCommand extends BushCommand {
public override async exec(
message: BushMessage | BushSlashMessage,
- args: { rows: number; columns: number; mines: number; spaces: boolean; reveal_first_cell: boolean }
+ args: {
+ rows: ArgType<'integer'>;
+ columns: ArgType<'integer'>;
+ mines: ArgType<'integer'>;
+ spaces: boolean;
+ reveal_first_cell: boolean;
+ }
) {
const minesweeper = new Minesweeper({
rows: args.rows ?? 9,
diff --git a/src/commands/info/avatar.ts b/src/commands/info/avatar.ts
index 36504f8..3436b87 100644
--- a/src/commands/info/avatar.ts
+++ b/src/commands/info/avatar.ts
@@ -1,5 +1,5 @@
-import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
-import { GuildMember, MessageEmbed, type User } from 'discord.js';
+import { ArgType, BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
+import { GuildMember, MessageEmbed } from 'discord.js';
export default class AvatarCommand extends BushCommand {
constructor() {
@@ -27,7 +27,7 @@ export default class AvatarCommand extends BushCommand {
});
}
- override async exec(message: BushMessage | BushSlashMessage, args: { user: GuildMember | User }) {
+ override async exec(message: BushMessage | BushSlashMessage, args: { user: ArgType<'member'> | ArgType<'globalUser'> }) {
const params: { size: 2048; format: 'png'; dynamic: true } = { size: 2048, format: 'png', dynamic: true };
const defaultAvatar = `https://cdn.discordapp.com/embed/avatars/${Math.ceil(Math.random() * 6) - 1}.png`;
diff --git a/src/commands/info/color.ts b/src/commands/info/color.ts
index 4277d56..2f9751b 100644
--- a/src/commands/info/color.ts
+++ b/src/commands/info/color.ts
@@ -1,5 +1,6 @@
import {
AllowedMentions,
+ ArgType,
BushArgumentTypeCaster,
BushCommand,
type BushGuildMember,
@@ -46,7 +47,10 @@ export default class ColorCommand extends BushCommand {
return color.substring(4, color.length - 5);
}
- public override async exec(message: BushMessage | BushSlashMessage, args: { color: string | BushRole | BushGuildMember }) {
+ public override async exec(
+ message: BushMessage | BushSlashMessage,
+ args: { color: string | ArgType<'role'> | ArgType<'member'> }
+ ) {
const _color = message.util.isSlashMessage(message)
? ((await util.arg.cast(util.arg.union(isValidTinyColor as any, 'role', 'member'), message, args.color as string)) as
| string
diff --git a/src/commands/info/guildInfo.ts b/src/commands/info/guildInfo.ts
index ab09741..67150f6 100644
--- a/src/commands/info/guildInfo.ts
+++ b/src/commands/info/guildInfo.ts
@@ -1,4 +1,4 @@
-import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
+import { ArgType, BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
import {
Constants,
Guild,
@@ -35,7 +35,7 @@ export default class GuildInfoCommand extends BushCommand {
});
}
- public override async exec(message: BushMessage | BushSlashMessage, args: { guild: Guild | Snowflake | GuildPreview }) {
+ public override async exec(message: BushMessage | BushSlashMessage, args: { guild: ArgType<'guild'> | ArgType<'snowflake'> }) {
if (!args?.guild && !message.guild) {
return await message.util.reply(
`${util.emojis.error} You must either provide an server to provide info about or run this command in a server.`
@@ -43,16 +43,17 @@ export default class GuildInfoCommand extends BushCommand {
}
const otherEmojis = client.consts.mappings.otherEmojis;
let isPreview = false;
+ let _guild: ArgType<'guild'> | ArgType<'snowflake'> | GuildPreview = args.guild;
if (['number', 'string'].includes(typeof args?.guild)) {
const preview = await client.fetchGuildPreview(`${args.guild}` as Snowflake).catch(() => {});
if (preview) {
- args.guild = preview;
+ _guild = preview;
isPreview = true;
} else {
return await message.util.reply(`${util.emojis.error} That guild is not discoverable or does not exist.`);
}
}
- const guild: Guild | GuildPreview = (args?.guild as Guild | GuildPreview) || (message.guild as Guild);
+ const guild: Guild | GuildPreview = (_guild as Guild | GuildPreview) || (_guild as Guild);
const emojis: string[] = [];
const guildAbout: string[] = [];
const guildStats: string[] = [];
diff --git a/src/commands/info/help.ts b/src/commands/info/help.ts
index 4999446..277017e 100644
--- a/src/commands/info/help.ts
+++ b/src/commands/info/help.ts
@@ -1,4 +1,4 @@
-import { BushCommand, BushMessage, BushSlashMessage } from '#lib';
+import { ArgType, BushCommand, BushMessage, BushSlashMessage } from '#lib';
import { MessageActionRow, MessageButton, MessageEmbed } from 'discord.js';
import packageDotJSON from '../../../package.json' assert { type: 'json' };
@@ -40,7 +40,7 @@ export default class HelpCommand extends BushCommand {
public override async exec(
message: BushMessage | BushSlashMessage,
- args: { command: BushCommand | string; showHidden?: boolean }
+ args: { command: ArgType<'commandAlias'> | string; showHidden?: boolean }
) {
const prefix = util.prefix(message);
const row = this.addLinks(message);
diff --git a/src/commands/info/pronouns.ts b/src/commands/info/pronouns.ts
index 29cd2ce..3dacede 100644
--- a/src/commands/info/pronouns.ts
+++ b/src/commands/info/pronouns.ts
@@ -1,5 +1,5 @@
-import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
-import { MessageEmbed, type User } from 'discord.js';
+import { ArgType, BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
+import { MessageEmbed } from 'discord.js';
export default class PronounsCommand extends BushCommand {
public constructor() {
@@ -25,7 +25,8 @@ export default class PronounsCommand extends BushCommand {
slash: true
});
}
- override async exec(message: BushMessage | BushSlashMessage, args: { user?: User }) {
+
+ override async exec(message: BushMessage | BushSlashMessage, args: { user?: ArgType<'globalUser'> }) {
const user = args.user ?? message.author;
const author = user.id === message.author.id;
diff --git a/src/commands/info/snowflake.ts b/src/commands/info/snowflake.ts
index f2ffaa8..1658da9 100644
--- a/src/commands/info/snowflake.ts
+++ b/src/commands/info/snowflake.ts
@@ -1,4 +1,4 @@
-import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
+import { ArgType, BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
import {
MessageEmbed,
SnowflakeUtil,
@@ -39,7 +39,8 @@ export default class SnowflakeCommand extends BushCommand {
slash: true
});
}
- public override async exec(message: BushMessage | BushSlashMessage, args: { snowflake: Snowflake }) {
+
+ public override async exec(message: BushMessage | BushSlashMessage, args: { snowflake: ArgType<'snowflake'> }) {
const snowflake = `${args.snowflake}` as Snowflake;
const snowflakeEmbed = new MessageEmbed().setTitle('Unknown :snowflake:').setColor(util.colors.default);
diff --git a/src/commands/info/userInfo.ts b/src/commands/info/userInfo.ts
index 98ead3d..9c7a2a7 100644
--- a/src/commands/info/userInfo.ts
+++ b/src/commands/info/userInfo.ts
@@ -1,5 +1,5 @@
-import { BushCommand, BushGuild, BushGuildMember, type BushMessage, type BushSlashMessage, type BushUser } from '#lib';
-import { MessageEmbed, type Snowflake } from 'discord.js';
+import { ArgType, BushCommand, BushGuild, BushGuildMember, type BushMessage, type BushSlashMessage, type BushUser } from '#lib';
+import { MessageEmbed } from 'discord.js';
// TODO: Add bot information
export default class UserInfoCommand extends BushCommand {
@@ -28,7 +28,7 @@ export default class UserInfoCommand extends BushCommand {
});
}
- public override async exec(message: BushMessage | BushSlashMessage, args: { user: BushUser | Snowflake }) {
+ public override async exec(message: BushMessage | BushSlashMessage, args: { user: ArgType<'user'> | ArgType<'snowflake'> }) {
const user =
args?.user === undefined || args?.user === null
? message.author
diff --git a/src/commands/leveling/leaderboard.ts b/src/commands/leveling/leaderboard.ts
index 6bf66d1..d53d358 100644
--- a/src/commands/leveling/leaderboard.ts
+++ b/src/commands/leveling/leaderboard.ts
@@ -1,4 +1,4 @@
-import { BushCommand, ButtonPaginator, Level, type BushMessage, type BushSlashMessage } from '#lib';
+import { ArgType, BushCommand, ButtonPaginator, Level, type BushMessage, type BushSlashMessage } from '#lib';
import { MessageEmbed } from 'discord.js';
export default class LeaderboardCommand extends BushCommand {
@@ -27,7 +27,7 @@ export default class LeaderboardCommand extends BushCommand {
});
}
- public override async exec(message: BushMessage | BushSlashMessage, args: { page: number }) {
+ public override async exec(message: BushMessage | BushSlashMessage, args: { page: ArgType<'integer'> }) {
if (!message.guild) return await message.util.reply(`${util.emojis.error} This command can only be run in a server.`);
if (!(await message.guild.hasFeature('leveling')))
return await message.util.reply(
diff --git a/src/commands/leveling/level.ts b/src/commands/leveling/level.ts
index 61e5d0b..ed8466d 100644
--- a/src/commands/leveling/level.ts
+++ b/src/commands/leveling/level.ts
@@ -1,5 +1,6 @@
import {
AllowedMentions,
+ ArgType,
BushCommand,
CanvasProgressBar,
Level,
@@ -41,7 +42,7 @@ export default class LevelCommand extends BushCommand {
});
}
- public override async exec(message: BushMessage | BushSlashMessage, args: { user?: BushUser }) {
+ public override async exec(message: BushMessage | BushSlashMessage, args: { user?: ArgType<'user'> }) {
if (!message.guild) return await message.util.reply(`${util.emojis.error} This command can only be run in a server.`);
if (!(await message.guild.hasFeature('leveling')))
return await message.util.reply(
diff --git a/src/commands/leveling/setLevel.ts b/src/commands/leveling/setLevel.ts
index 69f562d..5118a8b 100644
--- a/src/commands/leveling/setLevel.ts
+++ b/src/commands/leveling/setLevel.ts
@@ -1,5 +1,4 @@
-import { AllowedMentions, BushCommand, Level, type BushMessage, type BushSlashMessage } from '#lib';
-import { type User } from 'discord.js';
+import { AllowedMentions, ArgType, BushCommand, Level, type BushMessage, type BushSlashMessage } from '#lib';
export default class SetLevelCommand extends BushCommand {
public constructor() {
@@ -34,7 +33,10 @@ export default class SetLevelCommand extends BushCommand {
});
}
- public override async exec(message: BushMessage | BushSlashMessage, { user, level }: { user: User; level: number }) {
+ public override async exec(
+ message: BushMessage | BushSlashMessage,
+ { user, level }: { user: ArgType<'user'>; level: ArgType<'integer'> }
+ ) {
if (!message.guild) return await message.util.reply(`${util.emojis.error} This command can only be run in a guild.`);
if (!user.id) throw new Error('user.id is null');
diff --git a/src/commands/leveling/setXp.ts b/src/commands/leveling/setXp.ts
index 68be528..eeafff3 100644
--- a/src/commands/leveling/setXp.ts
+++ b/src/commands/leveling/setXp.ts
@@ -1,5 +1,4 @@
-import { AllowedMentions, BushCommand, Level, type BushMessage, type BushSlashMessage } from '#lib';
-import { type User } from 'discord.js';
+import { AllowedMentions, ArgType, BushCommand, Level, type BushMessage, type BushSlashMessage } from '#lib';
export default class SetXpCommand extends BushCommand {
public constructor() {
@@ -35,7 +34,10 @@ export default class SetXpCommand extends BushCommand {
});
}
- public override async exec(message: BushMessage | BushSlashMessage, { user, xp }: { user: User; xp: number }) {
+ public override async exec(
+ message: BushMessage | BushSlashMessage,
+ { user, xp }: { user: ArgType<'user'>; xp: ArgType<'abbreviatedNumber'> }
+ ) {
if (!message.guild) return await message.util.reply(`${util.emojis.error} This command can only be run in a guild.`);
if (!user.id) throw new Error('user.id is null');
diff --git a/src/commands/moderation/ban.ts b/src/commands/moderation/ban.ts
index 506a7c3..c0375e0 100644
--- a/src/commands/moderation/ban.ts
+++ b/