aboutsummaryrefslogtreecommitdiff
path: root/src/commands/info
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/info')
-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
7 files changed, 25 insertions, 18 deletions
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