aboutsummaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/admin/channelPermissions.ts6
-rw-r--r--src/commands/config/config.ts12
-rw-r--r--src/commands/config/features.ts6
-rw-r--r--src/commands/config/log.ts14
-rw-r--r--src/commands/dev/eval.ts26
-rw-r--r--src/commands/dev/javascript.ts12
-rw-r--r--src/commands/dev/servers.ts7
-rw-r--r--src/commands/dev/sh.ts14
-rw-r--r--src/commands/dev/superUser.ts11
-rw-r--r--src/commands/dev/test.ts8
-rw-r--r--src/commands/info/avatar.ts4
-rw-r--r--src/commands/info/botInfo.ts46
-rw-r--r--src/commands/info/color.ts14
-rw-r--r--src/commands/info/guildInfo.ts22
-rw-r--r--src/commands/info/help.ts22
-rw-r--r--src/commands/info/icon.ts4
-rw-r--r--src/commands/info/ping.ts14
-rw-r--r--src/commands/info/pronouns.ts4
-rw-r--r--src/commands/info/snowflake.ts16
-rw-r--r--src/commands/info/userInfo.ts16
-rw-r--r--src/commands/leveling/leaderboard.ts6
-rw-r--r--src/commands/moderation/evidence.ts9
-rw-r--r--src/commands/moderation/lockdown.ts10
-rw-r--r--src/commands/moderation/modlog.ts4
-rw-r--r--src/commands/moderation/slowmode.ts2
-rw-r--r--src/commands/moderation/unlockdown.ts10
-rw-r--r--src/commands/moulberry-bush/capePermissions.ts4
-rw-r--r--src/commands/moulberry-bush/capes.ts9
-rw-r--r--src/commands/moulberry-bush/moulHammer.ts4
-rw-r--r--src/commands/moulberry-bush/report.ts26
-rw-r--r--src/commands/moulberry-bush/rule.ts10
-rw-r--r--src/commands/moulberry-bush/serverStatus.ts15
-rw-r--r--src/commands/utilities/activity.ts2
-rw-r--r--src/commands/utilities/calculator.ts11
-rw-r--r--src/commands/utilities/decode.ts17
-rw-r--r--src/commands/utilities/price.ts29
-rw-r--r--src/commands/utilities/reminders.ts5
-rw-r--r--src/commands/utilities/suicide.ts20
-rw-r--r--src/commands/utilities/viewRaw.ts19
-rw-r--r--src/commands/utilities/wolframAlpha.ts13
40 files changed, 284 insertions, 219 deletions
diff --git a/src/commands/admin/channelPermissions.ts b/src/commands/admin/channelPermissions.ts
index f0d2c65..4f511cd 100644
--- a/src/commands/admin/channelPermissions.ts
+++ b/src/commands/admin/channelPermissions.ts
@@ -1,5 +1,5 @@
import { BushCommand, ButtonPaginator, type ArgType, type BushMessage, type BushSlashMessage } from '#lib';
-import { ApplicationCommandOptionType, MessageEmbed, Permissions } from 'discord.js';
+import { ApplicationCommandOptionType, Embed, Permissions } from 'discord.js';
export default class ChannelPermissionsCommand extends BushCommand {
public constructor() {
@@ -89,9 +89,9 @@ export default class ChannelPermissionsCommand extends BushCommand {
}
const failure = failedChannels.map((c) => `<#${c.id}>`).join(' ');
if (failure.length > 2000) {
- const paginate: MessageEmbed[] = [];
+ const paginate: Embed[] = [];
for (let i = 0; i < failure.length; i += 4000) {
- paginate.push(new MessageEmbed().setDescription(failure.substring(i, Math.min(failure.length, i + 4000))));
+ paginate.push(new Embed().setDescription(failure.substring(i, Math.min(failure.length, i + 4000))));
}
const normalMessage = `Finished changing perms! Failed channels:`;
return await ButtonPaginator.send(message, paginate, normalMessage);
diff --git a/src/commands/config/config.ts b/src/commands/config/config.ts
index 41bdc04..42ff309 100644
--- a/src/commands/config/config.ts
+++ b/src/commands/config/config.ts
@@ -16,9 +16,10 @@ import {
ButtonComponent,
ButtonStyle,
Channel,
+ Embed,
Formatters,
GuildMember,
- MessageEmbed,
+ InteractionUpdateOptions,
Permissions,
Role,
SelectMenuComponent,
@@ -286,9 +287,9 @@ export default class ConfigCommand extends BushCommand {
public async generateMessageOptions(
message: BushMessage | BushSlashMessage,
setting?: undefined | keyof typeof guildSettingsObj
- ): Promise<MessageOptions> {
+ ): Promise<MessageOptions & InteractionUpdateOptions> {
if (!message.guild) throw new Error('message.guild is null');
- const settingsEmbed = new MessageEmbed().setColor(util.colors.default);
+ const settingsEmbed = new Embed().setColor(util.colors.default);
if (!setting) {
settingsEmbed.setTitle(`${message.guild!.name}'s Settings`);
const desc = settingsArr.map((s) => `:wrench: **${guildSettingsObj[s].name}**`).join('\n');
@@ -364,7 +365,10 @@ export default class ConfigCommand extends BushCommand {
message.util.isSlash ? _.snakeCase(setting) : setting
} ${guildSettingsObj[setting].type.includes('-array') ? 'add/remove' : 'set'} <value>" to set this setting.`
});
- settingsEmbed.addField('value', (await generateCurrentValue(guildSettingsObj[setting].type)) || '[No Value Set]');
+ settingsEmbed.addField({
+ name: 'value',
+ value: (await generateCurrentValue(guildSettingsObj[setting].type)) || '[No Value Set]'
+ });
return { embeds: [settingsEmbed], components: [components] };
}
}
diff --git a/src/commands/config/features.ts b/src/commands/config/features.ts
index fdd6c1e..04c0425 100644
--- a/src/commands/config/features.ts
+++ b/src/commands/config/features.ts
@@ -9,7 +9,7 @@ import {
import {
ActionRow,
ComponentType,
- MessageEmbed,
+ Embed,
Permissions,
SelectMenuComponent,
SelectMenuOption,
@@ -35,7 +35,7 @@ export default class FeaturesCommand extends BushCommand {
public override async exec(message: BushMessage | BushSlashMessage) {
if (!message.guild) return await message.util.reply(`${util.emojis.error} This command can only be used in servers.`);
- const featureEmbed = new MessageEmbed().setTitle(`${message.guild!.name}'s Features`).setColor(util.colors.default);
+ const featureEmbed = new Embed().setTitle(`${message.guild!.name}'s Features`).setColor(util.colors.default);
const enabledFeatures = await message.guild!.getSetting('enabledFeatures');
this.generateDescription(guildFeaturesArr, enabledFeatures, featureEmbed);
@@ -71,7 +71,7 @@ export default class FeaturesCommand extends BushCommand {
});
}
- public generateDescription(allFeatures: GuildFeatures[], currentFeatures: GuildFeatures[], embed: MessageEmbed): void {
+ public generateDescription(allFeatures: GuildFeatures[], currentFeatures: GuildFeatures[], embed: Embed): void {
embed.setDescription(
allFeatures
.map(
diff --git a/src/commands/config/log.ts b/src/commands/config/log.ts
index 5906623..4c9a20b 100644
--- a/src/commands/config/log.ts
+++ b/src/commands/config/log.ts
@@ -1,6 +1,6 @@
import { BushCommand, guildLogsArr, type ArgType, type BushMessage, type BushSlashMessage, type GuildLogType } from '#lib';
-import { type ArgumentOptions, type Flag } from 'discord-akairo';
-import { ApplicationCommandOptionType, Permissions } from 'discord.js';
+import { ArgumentGeneratorReturn } from 'discord-akairo';
+import { ApplicationCommandOptionType, ChannelType, Permissions } from 'discord.js';
export default class LogCommand extends BushCommand {
public constructor() {
@@ -26,7 +26,13 @@ export default class LogCommand extends BushCommand {
type: 'channel',
prompt: 'What channel would you like these logs to be sent in?',
slashType: ApplicationCommandOptionType.Channel,
- channelTypes: ['GuildText', 'GuildNews', 'GuildNewsThread', 'GuildPublicThread', 'GuildPrivateThread'],
+ channelTypes: [
+ ChannelType.GuildText,
+ ChannelType.GuildNews,
+ ChannelType.GuildNewsThread,
+ ChannelType.GuildPublicThread,
+ ChannelType.GuildPrivateThread
+ ],
only: 'slash'
}
],
@@ -36,7 +42,7 @@ export default class LogCommand extends BushCommand {
});
}
- public override *args(): IterableIterator<ArgumentOptions | Flag> {
+ public override *args(): ArgumentGeneratorReturn {
const log_type = yield {
id: 'log_type',
type: guildLogsArr,
diff --git a/src/commands/dev/eval.ts b/src/commands/dev/eval.ts
index 92b1117..c8541c6 100644
--- a/src/commands/dev/eval.ts
+++ b/src/commands/dev/eval.ts
@@ -25,13 +25,13 @@ import {
CommandInteraction,
ContextMenuCommandInteraction,
DMChannel,
+ Embed,
Emoji,
Interaction,
InteractionCollector,
Message,
MessageAttachment,
MessageCollector,
- MessageEmbed,
ReactionCollector,
SelectMenuComponent,
Util
@@ -194,7 +194,7 @@ export default class EvalCommand extends BushCommand {
lang: isTypescript ? 'ts' : 'js'
};
- const embed = new MessageEmbed();
+ const embed = new Embed();
const badPhrases = ['delete', 'destroy'];
if (badPhrases.some((p) => code[code.lang]!.includes(p)) && !args.sudo) {
@@ -233,16 +233,22 @@ export default class EvalCommand extends BushCommand {
: undefined;
embed.setTitle(`${emojis.successFull} Successfully Evaluated Expression`).setColor(colors.success);
- if (inputTS) embed.addField('๐Ÿ“ฅ Input (typescript)', inputTS).addField('๐Ÿ“ฅ Input (transpiled javascript)', inputJS);
- else embed.addField('๐Ÿ“ฅ Input', inputJS);
- embed.addField('๐Ÿ“ค Output', output);
- if (methods) embed.addField('๐Ÿ”ง Methods', methods);
- if (proto) embed.addField('โš™๏ธ Proto', proto);
+ if (inputTS)
+ embed
+ .addField({ name: '๐Ÿ“ฅ Input (typescript)', value: inputTS })
+ .addField({ name: '๐Ÿ“ฅ Input (transpiled javascript)', value: inputJS });
+ else embed.addField({ name: '๐Ÿ“ฅ Input', value: inputJS });
+ embed.addField({ name: '๐Ÿ“ค Output', value: output });
+ if (methods) embed.addField({ name: '๐Ÿ”ง Methods', value: methods });
+ if (proto) embed.addField({ name: 'โš™๏ธ Proto', value: proto });
} catch (e) {
embed.setTitle(`${emojis.errorFull} Unable to Evaluate Expression`).setColor(colors.error);
- if (inputTS) embed.addField('๐Ÿ“ฅ Input (typescript)', inputTS).addField('๐Ÿ“ฅ Input (transpiled javascript)', inputJS);
- else embed.addField('๐Ÿ“ฅ Input', inputJS);
- embed.addField('๐Ÿ“ค Error', await util.inspectCleanRedactCodeblock(e, 'js'));
+ if (inputTS)
+ embed
+ .addField({ name: '๐Ÿ“ฅ Input (typescript)', value: inputTS })
+ .addField({ name: '๐Ÿ“ฅ Input (transpiled javascript)', value: inputJS });
+ else embed.addField({ name: '๐Ÿ“ฅ Input', value: inputJS });
+ embed.addField({ name: '๐Ÿ“ค Error', value: await util.inspectCleanRedactCodeblock(e, 'js') });
}
embed.setTimestamp().setFooter({ text: message.author.tag, iconURL: message.author.displayAvatarURL() ?? undefined });
diff --git a/src/commands/dev/javascript.ts b/src/commands/dev/javascript.ts
index 9d6a20b..3ede3e2 100644
--- a/src/commands/dev/javascript.ts
+++ b/src/commands/dev/javascript.ts
@@ -1,6 +1,6 @@
import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib';
import assert from 'assert';
-import { ApplicationCommandOptionType, MessageEmbed } from 'discord.js';
+import { ApplicationCommandOptionType, Embed } from 'discord.js';
import { VM } from 'vm2';
assert(VM);
@@ -53,7 +53,7 @@ export default class JavascriptCommand extends BushCommand {
await message.interaction.deferReply({ ephemeral: false });
}
const code = args.code.replace(/[โ€œโ€]/g, '"').replace(/```*(?:js)?/g, '');
- const embed = new MessageEmbed();
+ const embed = new Embed();
const input = await util.inspectCleanRedactCodeblock(code, 'js');
try {
@@ -67,12 +67,12 @@ export default class JavascriptCommand extends BushCommand {
});
embed.setTitle(`${util.emojis.successFull} Successfully Evaluated Expression`).setColor(util.colors.success);
- embed.addField('๐Ÿ“ฅ Input', input);
- embed.addField('๐Ÿ“ค Output', output);
+ embed.addField({ name: '๐Ÿ“ฅ Input', value: input });
+ embed.addField({ name: '๐Ÿ“ค Output', value: output });
} catch (e) {
embed.setTitle(`${util.emojis.errorFull} Unable to Evaluate Expression`).setColor(util.colors.error);
- embed.addField('๐Ÿ“ฅ Input', input);
- embed.addField('๐Ÿ“ค Error', await util.inspectCleanRedactCodeblock(e, 'js'));
+ embed.addField({ name: '๐Ÿ“ฅ Input', value: input });
+ embed.addField({ name: '๐Ÿ“ค Error', value: await util.inspectCleanRedactCodeblock(e, 'js') });
}
embed.setTimestamp().setFooter({ text: message.author.tag, iconURL: message.author.displayAvatarURL() ?? undefined });
diff --git a/src/commands/dev/servers.ts b/src/commands/dev/servers.ts
index 308d1db..173970b 100644
--- a/src/commands/dev/servers.ts
+++ b/src/commands/dev/servers.ts
@@ -1,5 +1,6 @@
import { BushCommand, ButtonPaginator, type BushMessage, type BushSlashMessage } from '#lib';
-import { type Guild, type MessageEmbedOptions } from 'discord.js';
+import { APIEmbed } from 'discord-api-types';
+import { type Guild } from 'discord.js';
export default class ServersCommand extends BushCommand {
public constructor() {
@@ -18,7 +19,7 @@ export default class ServersCommand extends BushCommand {
public override async exec(message: BushMessage | BushSlashMessage) {
const guilds = [...client.guilds.cache.sort((a, b) => (a.memberCount < b.memberCount ? 1 : -1)).values()];
const chunkedGuilds: Guild[][] = util.chunk(guilds, 10);
- const embeds: MessageEmbedOptions[] = chunkedGuilds.map((chunk) => {
+ const embeds: APIEmbed[] = chunkedGuilds.map((chunk) => {
return {
title: `Server List [\`${guilds.length.toLocaleString()}\`]`,
color: util.colors.default,
@@ -30,7 +31,7 @@ export default class ServersCommand extends BushCommand {
`**Members:** ${guild.memberCount.toLocaleString()}`
].join('\n')
}))
- } as MessageEmbedOptions;
+ } as APIEmbed;
});
return await ButtonPaginator.send(message, embeds);
diff --git a/src/commands/dev/sh.ts b/src/commands/dev/sh.ts
index f74dedf..7d29df7 100644
--- a/src/commands/dev/sh.ts
+++ b/src/commands/dev/sh.ts
@@ -2,7 +2,7 @@ import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
import assert from 'assert';
import chalk from 'chalk';
import { exec } from 'child_process';
-import { ApplicationCommandOptionType, MessageEmbed, Util } from 'discord.js';
+import { ApplicationCommandOptionType, Embed, Util } from 'discord.js';
import { promisify } from 'util';
assert(chalk);
@@ -45,13 +45,13 @@ export default class ShCommand extends BushCommand {
return await message.util.reply(`${util.emojis.error} Only my developers can run this command.`);
const input = clean(command);
- const embed = new MessageEmbed()
+ const embed = new Embed()
.setColor(util.colors.gray)
.setFooter({ text: message.author.tag, iconURL: message.author.avatarURL() ?? undefined })
.setTimestamp()
.setTitle('Shell Command')
- .addField('๐Ÿ“ฅ Input', await util.codeblock(input, 1024, 'sh', true))
- .addField('Running', util.emojis.loading);
+ .addField({ name: '๐Ÿ“ฅ Input', value: await util.codeblock(input, 1024, 'sh', true) })
+ .addField({ name: 'Running', value: util.emojis.loading });
await message.util.reply({ embeds: [embed] });
@@ -72,15 +72,15 @@ export default class ShCommand extends BushCommand {
.setColor(util.colors.success)
.spliceFields(1, 1);
- if (stdout) embed.addField('๐Ÿ“ค stdout', await util.codeblock(stdout, 1024, 'json', true));
- if (stderr) embed.addField('๐Ÿ“ค stderr', await util.codeblock(stderr, 1024, 'json', true));
+ if (stdout) embed.addField({ name: '๐Ÿ“ค stdout', value: await util.codeblock(stdout, 1024, 'json', true) });
+ if (stderr) embed.addField({ name: '๐Ÿ“ค stderr', value: await util.codeblock(stderr, 1024, 'json', true) });
} catch (e) {
embed
.setTitle(`${util.emojis.errorFull} An error occurred while executing.`)
.setColor(util.colors.error)
.spliceFields(1, 1);
- embed.addField('๐Ÿ“ค Output', await util.codeblock(e?.stack, 1024, 'js', true));
+ embed.addField({ name: '๐Ÿ“ค Output', value: await util.codeblock(e?.stack, 1024, 'js', true) });
}
await message.util.edit({ embeds: [embed] });
}
diff --git a/src/commands/dev/superUser.ts b/src/commands/dev/superUser.ts
index f937ad4..9cdac4a 100644
--- a/src/commands/dev/superUser.ts
+++ b/src/commands/dev/superUser.ts
@@ -1,5 +1,6 @@
import { BushCommand, type ArgType, type BushMessage } from '#lib';
-import { type ArgumentOptions, type Flag } from 'discord-akairo';
+import { ArgumentGeneratorReturn } from 'discord-akairo';
+import { ArgumentTypeCasterReturn } from 'discord-akairo/dist/src/struct/commands/arguments/Argument';
export default class SuperUserCommand extends BushCommand {
public constructor() {
@@ -30,8 +31,8 @@ export default class SuperUserCommand extends BushCommand {
});
}
- override *args(): IterableIterator<ArgumentOptions | Flag> {
- const action = yield {
+ override *args(): ArgumentGeneratorReturn {
+ const action: 'add' | 'remove' = yield {
id: 'action',
type: ['add', 'remove'],
prompt: {
@@ -40,7 +41,8 @@ export default class SuperUserCommand extends BushCommand {
optional: false
}
};
- const user = yield {
+
+ const user: ArgumentTypeCasterReturn<'user'> = yield {
id: 'user',
type: 'user',
match: 'restContent',
@@ -50,6 +52,7 @@ export default class SuperUserCommand extends BushCommand {
optional: false
}
};
+
return { action, user };
}
diff --git a/src/commands/dev/test.ts b/src/commands/dev/test.ts
index 63c1112..b53b2d8 100644
--- a/src/commands/dev/test.ts
+++ b/src/commands/dev/test.ts
@@ -4,7 +4,7 @@ import {
ActionRowComponent,
ButtonComponent,
ButtonStyle,
- MessageEmbed,
+ Embed,
type ApplicationCommand,
type Collection
} from 'discord.js';
@@ -60,8 +60,8 @@ export default class TestCommand extends BushCommand {
);
return await message.util.reply({ content: 'buttons', components: [ButtonRow] });
} else if (['embed', 'button embed'].includes(args?.feature?.toLowerCase())) {
- const embed = new MessageEmbed()
- .addField('Field Name', 'Field Content')
+ const embed = new Embed()
+ .addField({ name: 'Field Name', value: 'Field Content' })
.setAuthor({ name: 'Author', iconURL: 'https://www.w3schools.com/w3css/img_snowtops.jpg', url: 'https://google.com/' })
.setColor(message.member?.displayColor ?? util.colors.default)
.setDescription('Description')
@@ -93,7 +93,7 @@ export default class TestCommand extends BushCommand {
} else if (['paginate'].includes(args?.feature?.toLowerCase())) {
const embeds = [];
for (let i = 1; i <= 5; i++) {
- embeds.push(new MessageEmbed().setDescription(i.toString()));
+ embeds.push(new Embed().setDescription(i.toString()));
}
return await ButtonPaginator.send(message, embeds);
} else if (['lots of embeds'].includes(args?.feature?.toLowerCase())) {
diff --git a/src/commands/info/avatar.ts b/src/commands/info/avatar.ts
index 58d8bca..1d1a27b 100644
--- a/src/commands/info/avatar.ts
+++ b/src/commands/info/avatar.ts
@@ -1,5 +1,5 @@
import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib';
-import { ApplicationCommandOptionType, GuildMember, MessageEmbed, Permissions } from 'discord.js';
+import { ApplicationCommandOptionType, Embed, GuildMember, Permissions } from 'discord.js';
export default class AvatarCommand extends BushCommand {
constructor() {
@@ -36,7 +36,7 @@ export default class AvatarCommand extends BushCommand {
const guildAvatar = member?.avatarURL(params);
- const embed = new MessageEmbed().setTimestamp().setColor(util.colors.default).setTitle(`${user.tag}'s Avatar`);
+ const embed = new Embed().setTimestamp().setColor(util.colors.default).setTitle(`${user.tag}'s Avatar`);
guildAvatar
? embed.setImage(guildAvatar).setThumbnail(user.avatarURL(params) ?? defaultAvatar)
: embed.setImage(user.avatarURL(params) ?? defaultAvatar);
diff --git a/src/commands/info/botInfo.ts b/src/commands/info/botInfo.ts
index 3aea3cd..d899a95 100644
--- a/src/commands/info/botInfo.ts
+++ b/src/commands/info/botInfo.ts
@@ -1,6 +1,6 @@
import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
import assert from 'assert';
-import { MessageEmbed, Permissions, version as discordJSVersion } from 'discord.js';
+import { Embed, Permissions, version as discordJSVersion } from 'discord.js';
import * as os from 'os';
const { default: prettyBytes } = await import('pretty-bytes');
assert(prettyBytes);
@@ -39,32 +39,36 @@ export default class BotInfoCommand extends BushCommand {
const currentCommit = (await util.shell('git rev-parse HEAD')).stdout.replace('\n', '');
let repoUrl = (await util.shell('git remote get-url origin')).stdout.replace('\n', '');
if (repoUrl.includes('.git')) repoUrl = repoUrl.substring(0, repoUrl.length - 4);
- const embed = new MessageEmbed()
+ const embed = new Embed()
.setTitle('Bot Info:')
- .addField('**Uptime**', util.humanizeDuration(client.uptime!, 2), true)
- .addField(
- '**Memory Usage**',
- `System: ${prettyBytes(os.totalmem() - os.freemem(), { binary: true })}/${prettyBytes(os.totalmem(), {
+ .addField({ name: '**Uptime**', value: util.humanizeDuration(client.uptime!, 2), inline: true })
+ .addField({
+ name: '**Memory Usage**',
+ value: `System: ${prettyBytes(os.totalmem() - os.freemem(), { binary: true })}/${prettyBytes(os.totalmem(), {
binary: true
})}\nHeap: ${prettyBytes(process.memoryUsage().heapUsed, { binary: true })}/${prettyBytes(
process.memoryUsage().heapTotal,
{ binary: true }
)}`,
- true
- )
- .addField('**CPU Usage**', `${client.stats.cpu}%`, true)
- .addField('**Platform**', Platform[process.platform], true)
- .addField('**Commands Used**', `${client.stats.commandsUsed.toLocaleString()}`, true)
- .addField('**Servers**', client.guilds.cache.size.toLocaleString(), true)
- .addField('**Users**', client.users.cache.size.toLocaleString(), true)
- .addField('**Discord.js Version**', discordJSVersion, true)
- .addField('**Node.js Version**', process.version.slice(1), true)
- .addField('**Commands**', client.commandHandler.modules.size.toLocaleString(), true)
- .addField('**Listeners**', client.listenerHandler.modules.size.toLocaleString(), true)
- .addField('**Inhibitors**', client.inhibitorHandler.modules.size.toLocaleString(), true)
- .addField('**Tasks**', client.taskHandler.modules.size.toLocaleString(), true)
- .addField('**Current Commit**', `[${currentCommit.substring(0, 7)}](${repoUrl}/commit/${currentCommit})`, true)
- .addField('**Developers**', developers, true)
+ inline: true
+ })
+ .addField({ name: '**CPU Usage**', value: `${client.stats.cpu}%`, inline: true })
+ .addField({ name: '**Platform**', value: Platform[process.platform], inline: true })
+ .addField({ name: '**Commands Used**', value: `${client.stats.commandsUsed.toLocaleString()}`, inline: true })
+ .addField({ name: '**Servers**', value: client.guilds.cache.size.toLocaleString(), inline: true })
+ .addField({ name: '**Users**', value: client.users.cache.size.toLocaleString(), inline: true })
+ .addField({ name: '**Discord.js Version**', value: discordJSVersion, inline: true })
+ .addField({ name: '**Node.js Version**', value: process.version.slice(1), inline: true })
+ .addField({ name: '**Commands**', value: client.commandHandler.modules.size.toLocaleString(), inline: true })
+ .addField({ name: '**Listeners**', value: client.listenerHandler.modules.size.toLocaleString(), inline: true })
+ .addField({ name: '**Inhibitors**', value: client.inhibitorHandler.modules.size.toLocaleString(), inline: true })
+ .addField({ name: '**Tasks**', value: client.taskHandler.modules.size.toLocaleString(), inline: true })
+ .addField({
+ name: '**Current Commit**',
+ value: `[${currentCommit.substring(0, 7)}](${repoUrl}/commit/${currentCommit})`,
+ inline: true
+ })
+ .addField({ name: '**Developers**', value: developers, inline: true })
.setTimestamp()
.setColor(util.colors.default);
await message.util.reply({ embeds: [embed] });
diff --git a/src/commands/info/color.ts b/src/commands/info/color.ts
index d385c53..0e1be81 100644
--- a/src/commands/info/color.ts
+++ b/src/commands/info/color.ts
@@ -9,7 +9,7 @@ import {
type BushSlashMessage
} from '#lib';
import assert from 'assert';
-import { ApplicationCommandOptionType, MessageEmbed, Permissions, Role } from 'discord.js';
+import { ApplicationCommandOptionType, Embed, Permissions, Role } from 'discord.js';
import tinycolor from 'tinycolor2';
assert(tinycolor);
@@ -74,12 +74,12 @@ export default class ColorCommand extends BushCommand {
});
}
- const embed = new MessageEmbed()
- .addField('ยป Hexadecimal', color.toHexString())
- .addField('ยป Decimal', `${parseInt(color.toHex(), 16)}`)
- .addField('ยป HSL', this.removePrefixAndParenthesis(color.toHslString()))
- .addField('ยป RGB', this.removePrefixAndParenthesis(color.toRgbString()))
- .setColor(color.toHex() as `#${string}`);
+ const embed = new Embed()
+ .addField({ name: 'ยป Hexadecimal', value: color.toHexString() })
+ .addField({ name: 'ยป Decimal', value: `${parseInt(color.toHex(), 16)}` })
+ .addField({ name: 'ยป HSL', value: this.removePrefixAndParenthesis(color.toHslString()) })
+ .addField({ name: 'ยป RGB', value: this.removePrefixAndParenthesis(color.toRgbString()) })
+ .setColor(parseInt(color.toHex(), 16));
return await message.util.reply({ embeds: [embed] });
}
diff --git a/src/commands/info/guildInfo.ts b/src/commands/info/guildInfo.ts
index afc5111..03f6441 100644
--- a/src/commands/info/guildInfo.ts
+++ b/src/commands/info/guildInfo.ts
@@ -3,11 +3,11 @@ import assert from 'assert';
import { GuildDefaultMessageNotifications, GuildExplicitContentFilter } from 'discord-api-types';
import {
ApplicationCommandOptionType,
+ Embed,
Guild,
GuildMFALevel,
GuildPremiumTier,
GuildVerificationLevel,
- MessageEmbed,
Permissions,
type BaseGuildVoiceChannel,
type GuildPreview,
@@ -74,7 +74,7 @@ export default class GuildInfoCommand extends BushCommand {
if (verifiedGuilds.includes(guild.id as typeof verifiedGuilds[number])) emojis.push(otherEmojis.BushVerified);
if (!isPreview && guild instanceof Guild) {
- if (guild.premiumTier !== 'None') emojis.push(otherEmojis[`Boost${guild.premiumTier}`]);
+ if (guild.premiumTier !== GuildPremiumTier.None) emojis.push(otherEmojis[`BoostTier${guild.premiumTier}`]);
await guild.fetch();
const channels = guild.channels.cache;
@@ -124,14 +124,14 @@ export default class GuildInfoCommand extends BushCommand {
`**Channels:** ${guild.channels.cache.size.toLocaleString()} / 500 (${channelTypes.join(', ')})`,
// subtract 1 for @everyone role
`**Roles:** ${((guild.roles.cache.size ?? 0) - 1).toLocaleString()} / 250`,
- `**Emojis:** ${guild.emojis.cache.size?.toLocaleString() ?? 0} / ${(<any>EmojiTierMap)[guild.premiumTier]}`,
- `**Stickers:** ${guild.stickers.cache.size?.toLocaleString() ?? 0} / ${(<any>StickerTierMap)[guild.premiumTier]}`
+ `**Emojis:** ${guild.emojis.cache.size?.toLocaleString() ?? 0} / ${EmojiTierMap[guild.premiumTier]}`,
+ `**Stickers:** ${guild.stickers.cache.size?.toLocaleString() ?? 0} / ${StickerTierMap[guild.premiumTier]}`
);
guildSecurity.push(
- `**Verification Level**: ${(<any>BushGuildVerificationLevel)[guild.verificationLevel]}`,
- `**Explicit Content Filter:** ${(<any>BushGuildExplicitContentFilter)[guild.explicitContentFilter]}`,
- `**Default Message Notifications:** ${(<any>BushGuildDefaultMessageNotifications)[guild.defaultMessageNotifications]}`,
+ `**Verification Level**: ${BushGuildVerificationLevel[guild.verificationLevel]}`,
+ `**Explicit Content Filter:** ${BushGuildExplicitContentFilter[guild.explicitContentFilter]}`,
+ `**Default Message Notifications:** ${BushGuildDefaultMessageNotifications[guild.defaultMessageNotifications]}`,
`**2FA Required**: ${guild.mfaLevel === GuildMFALevel.Elevated ? 'True' : 'False'}`
);
} else {
@@ -168,17 +168,17 @@ export default class GuildInfoCommand extends BushCommand {
emojis.push(`\n\n${guild.description}`);
}
- const guildInfoEmbed = new MessageEmbed()
+ const guildInfoEmbed = new Embed()
.setTitle(guild.name)
.setColor(util.colors.default)
- .addField('ยป About', guildAbout.join('\n'));
- if (guildStats.length) guildInfoEmbed.addField('ยป Stats', guildStats.join('\n'));
+ .addField({ name: 'ยป About', value: guildAbout.join('\n') });
+ if (guildStats.length) guildInfoEmbed.addField({ name: 'ยป Stats', value: guildStats.join('\n') });
const guildIcon = guild.iconURL({ size: 2048, format: 'png' });
if (guildIcon) {
guildInfoEmbed.setThumbnail(guildIcon);
}
if (!isPreview) {
- guildInfoEmbed.addField('ยป Security', guildSecurity.join('\n'));
+ guildInfoEmbed.addField({ name: 'ยป Security', value: guildSecurity.join('\n') });
}
if (emojis) {
guildInfoEmbed.setDescription(`\u200B${/*zero width space*/ emojis.join(' ')}`);
diff --git a/src/commands/info/help.ts b/src/commands/info/help.ts
index c77b5d2..67f99d1 100644
--- a/src/commands/info/help.ts
+++ b/src/commands/info/help.ts
@@ -6,7 +6,7 @@ import {
AutocompleteInteraction,
ButtonComponent,
ButtonStyle,
- MessageEmbed,
+ Embed,
Permissions
} from 'discord.js';
import Fuse from 'fuse.js';
@@ -68,7 +68,7 @@ export default class HelpCommand extends BushCommand {
: null;
if (!isOwner) args.showHidden = false;
if (!command || command.pseudo) {
- const embed = new MessageEmbed().setColor(util.colors.default).setTimestamp();
+ const embed = new Embed().setColor(util.colors.default).setTimestamp();
embed.setFooter({ text: `For more information about a command use ${prefix}help <command>` });
for (const [, category] of this.handler.categories) {
const categoryFilter = category.filter((command) => {
@@ -84,23 +84,29 @@ export default class HelpCommand extends BushCommand {
.replace(/'(S)/g, (letter) => letter.toLowerCase());
const categoryCommands = categoryFilter.filter((cmd) => cmd.aliases.length > 0).map((cmd) => `\`${cmd.aliases[0]}\``);
if (categoryCommands.length > 0) {
- embed.addField(`${categoryNice}`, `${categoryCommands.join(' ')}`);
+ embed.addField({ name: `${categoryNice}`, value: `${categoryCommands.join(' ')}` });
}
}
return await message.util.reply({ embeds: [embed], components: row.components.length ? [row] : undefined });
}
- const embed = new MessageEmbed()
+ const embed = new Embed()
.setColor(util.colors.default)
.setTitle(`${command.id} Command`)
.setDescription(`${command.description ?? '*This command does not have a description.*'}`);
if (command.usage?.length) {
- embed.addField(`ยป Usage${command.usage.length > 1 ? 's' : ''}`, command.usage.map((u) => `\`${u}\``).join('\n'));
+ embed.addField({
+ name: `ยป Usage${command.usage.length > 1 ? 's' : ''}`,
+ value: command.usage.map((u) => `\`${u}\``).join('\n')
+ });
}
if (command.examples?.length) {
- embed.addField(`ยป Example${command.examples.length > 1 ? 's' : ''}`, command.examples.map((u) => `\`${u}\``).join('\n'));
+ embed.addField({
+ name: `ยป Example${command.examples.length > 1 ? 's' : ''}`,
+ value: command.examples.map((u) => `\`${u}\``).join('\n')
+ });
}
- if (command.aliases?.length > 1) embed.addField('ยป Aliases', `\`${command.aliases.join('` `')}\``);
+ if (command.aliases?.length > 1) embed.addField({ name: 'ยป Aliases', value: `\`${command.aliases.join('` `')}\`` });
if (
command.ownerOnly ||
command.superUserOnly ||
@@ -123,7 +129,7 @@ export default class HelpCommand extends BushCommand {
.map((g) => util.format.inlineCode(client.guilds.cache.find((g1) => g1.id === g)?.name ?? 'Unknown'))
.join(' ')}`
);
- if (restrictions.length) embed.addField('ยป Restrictions', restrictions.join('\n'));
+ if (restrictions.length) embed.addField({ name: 'ยป Restrictions', value: restrictions.join('\n') });
}
const params = { embeds: [embed], components: row.components.length ? [row] : undefined };
diff --git a/src/commands/info/icon.ts b/src/commands/info/icon.ts
index 9602d40..ed9ab0f 100644
--- a/src/commands/info/icon.ts
+++ b/src/commands/info/icon.ts
@@ -1,5 +1,5 @@
import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
-import { MessageEmbed, Permissions } from 'discord.js';
+import { Embed, Permissions } from 'discord.js';
export default class IconCommand extends BushCommand {
constructor() {
@@ -17,7 +17,7 @@ export default class IconCommand extends BushCommand {
}
override async exec(message: BushMessage | BushSlashMessage) {
- const embed = new MessageEmbed()
+ const embed = new Embed()
.setTimestamp()
.setColor(util.colors.default)
.setImage(
diff --git a/src/commands/info/ping.ts b/src/commands/info/ping.ts
index 1a8f542..35e9748 100644
--- a/src/commands/info/ping.ts
+++ b/src/commands/info/ping.ts
@@ -1,5 +1,5 @@
import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
-import { MessageEmbed, Permissions, type Message } from 'discord.js';
+import { Embed, Permissions, type Message } from 'discord.js';
export default class PingCommand extends BushCommand {
public constructor() {
@@ -20,10 +20,10 @@ export default class PingCommand extends BushCommand {
const timestamp: number = message.editedTimestamp ? message.editedTimestamp : message.createdTimestamp;
const botLatency = `${'```'}\n ${Math.round(sentMessage.createdTimestamp - timestamp)}ms ${'```'}`;
const apiLatency = `${'```'}\n ${Math.round(message.client.ws.ping)}ms ${'```'}`;
- const embed = new MessageEmbed()
+ const embed = new Embed()
.setTitle('Pong! ๐Ÿ“')
- .addField('Bot Latency', botLatency, true)
- .addField('API Latency', apiLatency, true)
+ .addField({ name: 'Bot Latency', value: botLatency, inline: true })
+ .addField({ name: 'API Latency', value: apiLatency, inline: true })
.setFooter({ text: message.author.username, iconURL: message.author.displayAvatarURL() })
.setColor(util.colors.default)
.setTimestamp();
@@ -39,10 +39,10 @@ export default class PingCommand extends BushCommand {
const timestamp2 = await message.interaction.fetchReply().then((m) => (m as Message).createdTimestamp);
const botLatency = `${'```'}\n ${Math.round(timestamp2 - timestamp1)}ms ${'```'}`;
const apiLatency = `${'```'}\n ${Math.round(client.ws.ping)}ms ${'```'}`;
- const embed = new MessageEmbed()
+ const embed = new Embed()
.setTitle('Pong! ๐Ÿ“')
- .addField('Bot Latency', botLatency, true)
- .addField('API Latency', apiLatency, true)
+ .addField({ name: 'Bot Latency', value: botLatency, inline: true })
+ .addField({ name: 'API Latency', value: apiLatency, inline: true })
.setFooter({
text: message.interaction.user.username,
iconURL: message.interaction.user.displayAvatarURL()
diff --git a/src/commands/info/pronouns.ts b/src/commands/info/pronouns.ts
index e390865..9ba2a2a 100644
--- a/src/commands/info/pronouns.ts
+++ b/src/commands/info/pronouns.ts
@@ -1,5 +1,5 @@
import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib';
-import { ApplicationCommandOptionType, MessageEmbed, Permissions } from 'discord.js';
+import { ApplicationCommandOptionType, Embed, Permissions } from 'discord.js';
export default class PronounsCommand extends BushCommand {
public constructor() {
@@ -42,7 +42,7 @@ export default class PronounsCommand extends BushCommand {
} else {
return await message.util.reply({
embeds: [
- new MessageEmbed({
+ new Embed({
title: `${author ? 'Your' : `${util.discord.escapeMarkdown(user.tag)}'s`} pronouns:`,
description: pronouns,
footer: {
diff --git a/src/commands/info/snowflake.ts b/src/commands/info/snowflake.ts
index d9ad108..feaa724 100644
--- a/src/commands/info/snowflake.ts
+++ b/src/commands/info/snowflake.ts
@@ -1,7 +1,7 @@
import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib';
import {
ApplicationCommandOptionType,
- MessageEmbed,
+ Embed,
Permissions,
SnowflakeUtil,
type DeconstructedSnowflake,
@@ -37,7 +37,7 @@ export default class SnowflakeCommand extends BushCommand {
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);
+ const snowflakeEmbed = new Embed().setTitle('Unknown :snowflake:').setColor(util.colors.default);
// Channel
if (client.channels.cache.has(snowflake)) {
@@ -61,7 +61,7 @@ export default class SnowflakeCommand extends BushCommand {
);
snowflakeEmbed.setTitle(`:snowflake: ${util.discord.escapeMarkdown(channel.name)} \`[Channel]\``);
}
- snowflakeEmbed.addField('ยป Channel Info', channelInfo.join('\n'));
+ snowflakeEmbed.addField({ name: 'ยป Channel Info', value: channelInfo.join('\n') });
}
// Guild
@@ -75,7 +75,7 @@ export default class SnowflakeCommand extends BushCommand {
`**Members:** ${guild.memberCount?.toLocaleString()}`
];
if (guild.icon) snowflakeEmbed.setThumbnail(guild.iconURL({ size: 2048 })!);
- snowflakeEmbed.addField('ยป Server Info', guildInfo.join('\n'));
+ snowflakeEmbed.addField({ name: 'ยป Server Info', value: guildInfo.join('\n') });
snowflakeEmbed.setTitle(`:snowflake: ${util.discord.escapeMarkdown(guild.name)} \`[Server]\``);
}
@@ -85,7 +85,7 @@ export default class SnowflakeCommand extends BushCommand {
const user: User = (client.users.cache.get(snowflake) ?? fetchedUser)!;
const userInfo = [`**Name:** <@${user.id}> (${util.discord.escapeMarkdown(user.tag)})`];
if (user.avatar) snowflakeEmbed.setThumbnail(user.avatarURL({ size: 2048 })!);
- snowflakeEmbed.addField('ยป User Info', userInfo.join('\n'));
+ snowflakeEmbed.addField({ name: 'ยป User Info', value: userInfo.join('\n') });
snowflakeEmbed.setTitle(`:snowflake: ${util.discord.escapeMarkdown(user.tag)} \`[User]\``);
}
@@ -97,7 +97,7 @@ export default class SnowflakeCommand extends BushCommand {
`**Animated:** ${emoji.animated}`
];
if (emoji.url) snowflakeEmbed.setThumbnail(emoji.url);
- snowflakeEmbed.addField('ยป Emoji Info', emojiInfo.join('\n'));
+ snowflakeEmbed.addField({ name: 'ยป Emoji Info', value: emojiInfo.join('\n') });
snowflakeEmbed.setTitle(`:snowflake: ${util.discord.escapeMarkdown(emoji.name ?? 'ยฏ\\_(ใƒ„)_/ยฏ')} \`[Emoji]\``);
}
@@ -113,7 +113,7 @@ export default class SnowflakeCommand extends BushCommand {
`**Hex Color:** ${role.hexColor}`
];
if (role.color) snowflakeEmbed.setColor(role.color);
- snowflakeEmbed.addField('ยป Role Info', roleInfo.join('\n'));
+ snowflakeEmbed.addField({ name: 'ยป Role Info', value: roleInfo.join('\n') });
snowflakeEmbed.setTitle(`:snowflake: ${util.discord.escapeMarkdown(role.name)} \`[Role]\``);
}
@@ -126,7 +126,7 @@ export default class SnowflakeCommand extends BushCommand {
`**Process ID:** ${deconstructedSnowflake.processId}`,
`**Increment:** ${deconstructedSnowflake.increment}`
];
- snowflakeEmbed.addField('ยป Snowflake Info', snowflakeInfo.join('\n'));
+ snowflakeEmbed.addField({ name: 'ยป Snowflake Info', value: snowflakeInfo.join('\n') });
return await message.util.reply({ embeds: [snowflakeEmbed] });
}
diff --git a/src/commands/info/userInfo.ts b/src/commands/info/userInfo.ts
index 38c9ea6..b8d97a8 100644
--- a/src/commands/info/userInfo.ts
+++ b/src/commands/info/userInfo.ts
@@ -7,7 +7,7 @@ import {
type BushSlashMessage,
type BushUser
} from '#lib';
-import { ActivityType, ApplicationCommandOptionType, MessageEmbed, Permissions, UserFlags } from 'discord.js';
+import { ActivityType, ApplicationCommandOptionType, Embed, Permissions, UserFlags } from 'discord.js';
// TODO: Add bot information
export default class UserInfoCommand extends BushCommand {
@@ -56,7 +56,7 @@ export default class UserInfoCommand extends BushCommand {
const emojis = [];
const superUsers = util.getShared('superUsers');
- const userEmbed: MessageEmbed = new MessageEmbed()
+ const userEmbed: Embed = new Embed()
.setTitle(util.discord.escapeMarkdown(user.tag))
.setThumbnail(user.displayAvatarURL({ size: 2048, format: 'png' }))
.setTimestamp();
@@ -101,7 +101,7 @@ export default class UserInfoCommand extends BushCommand {
const pronouns = await Promise.race([util.getPronounsOf(user), util.sleep(2)]);
if (pronouns && typeof pronouns === 'string') generalInfo.push(`**Pronouns:** ${pronouns}`);
- userEmbed.addField('ยป General Info', generalInfo.join('\n'));
+ userEmbed.addField({ name: 'ยป General Info', value: generalInfo.join('\n') });
// Server User Info
const serverUserInfo = [];
@@ -118,7 +118,9 @@ export default class UserInfoCommand extends BushCommand {
serverUserInfo.push(`**General Deletions:** โ…“`);
if (member?.nickname) serverUserInfo.push(`**Nickname:** ${util.discord.escapeMarkdown(member?.nickname)}`);
if (serverUserInfo.length)
- userEmbed.addField('ยป Server Info', serverUserInfo.join('\n')).setColor(member?.displayColor ?? util.colors.default);
+ userEmbed
+ .addField({ name: 'ยป Server Info', value: serverUserInfo.join('\n') })
+ .setColor(member?.displayColor ?? util.colors.default);
// User Presence Info
if (member?.presence?.status || member?.presence?.clientStatus || member?.presence?.activities) {
@@ -143,7 +145,7 @@ export default class UserInfoCommand extends BushCommand {
presenceInfo.push(`**Activit${activitiesNames.length - 1 ? 'ies' : 'y'}:** ${util.oxford(activitiesNames, 'and', '')}`);
if (customStatus && customStatus.length)
presenceInfo.push(`**Custom Status:** ${util.discord.escapeMarkdown(customStatus)}`);
- userEmbed.addField('ยป Presence', presenceInfo.join('\n'));
+ userEmbed.addField({ name: 'ยป Presence', value: presenceInfo.join('\n') });
enum statusEmojis {
online = '787550449435803658',
@@ -164,7 +166,7 @@ export default class UserInfoCommand extends BushCommand {
.filter((role) => role.name !== '@everyone')
.sort((role1, role2) => role2.position - role1.position)
.map((role) => `${role}`);
- userEmbed.addField(`ยป Role${roles.length - 1 ? 's' : ''} [${roles.length}]`, roles.join(', '));
+ userEmbed.addField({ name: `ยป Role${roles.length - 1 ? 's' : ''} [${roles.length}]`, value: roles.join(', ') });
}
// Important Perms
@@ -179,7 +181,7 @@ export default class UserInfoCommand extends BushCommand {
});
}
- if (perms.length) userEmbed.addField('ยป Important Perms', perms.join(' '));
+ if (perms.length) userEmbed.addField({ name: 'ยป Important Perms', value: perms.join(' ') });
if (emojis) userEmbed.setDescription(`\u200B${emojis.join(' ')}`); // zero width space
return userEmbed;
}
diff --git a/src/commands/leveling/leaderboard.ts b/src/commands/leveling/leaderboard.ts
index 2e0ce5d..3a00036 100644
--- a/src/commands/leveling/leaderboard.ts
+++ b/src/commands/leveling/leaderboard.ts
@@ -1,5 +1,5 @@
import { BushCommand, ButtonPaginator, Level, type ArgType, type BushMessage, type BushSlashMessage } from '#lib';
-import { ApplicationCommandOptionType, MessageEmbed, Permissions } from 'discord.js';
+import { ApplicationCommandOptionType, Embed, Permissions } from 'discord.js';
export default class LeaderboardCommand extends BushCommand {
public constructor() {
@@ -43,9 +43,7 @@ export default class LeaderboardCommand extends BushCommand {
(val, index) => `\`${index + 1}\` <@${val.user}> - Level ${val.level} (${val.xp.toLocaleString()} xp)`
);
const chunked = util.chunk(mappedRanks, 25);
- const embeds = chunked.map((c) =>
- new MessageEmbed().setTitle(`${message.guild!.name}'s Leaderboard`).setDescription(c.join('\n'))
- );
+ const embeds = chunked.map((c) => new Embed().setTitle(`${message.guild!.name}'s Leaderboard`).setDescription(c.join('\n')));
return await ButtonPaginator.send(message, embeds, undefined, true, args?.page ?? undefined);
}
}
diff --git a/src/commands/moderation/evidence.ts b/src/commands/moderation/evidence.ts
index 155d804..84138f6 100644
--- a/src/commands/moderation/evidence.ts
+++ b/src/commands/moderation/evidence.ts
@@ -1,5 +1,6 @@
import { BushCommand, ModLog, type BushMessage, type BushSlashMessage } from '#lib';
-import { type ArgumentOptions, type Flag } from 'discord-akairo';
+import { ArgumentGeneratorReturn } from 'discord-akairo';
+import { ArgumentTypeCasterReturn } from 'discord-akairo/dist/src/struct/commands/arguments/Argument';
import { ApplicationCommandOptionType, Permissions } from 'discord.js';
export default class EvidenceCommand extends BushCommand {
@@ -35,8 +36,8 @@ export default class EvidenceCommand extends BushCommand {
});
}
- override *args(message: BushMessage): IterableIterator<ArgumentOptions | Flag> {
- const case_id = yield {
+ override *args(message: BushMessage): ArgumentGeneratorReturn {
+ const case_id: ArgumentTypeCasterReturn<'string'> = yield {
id: 'case_id',
type: 'string',
prompt: {
@@ -46,7 +47,7 @@ export default class EvidenceCommand extends BushCommand {
}
};
- const evidence = yield {
+ const evidence: ArgumentTypeCasterReturn<'string'> = yield {
id: 'evidence',
type: 'string',
match: 'restContent',
diff --git a/src/commands/moderation/lockdown.ts b/src/commands/moderation/lockdown.ts
index 350ce26..ea7c08b 100644
--- a/src/commands/moderation/lockdown.ts
+++ b/src/commands/moderation/lockdown.ts
@@ -11,7 +11,7 @@ import {
type OptionalArgType
} from '#lib';
import assert from 'assert';
-import { ApplicationCommandOptionType, Collection, Permissions } from 'discord.js';
+import { ApplicationCommandOptionType, ChannelType, Collection, Permissions } from 'discord.js';
export default class LockdownCommand extends BushCommand {
public constructor() {
@@ -28,7 +28,13 @@ export default class LockdownCommand extends BushCommand {
type: util.arg.union('textChannel', 'newsChannel', 'threadChannel'),
prompt: 'What channel would you like to lockdown?',
slashType: ApplicationCommandOptionType.Channel,
- channelTypes: ['GuildText', 'GuildNews', 'GuildNewsThread', 'GuildPublicThread', 'GuildPrivateThread'],
+ channelTypes: [
+ ChannelType.GuildText,
+ ChannelType.GuildNews,
+ ChannelType.GuildNewsThread,
+ ChannelType.GuildPublicThread,
+ ChannelType.GuildPrivateThread
+ ],
optional: true
},
{
diff --git a/src/commands/moderation/modlog.ts b/src/commands/moderation/modlog.ts
index e7b3576..d6ecc37 100644
--- a/src/commands/moderation/modlog.ts
+++ b/src/commands/moderation/modlog.ts
@@ -1,5 +1,5 @@
import { BushCommand, ButtonPaginator, ModLog, type ArgType, type BushMessage, type BushSlashMessage } from '#lib';
-import { ApplicationCommandOptionType, MessageEmbed, Permissions, User } from 'discord.js';
+import { ApplicationCommandOptionType, Embed, Permissions, User } from 'discord.js';
export default class ModlogCommand extends BushCommand {
public constructor() {
@@ -57,7 +57,7 @@ export default class ModlogCommand extends BushCommand {
const chunked: string[][] = util.chunk(niceLogs, 4);
const embedPages = chunked.map(
(chunk) =>
- new MessageEmbed({
+ new Embed({
title: `${foundUser.tag}'s Mod Logs`,
description: chunk.join('\nโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”\n'),
color: util.colors.default
diff --git a/src/commands/moderation/slowmode.ts b/src/commands/moderation/slowmode.ts
index a724006..96c3881 100644
--- a/src/commands/moderation/slowmode.ts
+++ b/src/commands/moderation/slowmode.ts
@@ -29,7 +29,7 @@ export default class SlowmodeCommand extends BushCommand {
retry: '{error} Choose a valid channel.',
optional: true,
slashType: ApplicationCommandOptionType.Channel,
- channelTypes: ['GuildText', 'GuildPrivateThread', 'GuildPublicThread']
+ channelTypes: [ChannelType.GuildText, ChannelType.GuildPrivateThread, ChannelType.GuildPublicThread]
}
],
slash: true,
diff --git a/src/commands/moderation/unlockdown.ts b/src/commands/moderation/unlockdown.ts
index d7ba5ee..ea36b67 100644
--- a/src/commands/moderation/unlockdown.ts
+++ b/src/commands/moderation/unlockdown.ts
@@ -1,6 +1,6 @@
import { LockdownCommand } from '#commands';
import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage, type OptionalArgType } from '#lib';
-import { ApplicationCommandOptionType, Permissions } from 'discord.js';
+import { ApplicationCommandOptionType, ChannelType, Permissions } from 'discord.js';
export default class UnlockdownCommand extends BushCommand {
public constructor() {
@@ -17,7 +17,13 @@ export default class UnlockdownCommand extends BushCommand {
type: util.arg.union('textChannel', 'newsChannel', 'threadChannel'),
prompt: 'What channel would you like to unlockdown?',
slashType: ApplicationCommandOptionType.Channel,
- channelTypes: ['GuildText', 'GuildNews', 'GuildNewsThread', 'GuildPublicThread', 'GuildPrivateThread'],
+ channelTypes: [
+ ChannelType.GuildText,
+ ChannelType.GuildNews,
+ ChannelType.GuildNewsThread,
+ ChannelType.GuildPublicThread,
+ ChannelType.GuildPrivateThread
+ ],
optional: true
},
{
diff --git a/src/commands/moulberry-bush/capePermissions.ts b/src/commands/moulberry-bush/capePermissions.ts
index 19c1381..7f261d5 100644
--- a/src/commands/moulberry-bush/capePermissions.ts
+++ b/src/commands/moulberry-bush/capePermissions.ts
@@ -1,5 +1,5 @@
import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib';
-import { ApplicationCommandOptionType, MessageEmbed, Permissions } from 'discord.js';
+import { ApplicationCommandOptionType, Embed, Permissions } from 'discord.js';
import got from 'got';
export default class CapePermissionsCommand extends BushCommand {
@@ -66,7 +66,7 @@ export default class CapePermissionsCommand extends BushCommand {
if (index == null)
return await message.util.reply(`${util.emojis.error} \`${args.ign}\` does not appear to have any capes.`);
const userPerm: string[] = capePerms.perms[index].perms;
- const embed = new MessageEmbed()
+ const embed = new Embed()
.setTitle(`${args.ign}'s Capes`)
.setDescription(userPerm.join('\n'))
.setColor(util.colors.default);
diff --git a/src/commands/moulberry-bush/capes.ts b/src/commands/moulberry-bush/capes.ts
index 3a956fc..7965713 100644
--- a/src/commands/moulberry-bush/capes.ts
+++ b/src/commands/moulberry-bush/capes.ts
@@ -1,6 +1,7 @@
import { BushCommand, ButtonPaginator, DeleteButton, type BushMessage, type OptionalArgType } from '#lib';
import assert from 'assert';
-import { ApplicationCommandOptionType, AutocompleteInteraction, Permissions, type MessageEmbedOptions } from 'discord.js';
+import { APIEmbed } from 'discord-api-types';
+import { ApplicationCommandOptionType, AutocompleteInteraction, Permissions } from 'discord.js';
import Fuse from 'fuse.js';
import got from 'got';
@@ -87,16 +88,16 @@ export default class CapesCommand extends BushCommand {
await message.util.reply(`${util.emojis.error} Cannot find a cape called \`${args.cape}\`.`);
}
} else {
- const embeds: MessageEmbedOptions[] = sortedCapes.map(this.makeEmbed);
+ const embeds: APIEmbed[] = sortedCapes.map(this.makeEmbed);
await ButtonPaginator.send(message, embeds, null);
}
}
- private makeEmbed(cape: { name: string; url: string; index: number; purchasable?: boolean | undefined }): MessageEmbedOptions {
+ private makeEmbed(cape: { name: string; url: string; index: number; purchasable?: boolean | undefined }): APIEmbed {
return {
title: `${cape.name} cape`,
color: util.colors.default,
- timestamp: Date.now(),
+ timestamp: new Date().toISOString(),
image: { url: cape.url },
description: cape.purchasable ? ':money_with_wings: **purchasable** :money_with_wings:' : undefined
};
diff --git a/src/commands/moulberry-bush/moulHammer.ts b/src/commands/moulberry-bush/moulHammer.ts
index 4cf3f35..6aa5ca3 100644
--- a/src/commands/moulberry-bush/moulHammer.ts
+++ b/src/commands/moulberry-bush/moulHammer.ts
@@ -1,5 +1,5 @@
import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib';
-import { ApplicationCommandOptionType, MessageEmbed, Permissions } from 'discord.js';
+import { ApplicationCommandOptionType, Embed, Permissions } from 'discord.js';
export default class MoulHammerCommand extends BushCommand {
public constructor() {
@@ -29,7 +29,7 @@ export default class MoulHammerCommand extends BushCommand {
public override async exec(message: BushMessage | BushSlashMessage, { user }: { user: ArgType<'user'> }) {
await message.delete();
- const embed = new MessageEmbed()
+ const embed = new Embed()
.setTitle('L')
.setDescription(`${user.username} got moul'ed <:wideberry1:756223352598691942><:wideberry2:756223336832303154>`)
.setColor(util.colors.purple);
diff --git a/src/commands/moulberry-bush/report.ts b/src/commands/moulberry-bush/report.ts
index f2c10bc..a2a18ef 100644
--- a/src/commands/moulberry-bush/report.ts
+++ b/src/commands/moulberry-bush/report.ts
@@ -1,6 +1,6 @@
import { AllowedMentions, BushCommand, type ArgType, type BushMessage } from '#lib';
import assert from 'assert';
-import { ApplicationCommandOptionType, MessageEmbed, Permissions } from 'discord.js';
+import { ApplicationCommandOptionType, Embed, Permissions } from 'discord.js';
import moment from 'moment';
assert(moment);
@@ -62,7 +62,7 @@ export default class ReportCommand extends BushCommand {
);
//The formatting of the report is mostly copied from carl since it is pretty good when it actually works
- const reportEmbed = new MessageEmbed()
+ const reportEmbed = new Embed()
.setFooter({ text: `Reporter ID: ${message.author.id} Reported ID: ${member.user.id}` })
.setTimestamp()
.setAuthor({
@@ -72,29 +72,29 @@ export default class ReportCommand extends BushCommand {
.setTitle('New Report')
.setColor(util.colors.red)
.setDescription(evidence)
- .addField(
- 'Reporter',
- `**Name:**${message.author.tag} <@${message.author.id}>\n**Joined:** ${moment(
+ .addField({
+ name: 'Reporter',
+ value: `**Name:**${message.author.tag} <@${message.author.id}>\n**Joined:** ${moment(
message.member!.joinedTimestamp
).fromNow()}\n**Created:** ${moment(message.author.createdTimestamp).fromNow()}\n**Sent From**: <#${
message.channel.id
}> [Jump to context](${message.url})`,
- true
- )
- .addField(
- 'Reported User',
- `**Name:**${member.user.tag} <@${member.user.id}>\n**Joined:** ${moment(
+ inline: true
+ })
+ .addField({
+ name: 'Reported User',
+ value: `**Name:**${member.user.tag} <@${member.user.id}>\n**Joined:** ${moment(
member.joinedTimestamp
).fromNow()}\n**Created:** ${moment(member.user.createdTimestamp).fromNow()}`,
- true
- );
+ inline: true
+ });
if (message.attachments.size > 0) {
const fileName = message.attachments.first()!.name!.toLowerCase();
if (fileName.endsWith('.png') || fileName.endsWith('.jpg') || fileName.endsWith('.gif') || fileName.endsWith('.webp')) {
reportEmbed.setImage(message.attachments.first()!.url);
} else {
- reportEmbed.addField('Attachment', message.attachments.first()!.url);
+ reportEmbed.addField({ name: 'Attachment', value: message.attachments.first()!.url });
}
}
await reportChannel.send({ embeds: [reportEmbed] }).then(async (ReportMessage) => {
diff --git a/src/commands/moulberry-bush/rule.ts b/src/commands/moulberry-bush/rule.ts
index 1bfcfe7..dfb65f3 100644
--- a/src/commands/moulberry-bush/rule.ts
+++ b/src/commands/moulberry-bush/rule.ts
@@ -1,5 +1,5 @@
import { AllowedMentions, BushCommand, BushSlashMessage, type BushMessage, type OptionalArgType } from '#lib';
-import { ApplicationCommandOptionType, MessageEmbed, Permissions } from 'discord.js';
+import { ApplicationCommandOptionType, Embed, Permissions } from 'discord.js';
const rules = [
{
@@ -95,8 +95,8 @@ export default class RuleCommand extends BushCommand {
message: BushMessage | BushSlashMessage,
{ rule, user }: { rule: OptionalArgType<'integer'>; user: OptionalArgType<'user'> }
) {
- const rulesEmbed = new MessageEmbed()
- .setColor('#ef3929')
+ const rulesEmbed = new Embed()
+ .setColor(0xef3929)
.setFooter({
text: `Triggered by ${message.author.tag}`,
iconURL: message.author.avatarURL() ?? undefined
@@ -108,10 +108,10 @@ export default class RuleCommand extends BushCommand {
}
if (rule) {
if (rules[rule - 1]?.title && rules[rule - 1]?.description)
- rulesEmbed.addField(rules[rule - 1].title, rules[rule - 1].description);
+ rulesEmbed.addField({ name: rules[rule - 1].title, value: rules[rule - 1].description });
} else {
for (let i = 0; i < rules.length; i++) {
- if (rules[i]?.title && rules[i]?.description) rulesEmbed.addField(rules[i].title, rules[i].description);
+ if (rules[i]?.title && rules[i]?.description) rulesEmbed.addField({ name: rules[i].title, value: rules[i].description });
}
}
await message.util.send({
diff --git a/src/commands/moulberry-bush/serverStatus.ts b/src/commands/moulberry-bush/serverStatus.ts
index 28b38a5..435b99e 100644
--- a/src/commands/moulberry-bush/serverStatus.ts
+++ b/src/commands/moulberry-bush/serverStatus.ts
@@ -1,6 +1,6 @@
import { BushCommand, type BushMessage } from '#lib';
import assert from 'assert';
-import { MessageEmbed, Permissions } from 'discord.js';
+import { Embed, Permissions } from 'discord.js';
import got from 'got';
assert(got);
@@ -20,7 +20,7 @@ export default class ServerStatusCommand extends BushCommand {
}
public override async exec(message: BushMessage) {
- const msgEmbed: MessageEmbed = new MessageEmbed()
+ const msgEmbed: Embed = new Embed()
.setTitle('Server status')
.setDescription(`Checking server:\n${util.emojis.loading}`)
.setColor(util.colors.default)
@@ -38,7 +38,7 @@ export default class ServerStatusCommand extends BushCommand {
await message.util.edit({
embeds: [
msgEmbed
- .addField('Status', 'The server is online, all features related to prices will likely work.')
+ .addField({ name: 'Status', value: 'The server is online, all features related to prices will likely work.' })
.setColor(util.colors.success)
]
});
@@ -46,10 +46,11 @@ export default class ServerStatusCommand extends BushCommand {
await message.util.edit({
embeds: [
msgEmbed
- .addField(
- 'Status',
- "It appears Moulberry's server is offline, this means that everything related to prices will likely not work."
- )
+ .addField({
+ name: 'Status',
+ value:
+ "It appears Moulberry's server is offline, this means that everything related to prices will likely not work."
+ })
.setColor(util.colors.error)
]
});
diff --git a/src/commands/utilities/activity.ts b/src/commands/utilities/activity.ts
index 948f82a..5a56978 100644
--- a/src/commands/utilities/activity.ts
+++ b/src/commands/utilities/activity.ts
@@ -94,7 +94,7 @@ export default class ActivityCommand extends BushCommand {
type: 'voiceChannel',
prompt: 'What channel would you like to use?',
slashType: ApplicationCommandOptionType.Channel,
- channelTypes: ['GuildVoice'],
+ channelTypes: [ChannelType.GuildVoice],
only: 'slash'
},
{
diff --git a/src/commands/utilities/calculator.ts b/src/commands/utilities/calculator.ts
index df79cc2..7492fc5 100644
--- a/src/commands/utilities/calculator.ts
+++ b/src/commands/utilities/calculator.ts
@@ -1,6 +1,6 @@
import { AllowedMentions, BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
import assert from 'assert';
-import { ApplicationCommandOptionType, MessageEmbed } from 'discord.js';
+import { ApplicationCommandOptionType, Embed } from 'discord.js';
import { evaluate } from 'mathjs';
assert(evaluate);
@@ -31,18 +31,21 @@ export default class CalculatorCommand extends BushCommand {
}
public override async exec(message: BushMessage | BushSlashMessage, args: { expression: string }) {
- const decodedEmbed = new MessageEmbed().addField('๐Ÿ“ฅ Input', await util.inspectCleanRedactCodeblock(args.expression, 'mma'));
+ const decodedEmbed = new Embed().addField({
+ name: '๐Ÿ“ฅ Input',
+ value: await util.inspectCleanRedactCodeblock(args.expression, 'mma')
+ });
try {
const calculated = /^(9\s*?\+\s*?10)|(10\s*?\+\s*?9)$/.test(args.expression) ? '21' : evaluate(args.expression);
decodedEmbed
.setTitle(`${util.emojis.successFull} Successfully Calculated Expression`)
.setColor(util.colors.success)
- .addField('๐Ÿ“ค Output', await util.inspectCleanRedactCodeblock(calculated.toString(), 'mma'));
+ .addField({ name: '๐Ÿ“ค Output', value: await util.inspectCleanRedactCodeblock(calculated.toString(), 'mma') });
} catch (error) {
decodedEmbed
.setTitle(`${util.emojis.errorFull} Unable to Calculate Expression`)
.setColor(util.colors.error)
- .addField(`๐Ÿ“ค Error`, await util.inspectCleanRedactCodeblock(`${error.name}: ${error.message}`, 'js'));
+ .addField({ name: `๐Ÿ“ค Error`, value: await util.inspectCleanRedactCodeblock(`${error.name}: ${error.message}`, 'js') });
}
return await message.util.reply({ embeds: [decodedEmbed], allowedMentions: AllowedMentions.none() });
}
diff --git a/src/commands/utilities/decode.ts b/src/commands/utilities/decode.ts
index f5d8920..00420da 100644
--- a/src/commands/utilities/decode.ts
+++ b/src/commands/utilities/decode.ts
@@ -1,6 +1,6 @@
import { AllowedMentions, BushCommand, type BushMessage } from '#lib';
import { type AkairoMessage } from 'discord-akairo';
-import { ApplicationCommandOptionType, MessageEmbed } from 'discord.js';
+import { ApplicationCommandOptionType, Embed } from 'discord.js';
const encodingTypesArray = ['ascii', 'utf8', 'utf-8', 'utf16le', 'ucs2', 'ucs-2', 'base64', 'latin1', 'binary', 'hex'];
const encodingTypesString = encodingTypesArray.map((e) => `\`${e}\``).join(', ');
@@ -53,16 +53,19 @@ export default class DecodeCommand extends BushCommand {
{ from, to, data }: { from: BufferEncoding; to: BufferEncoding; data: string }
) {
const encodeOrDecode = util.capitalizeFirstLetter(message?.util?.parsed?.alias ?? 'decoded');
- const decodedEmbed = new MessageEmbed()
+ const decodedEmbed = new Embed()
.setTitle(`${encodeOrDecode} Information`)
- .addField('๐Ÿ“ฅ Input', await util.inspectCleanRedactCodeblock(data));
+ .addField({ name: '๐Ÿ“ฅ Input', value: await util.inspectCleanRedactCodeblock(data) });
try {
const decoded = Buffer.from(data, from).toString(to);
- decodedEmbed.setColor(util.colors.success).addField('๐Ÿ“ค Output', await util.inspectCleanRedactCodeblock(decoded));
- } catch (error) {
decodedEmbed
- .setColor(util.colors.error)
- .addField(`๐Ÿ“ค Error ${encodeOrDecode.slice(1)}ing`, await util.inspectCleanRedactCodeblock(error?.stack ?? error));
+ .setColor(util.colors.success)
+ .addField({ name: '๐Ÿ“ค Output', value: await util.inspectCleanRedactCodeblock(decoded) });
+ } catch (error) {
+ decodedEmbed.setColor(util.colors.error).addField({
+ name: `๐Ÿ“ค Error ${encodeOrDecode.slice(1)}ing`,
+ value: await util.inspectCleanRedactCodeblock(error?.stack ?? error)
+ });
}
return await message.util.reply({ embeds: [decodedEmbed], allowedMentions: AllowedMentions.none() });
}
diff --git a/src/commands/utilities/price.ts b/src/commands/utilities/price.ts
index 9fb79bc..2df70b7 100644
--- a/src/commands/utilities/price.ts
+++ b/src/commands/utilities/price.ts
@@ -1,6 +1,6 @@
import { BushCommand, type BushMessage } from '#lib';
import assert from 'assert';
-import { ApplicationCommandOptionType, AutocompleteInteraction, MessageEmbed, Permissions } from 'discord.js';
+import { ApplicationCommandOptionType, AutocompleteInteraction, Embed, Permissions } from 'discord.js';
import Fuse from 'fuse.js';
import got from 'got';
@@ -58,7 +58,7 @@ export default class PriceCommand extends BushCommand {
])) as [Bazaar, LowestBIN, LowestBIN, AuctionAverages];
let parsedItem = item.toString().toUpperCase().replace(/ /g, '_').replace(/'S/g, '');
- const priceEmbed = new MessageEmbed();
+ const priceEmbed = new Embed();
if (bazaar?.success === false) errors.push('bazaar');
@@ -86,17 +86,17 @@ export default class PriceCommand extends BushCommand {
// if its a bazaar item then it there should not be any ah data
if (bazaar['products']?.[parsedItem]) {
- const bazaarPriceEmbed = new MessageEmbed()
+ const bazaarPriceEmbed = new Embed()
.setColor(errors?.length ? util.colors.warn : util.colors.success)
.setTitle(`Bazaar Information for **${parsedItem}**`)
- .addField('Sell Price', addBazaarInformation('sellPrice', 2, true))
- .addField('Buy Price', addBazaarInformation('buyPrice', 2, true))
- .addField(
- 'Margin',
- (+addBazaarInformation('buyPrice', 2, false) - +addBazaarInformation('sellPrice', 2, false)).toLocaleString()
- )
- .addField('Current Sell Orders', addBazaarInformation('sellOrders', 0, true))
- .addField('Current Buy Orders', addBazaarInformation('buyOrders', 0, true));
+ .addField({ name: 'Sell Price', value: addBazaarInformation('sellPrice', 2, true) })
+ .addField({ name: 'Buy Price', value: addBazaarInformation('buyPrice', 2, true) })
+ .addField({
+ name: 'Margin',
+ value: (+addBazaarInformation('buyPrice', 2, false) - +addBazaarInformation('sellPrice', 2, false)).toLocaleString()
+ })
+ .addField({ name: 'Current Sell Orders', value: addBazaarInformation('sellOrders', 0, true) })
+ .addField({ name: 'Current Buy Orders', value: addBazaarInformation('buyOrders', 0, true) });
return await message.util.reply({ embeds: [bazaarPriceEmbed] });
}
@@ -107,7 +107,7 @@ export default class PriceCommand extends BushCommand {
.setTitle(`Price Information for \`${parsedItem}\``)
.setFooter({ text: 'All information is based on the last 3 days.' });
} else {
- const errorEmbed = new MessageEmbed();
+ const errorEmbed = new Embed();
errorEmbed
.setColor(util.colors.error)
.setDescription(`${util.emojis.error} \`${parsedItem}\` is not a valid item id, or it has no auction data.`);
@@ -136,7 +136,10 @@ export default class PriceCommand extends BushCommand {
}
function addPrice(name: string, price: number | undefined) {
if (price)
- priceEmbed.addField(name, price.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 }));
+ priceEmbed.addField({
+ name: name,
+ value: price.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })
+ });
}
}
diff --git a/src/commands/utilities/reminders.ts b/src/commands/utilities/reminders.ts
index 40ec9a2..369a1a5 100644
--- a/src/commands/utilities/reminders.ts
+++ b/src/commands/utilities/reminders.ts
@@ -1,6 +1,7 @@
import { BushCommand, ButtonPaginator, Reminder, type BushMessage, type BushSlashMessage } from '#lib';
import assert from 'assert';
-import { Permissions, type MessageEmbedOptions } from 'discord.js';
+import { APIEmbed } from 'discord-api-types';
+import { Permissions } from 'discord.js';
import { Op } from 'sequelize';
assert(Op);
@@ -26,7 +27,7 @@ export default class RemindersCommand extends BushCommand {
const formattedReminders = reminders.map((reminder) => `${util.timestamp(reminder.expires, 't')} - ${reminder.content}`);
const chunked = util.chunk(formattedReminders, 15);
- const embeds: MessageEmbedOptions[] = chunked.map((chunk) => ({
+ const embeds: APIEmbed[] = chunked.map((chunk) => ({
title: `Reminders`,
description: chunk.join('\n'),
color: util.colors.default
diff --git a/src/commands/utilities/suicide.ts b/src/commands/utilities/suicide.ts
index d880215..293008c 100644
--- a/src/commands/utilities/suicide.ts
+++ b/src/commands/utilities/suicide.ts
@@ -1,5 +1,5 @@
import { AllowedMentions, BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
-import { MessageEmbed } from 'discord.js';
+import { Embed } from 'discord.js';
export default class SuicideCommand extends BushCommand {
public constructor() {
@@ -18,7 +18,7 @@ export default class SuicideCommand extends BushCommand {
public override async exec(message: BushMessage | BushSlashMessage) {
// stolen from https://github.com/dexbiobot/Zeppelin
- const suicideEmbed = new MessageEmbed()
+ const suicideEmbed = new Embed()
.setTitle('Mental Health Resources')
.setColor(util.colors.red)
.setAuthor({
@@ -26,23 +26,23 @@ export default class SuicideCommand extends BushCommand {
iconURL:
'https://media.discordapp.net/attachments/770256340639416320/854689949193076737/Medical_31-60_974.jpg?width=523&height=523'
})
- .addField(
- '**National Suicide Prevention Hotline (U.S.):**',
- [
+ .addField({
+ name: '**National Suicide Prevention Hotline (U.S.):**',
+ value: [
'**Call:** 1-800-273-8255, available 24/7 for emotional support',
'**Text: HOME** to 741741',
'https://suicidepreventionlifeline.org/chat/',
'',
'**Outside the U.S**: Find a supportive resource on [this Wikipedia list of worldwide crisis hotlines](https://en.wikipedia.org/wiki/List_of_suicide_crisis_lines)'
].join('\n')
- )
- .addField(
- '**More Support**',
- [
+ })
+ .addField({
+ name: '**More Support**',
+ value: [
'For Substance Abuse Support, Eating Disorder Support & Child Abuse and Domestic Violence:',
"[Click to go to Discord's Health & Safety Page](https://discord.com/safety/360044103771-Mental-health-on-Discord#h_01EGRGT08QSZ5BNCH2E9HN0NYV)"
].join('\n')
- );
+ });
return message.util.send({
embeds: [suicideEmbed],
diff --git a/src/commands/utilities/viewRaw.ts b/src/commands/utilities/viewRaw.ts
index 4b1ff1e..fc50e31 100644
--- a/src/commands/utilities/viewRaw.ts
+++ b/src/commands/utilities/viewRaw.ts
@@ -7,7 +7,7 @@ import {
type BushTextChannel,
type OptionalArgType
} from '#lib';
-import { ApplicationCommandOptionType, Message, MessageEmbed, Permissions, type Snowflake } from 'discord.js';
+import { ApplicationCommandOptionType, ChannelType, Embed, Message, Permissions, type Snowflake } from 'discord.js';
export default class ViewRawCommand extends BushCommand {
public constructor() {
@@ -35,7 +35,14 @@ export default class ViewRawCommand extends BushCommand {
retry: '{error} Choose a valid channel.',
optional: true,
slashType: ApplicationCommandOptionType.Channel,
- channelTypes: ['GuildText', 'DM', 'GuildNews', 'GuildNewsThread', 'GuildPublicThread', 'GuildPrivateThread']
+ channelTypes: [
+ ChannelType.GuildText,
+ ChannelType.DM,
+ ChannelType.GuildNews,
+ ChannelType.GuildNewsThread,
+ ChannelType.GuildPublicThread,
+ ChannelType.GuildPrivateThread
+ ]
},
{
id: 'json',
@@ -82,12 +89,12 @@ export default class ViewRawCommand extends BushCommand {
`${util.emojis.error} There was an error fetching that message, make sure that is a valid id and if the message is not in this channel, please provide a channel.`
);
- const messageEmbed = await ViewRawCommand.getRawData(newMessage as BushMessage, { json: args.json, js: args.js });
+ const Embed = await ViewRawCommand.getRawData(newMessage as BushMessage, { json: args.json, js: args.js });
- return await message.util.reply({ embeds: [messageEmbed] });
+ return await message.util.reply({ embeds: [Embed] });
}
- public static async getRawData(message: BushMessage, options: { json?: boolean; js: boolean }): Promise<MessageEmbed> {
+ public static async getRawData(message: BushMessage, options: { json?: boolean; js: boolean }): Promise<Embed> {
const content =
options.json || options.js
? options.json
@@ -95,7 +102,7 @@ export default class ViewRawCommand extends BushCommand {
: util.inspect(message.toJSON()) || '[No Content]'
: message.content || '[No Content]';
const lang = options.json ? 'json' : options.js ? 'js' : undefined;
- return new MessageEmbed()
+ return new Embed()
.setFooter({ text: message.author.tag, iconURL: message.author.avatarURL() ?? undefined })
.setTimestamp(message.createdTimestamp)
.setColor(message.member?.roles?.color?.color ?? util.colors.default)
diff --git a/src/commands/utilities/wolframAlpha.ts b/src/commands/utilities/wolframAlpha.ts
index 984d617..f8e5c22 100644
--- a/src/commands/utilities/wolframAlpha.ts
+++ b/src/commands/utilities/wolframAlpha.ts
@@ -1,7 +1,7 @@
import { AllowedMentions, BushCommand, type BushMessage, type BushSlashMessage } from '#lib';
import { initializeClass as WolframAlphaAPI } from '@notenoughupdates/wolfram-alpha-api';
import assert from 'assert';
-import { ApplicationCommandOptionType, MessageEmbed, type MessageOptions } from 'discord.js';
+import { ApplicationCommandOptionType, Embed, type MessageOptions } from 'discord.js';
assert(WolframAlphaAPI);
@@ -45,7 +45,10 @@ export default class WolframAlphaCommand extends BushCommand {
args.image && void message.util.reply({ content: `${util.emojis.loading} Loading...`, embeds: [] });
const waApi = WolframAlphaAPI(client.config.credentials.wolframAlphaAppId);
- const decodedEmbed = new MessageEmbed().addField('๐Ÿ“ฅ Input', await util.inspectCleanRedactCodeblock(args.expression));
+ const decodedEmbed = new Embed().addField({
+ name: '๐Ÿ“ฅ Input',
+ value: await util.inspectCleanRedactCodeblock(args.expression)
+ });
const sendOptions: MessageOptions = { content: null, allowedMentions: AllowedMentions.none() };
try {
const calculated = await (args.image
@@ -55,15 +58,15 @@ export default class WolframAlphaCommand extends BushCommand {
if (args.image) {
decodedEmbed.setImage(await util.uploadImageToImgur(calculated.split(',')[1]));
- decodedEmbed.addField('๐Ÿ“ค Output', 'โ€‹');
+ decodedEmbed.addField({ name: '๐Ÿ“ค Output', value: 'โ€‹' });
} else {
- decodedEmbed.addField('๐Ÿ“ค Output', await util.inspectCleanRedactCodeblock(calculated.toString()));
+ decodedEmbed.addField({ name: '๐Ÿ“ค Output', value: await util.inspectCleanRedactCodeblock(calculated.toString()) });
}
} catch (error) {
decodedEmbed
.setTitle(`${util.emojis.errorFull} Unable to Query Expression`)
.setColor(util.colors.error)
- .addField(`๐Ÿ“ค Error`, await util.inspectCleanRedactCodeblock(`${error.name}: ${error.message}`, 'js'));
+ .addField({ name: `๐Ÿ“ค Error`, value: await util.inspectCleanRedactCodeblock(`${error.name}: ${error.message}`, 'js') });
}
sendOptions.embeds = [decodedEmbed];