diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-04-20 18:37:22 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-04-20 18:37:22 -0400 |
commit | f01be2e3ce820e5737416180efa3e5852ece72c4 (patch) | |
tree | a972af929940173e4e2d9f843124a8dfb293bc90 /src/commands | |
parent | bcb3dc5fcd21f7626d4c5a8c009dca5658a4436b (diff) | |
download | tanzanite-f01be2e3ce820e5737416180efa3e5852ece72c4.tar.gz tanzanite-f01be2e3ce820e5737416180efa3e5852ece72c4.tar.bz2 tanzanite-f01be2e3ce820e5737416180efa3e5852ece72c4.zip |
fix invite link, remove store channel, update to use builder methods, fix breaking changes
Diffstat (limited to 'src/commands')
37 files changed, 165 insertions, 143 deletions
diff --git a/src/commands/admin/channelPermissions.ts b/src/commands/admin/channelPermissions.ts index 37610b3..c06b5fa 100644 --- a/src/commands/admin/channelPermissions.ts +++ b/src/commands/admin/channelPermissions.ts @@ -1,6 +1,6 @@ import { BushCommand, ButtonPaginator, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; import assert from 'assert'; -import { ApplicationCommandOptionType, Embed, PermissionFlagsBits } from 'discord.js'; +import { ApplicationCommandOptionType, EmbedBuilder, PermissionFlagsBits } from 'discord.js'; export default class ChannelPermissionsCommand extends BushCommand { public constructor() { @@ -88,9 +88,9 @@ export default class ChannelPermissionsCommand extends BushCommand { } const failure = failedChannels.map((c) => `<#${c.id}>`).join(' '); if (failure.length > 2000) { - const paginate: Embed[] = []; + const paginate: EmbedBuilder[] = []; for (let i = 0; i < failure.length; i += 4000) { - paginate.push(new Embed().setDescription(failure.substring(i, Math.min(failure.length, i + 4000)))); + paginate.push(new EmbedBuilder().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 a90a267..c1dd142 100644 --- a/src/commands/config/config.ts +++ b/src/commands/config/config.ts @@ -12,19 +12,19 @@ import { import assert from 'assert'; import { type ArgumentGeneratorReturn, type SlashOption } from 'discord-akairo'; import { - ActionRow, + ActionRowBuilder, ApplicationCommandOptionType, - ButtonComponent, + ButtonBuilder, ButtonStyle, Channel, - Embed, + EmbedBuilder, Formatters, GuildMember, InteractionUpdateOptions, PermissionFlagsBits, Role, - SelectMenuComponent, - SelectMenuOption, + SelectMenuBuilder, + UnsafeSelectMenuOptionBuilder, User, type Message, type MessageComponentInteraction, @@ -285,18 +285,21 @@ export default class ConfigCommand extends BushCommand { case 'command_settingsSel': { if (!interaction.isSelectMenu()) return; - return interaction.update( + await interaction.update( await this.generateMessageOptions(message, interaction.values[0] as keyof typeof guildSettingsObj) ); + return; } case 'command_settingsBack': { if (!interaction.isButton()) return; - return interaction.update(await this.generateMessageOptions(message)); + await interaction.update(await this.generateMessageOptions(message)); + return; } } } else { - return await interaction?.deferUpdate().catch(() => undefined); + await interaction?.deferUpdate().catch(() => undefined); + return; } }); } @@ -307,17 +310,17 @@ export default class ConfigCommand extends BushCommand { ): Promise<MessageOptions & InteractionUpdateOptions> { assert(message.inGuild()); - const settingsEmbed = new Embed().setColor(util.colors.default); + const settingsEmbed = new EmbedBuilder().setColor(util.colors.default); if (!setting) { settingsEmbed.setTitle(`${message.guild.name}'s Settings`); const desc = settingsArr.map((s) => `:wrench: **${guildSettingsObj[s].name}**`).join('\n'); settingsEmbed.setDescription(desc); - const selMenu = new ActionRow().addComponents( - new SelectMenuComponent() + const selMenu = new ActionRowBuilder<SelectMenuBuilder>().addComponents( + new SelectMenuBuilder() .addOptions( ...settingsArr.map((s) => - new SelectMenuOption() + new UnsafeSelectMenuOptionBuilder() .setLabel(guildSettingsObj[s].name) .setValue(s) .setDescription(guildSettingsObj[s].description) @@ -360,8 +363,8 @@ export default class ConfigCommand extends BushCommand { : '[No Value Set]'; }; - const components = new ActionRow().addComponents( - new ButtonComponent({ style: ButtonStyle.Primary, customId: 'command_settingsBack', label: 'Back' }) + const components = new ActionRowBuilder<ButtonBuilder>().addComponents( + new ButtonBuilder({ style: ButtonStyle.Primary, customId: 'command_settingsBack', label: 'Back' }) ); settingsEmbed.setDescription( `${Formatters.italic(guildSettingsObj[setting].description)}\n\n**Type:** ${guildSettingsObj[setting].type}` diff --git a/src/commands/config/features.ts b/src/commands/config/features.ts index c022a3a..5218bcf 100644 --- a/src/commands/config/features.ts +++ b/src/commands/config/features.ts @@ -8,11 +8,11 @@ import { } from '#lib'; import assert from 'assert'; import { - ActionRow, + ActionRowBuilder, ComponentType, - Embed, + EmbedBuilder, PermissionFlagsBits, - SelectMenuComponent, + SelectMenuBuilder, type Message, type SelectMenuInteraction } from 'discord.js'; @@ -35,7 +35,7 @@ export default class FeaturesCommand extends BushCommand { public override async exec(message: BushMessage | BushSlashMessage) { assert(message.inGuild()); - const featureEmbed = new Embed().setTitle(`${message.guild.name}'s Features`).setColor(util.colors.default); + const featureEmbed = new EmbedBuilder().setTitle(`${message.guild.name}'s Features`).setColor(util.colors.default); const enabledFeatures = await message.guild.getSetting('enabledFeatures'); this.generateDescription(guildFeaturesArr, enabledFeatures, featureEmbed); @@ -62,7 +62,8 @@ export default class FeaturesCommand extends BushCommand { await interaction.update({ embeds: [featureEmbed] }).catch(() => undefined); return; } else { - return await interaction?.deferUpdate().catch(() => undefined); + await interaction?.deferUpdate().catch(() => undefined); + return; } }); @@ -71,7 +72,7 @@ export default class FeaturesCommand extends BushCommand { }); } - public generateDescription(allFeatures: GuildFeatures[], currentFeatures: GuildFeatures[], embed: Embed): void { + public generateDescription(allFeatures: GuildFeatures[], currentFeatures: GuildFeatures[], embed: EmbedBuilder): void { embed.setDescription( allFeatures .map( @@ -83,8 +84,8 @@ export default class FeaturesCommand extends BushCommand { } public generateComponents(guildFeatures: GuildFeatures[], disable: boolean) { - return new ActionRow().addComponents( - new SelectMenuComponent({ + return new ActionRowBuilder<SelectMenuBuilder>().addComponents( + new SelectMenuBuilder({ customId: 'command_selectFeature', disabled: disable, maxValues: 1, diff --git a/src/commands/dev/eval.ts b/src/commands/dev/eval.ts index 8742246..a32aa8e 100644 --- a/src/commands/dev/eval.ts +++ b/src/commands/dev/eval.ts @@ -21,6 +21,7 @@ import { exec } from 'child_process'; import { ActionRow, ApplicationCommandOptionType, + Attachment, ButtonComponent, ButtonInteraction, Collection, @@ -29,12 +30,14 @@ import { ContextMenuCommandInteraction, DMChannel, Embed, + EmbedBuilder, Emoji, Interaction, InteractionCollector, Message, - MessageAttachment, MessageCollector, + OAuth2Scopes, + PermissionFlagsBits, PermissionsBitField, ReactionCollector, SelectMenuComponent, @@ -54,7 +57,7 @@ const { transpile } = ts, /* eslint-enable @typescript-eslint/no-unused-vars */ // prettier-ignore -util.assertAll(ActivePunishment, BushCommand, BushMessage, BushSlashMessage, Global, Guild, Level, ModLog, Shared, StickyRole, Snowflake_, Canvas, exec, ActionRow, ButtonComponent, ButtonInteraction, Collection, Collector, CommandInteraction, ContextMenuCommandInteraction, DMChannel, Embed, Emoji, Interaction, InteractionCollector, Message, MessageAttachment, MessageCollector, PermissionsBitField, ReactionCollector, SelectMenuComponent, Util, path, ts, fileURLToPath, promisify, assert, got, transpile, emojis, colors, sh, SnowflakeUtil, __dirname); +util.assertAll(ActivePunishment, BushCommand, BushMessage, BushSlashMessage, Global, Guild, Level, ModLog, Shared, StickyRole, Snowflake_, Canvas, exec, ActionRow, ButtonComponent, ButtonInteraction, Collection, Collector, CommandInteraction, ContextMenuCommandInteraction, DMChannel, Embed, Emoji, Interaction, InteractionCollector, Message, Attachment, MessageCollector, OAuth2Scopes, PermissionFlagsBits, PermissionsBitField, ReactionCollector, SelectMenuComponent, Util, path, ts, fileURLToPath, promisify, assert, got, transpile, emojis, colors, sh, SnowflakeUtil, __dirname); export default class EvalCommand extends BushCommand { public constructor() { @@ -226,7 +229,10 @@ export default class EvalCommand extends BushCommand { lang: isTypescript ? ('ts' as const) : ('js' as const) }; - const embed = new Embed().setFooter({ text: message.author.tag, iconURL: message.author.displayAvatarURL() ?? undefined }); + const embed = new EmbedBuilder().setFooter({ + text: message.author.tag, + iconURL: message.author.displayAvatarURL() ?? undefined + }); let err = false; let rawResult: any; @@ -316,4 +322,4 @@ interface CodeBlockCustomOptions extends CodeBlockOptions { methods?: boolean; } -/** @typedef {ActivePunishment|Global|Guild|Level|ModLog|StickyRole|ButtonInteraction|Collection|Collector|CommandInteraction|ContextMenuCommandInteraction|DMChannel|Emoji|Interaction|InteractionCollector|Message|ActionRow|MessageAttachment|ButtonComponent|MessageCollector|SelectMenuComponent|ReactionCollector|Util|Canvas|Shared|PermissionsBitField|got} VSCodePleaseDontRemove */ +/** @typedef {ActivePunishment|Global|Guild|Level|ModLog|StickyRole|ButtonInteraction|Collection|Collector|CommandInteraction|ContextMenuCommandInteraction|DMChannel|Emoji|Interaction|InteractionCollector|Message|ActionRow|Attachment|ButtonComponent|MessageCollector|SelectMenuComponent|ReactionCollector|Util|Canvas|Shared|PermissionsBitField|got} VSCodePleaseDontRemove */ diff --git a/src/commands/dev/javascript.ts b/src/commands/dev/javascript.ts index b0ba0c4..046d9ab 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, Embed } from 'discord.js'; +import { ApplicationCommandOptionType, EmbedBuilder } 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 Embed(); + const embed = new EmbedBuilder(); const input = await util.inspectCleanRedactCodeblock(code, 'js'); try { diff --git a/src/commands/dev/servers.ts b/src/commands/dev/servers.ts index dddbac4..72fc7d7 100644 --- a/src/commands/dev/servers.ts +++ b/src/commands/dev/servers.ts @@ -1,5 +1,5 @@ import { BushCommand, ButtonPaginator, type BushMessage, type BushSlashMessage } from '#lib'; -import type { APIEmbed } from 'discord-api-types/v9'; +import type { APIEmbed } from 'discord-api-types/v10'; import type { Guild } from 'discord.js'; export default class ServersCommand extends BushCommand { diff --git a/src/commands/dev/sh.ts b/src/commands/dev/sh.ts index 7134b6b..f3fe86b 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, Embed, Util } from 'discord.js'; +import { ApplicationCommandOptionType, EmbedBuilder, Util } from 'discord.js'; import { promisify } from 'util'; assert(chalk); @@ -45,7 +45,7 @@ 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 Embed() + const embed = new EmbedBuilder() .setColor(util.colors.gray) .setFooter({ text: message.author.tag, iconURL: message.author.avatarURL() ?? undefined }) .setTimestamp() diff --git a/src/commands/dev/test.ts b/src/commands/dev/test.ts index 3f9cd80..deca6f1 100644 --- a/src/commands/dev/test.ts +++ b/src/commands/dev/test.ts @@ -1,14 +1,13 @@ import { BushCommand, ButtonPaginator, Shared, type BushMessage } from '#lib'; import { Routes } from 'discord-api-types/rest/v9'; import { - ActionRow, - ButtonComponent, + ActionRowBuilder, + ButtonBuilder, ButtonStyle, - Embed, + EmbedBuilder, GatewayDispatchEvents, type ApplicationCommand, - type Collection, - type MessageActionRowComponent + type Collection } from 'discord.js'; import badLinksSecretArray from '../../lib/badlinks-secret.js'; import badLinksArray from '../../lib/badlinks.js'; @@ -53,16 +52,16 @@ export default class TestCommand extends BushCommand { } if (['button', 'buttons'].includes(args?.feature?.toLowerCase())) { - const ButtonRow = new ActionRow().addComponents( - new ButtonComponent({ style: ButtonStyle.Primary, customId: 'primaryButton', label: 'Primary' }), - new ButtonComponent({ style: ButtonStyle.Secondary, customId: 'secondaryButton', label: 'Secondary' }), - new ButtonComponent({ style: ButtonStyle.Success, customId: 'successButton', label: 'Success' }), - new ButtonComponent({ style: ButtonStyle.Danger, customId: 'dangerButton', label: 'Danger' }), - new ButtonComponent({ style: ButtonStyle.Link, label: 'Link', url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ' }) + const buttonRow = new ActionRowBuilder<ButtonBuilder>().addComponents( + new ButtonBuilder({ style: ButtonStyle.Primary, customId: 'primaryButton', label: 'Primary' }), + new ButtonBuilder({ style: ButtonStyle.Secondary, customId: 'secondaryButton', label: 'Secondary' }), + new ButtonBuilder({ style: ButtonStyle.Success, customId: 'successButton', label: 'Success' }), + new ButtonBuilder({ style: ButtonStyle.Danger, customId: 'dangerButton', label: 'Danger' }), + new ButtonBuilder({ style: ButtonStyle.Link, label: 'Link', url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ' }) ); - return await message.util.reply({ content: 'buttons', components: [ButtonRow] }); + return await message.util.reply({ content: 'buttons', components: [buttonRow] }); } else if (['embed', 'button embed'].includes(args?.feature?.toLowerCase())) { - const embed = new Embed() + const embed = new EmbedBuilder() .addFields({ 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) @@ -76,26 +75,26 @@ export default class TestCommand extends BushCommand { ) .setTitle('Title'); - const buttonRow = new ActionRow().addComponents( - new ButtonComponent({ style: ButtonStyle.Link, label: 'Link', url: 'https://google.com/' }) + const buttonRow = new ActionRowBuilder<ButtonBuilder>().addComponents( + new ButtonBuilder({ style: ButtonStyle.Link, label: 'Link', url: 'https://google.com/' }) ); return await message.util.reply({ content: 'Test', embeds: [embed], components: [buttonRow] }); } else if (['lots of buttons'].includes(args?.feature?.toLowerCase())) { - const ButtonRows: ActionRow<MessageActionRowComponent>[] = []; + const buttonRows: ActionRowBuilder<ButtonBuilder>[] = []; for (let a = 1; a <= 5; a++) { - const row = new ActionRow(); + const row = new ActionRowBuilder<ButtonBuilder>(); for (let b = 1; b <= 5; b++) { const id = (a + 5 * (b - 1)).toString(); - const button = new ButtonComponent({ style: ButtonStyle.Primary, customId: id, label: id }); + const button = new ButtonBuilder({ style: ButtonStyle.Primary, customId: id, label: id }); row.addComponents(button); } - ButtonRows.push(row); + buttonRows.push(row); } - return await message.util.reply({ content: 'buttons', components: ButtonRows }); + return await message.util.reply({ content: 'buttons', components: buttonRows }); } else if (['paginate'].includes(args?.feature?.toLowerCase())) { const embeds = []; for (let i = 1; i <= 5; i++) { - embeds.push(new Embed().setDescription(i.toString())); + embeds.push(new EmbedBuilder().setDescription(i.toString())); } return await ButtonPaginator.send(message, embeds); } else if (['lots of embeds'].includes(args?.feature?.toLowerCase())) { @@ -113,12 +112,12 @@ export default class TestCommand extends BushCommand { const embeds = colors.map((c, i) => ({ ...o, title: `Embed Title ${i}`, color: c })); - const ButtonRows: ActionRow<MessageActionRowComponent>[] = []; + const ButtonRows: ActionRowBuilder<ButtonBuilder>[] = []; for (let a = 1; a <= 5; a++) { - const row = new ActionRow(); + const row = new ActionRowBuilder<ButtonBuilder>(); for (let b = 1; b <= 5; b++) { const id = (a + 5 * (b - 1)).toString(); - const button = new ButtonComponent({ style: ButtonStyle.Secondary, customId: id, label: id }); + const button = new ButtonBuilder({ style: ButtonStyle.Secondary, customId: id, label: id }); row.addComponents(button); } ButtonRows.push(row); @@ -150,8 +149,8 @@ export default class TestCommand extends BushCommand { const m = await message.util.reply({ content: 'Click for modal', components: [ - new ActionRow().addComponents( - new ButtonComponent({ style: ButtonStyle.Primary, label: 'Modal', customId: 'test;modal' }) + new ActionRowBuilder<ButtonBuilder>().addComponents( + new ButtonBuilder({ style: ButtonStyle.Primary, label: 'Modal', customId: 'test;modal' }) ) ] }); diff --git a/src/commands/info/avatar.ts b/src/commands/info/avatar.ts index 6b4afa1..870908d 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, Embed, GuildMember, PermissionFlagsBits } from 'discord.js'; +import { ApplicationCommandOptionType, EmbedBuilder, GuildMember, PermissionFlagsBits } from 'discord.js'; export default class AvatarCommand extends BushCommand { public constructor() { @@ -36,7 +36,7 @@ export default class AvatarCommand extends BushCommand { const guildAvatar = member?.avatarURL(params); - const embed = new Embed().setTimestamp().setColor(util.colors.default).setTitle(`${user.tag}'s Avatar`); + const embed = new EmbedBuilder().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 4d914e4..1ea54f3 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 { Embed, PermissionFlagsBits, version as discordJSVersion } from 'discord.js'; +import { EmbedBuilder, PermissionFlagsBits, version as discordJSVersion } from 'discord.js'; import * as os from 'os'; const { default: prettyBytes } = await import('pretty-bytes'); assert(prettyBytes); @@ -39,7 +39,7 @@ 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 Embed() + const embed = new EmbedBuilder() .setTitle('Bot Info:') .addFields({ name: '**Uptime**', value: util.humanizeDuration(client.uptime!, 2), inline: true }) .addFields({ diff --git a/src/commands/info/color.ts b/src/commands/info/color.ts index 49e827d..cc4fcc3 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, Embed, PermissionFlagsBits, Role } from 'discord.js'; +import { ApplicationCommandOptionType, EmbedBuilder, PermissionFlagsBits, Role } from 'discord.js'; import tinycolor from 'tinycolor2'; assert(tinycolor); @@ -75,7 +75,7 @@ export default class ColorCommand extends BushCommand { }); } - const embed = new Embed() + const embed = new EmbedBuilder() .addFields({ name: '» Hexadecimal', value: color.toHexString() }) .addFields({ name: '» Decimal', value: `${parseInt(color.toHex(), 16)}` }) .addFields({ name: '» HSL', value: this.removePrefixAndParenthesis(color.toHslString()) }) diff --git a/src/commands/info/guildInfo.ts b/src/commands/info/guildInfo.ts index e026d1c..4049250 100644 --- a/src/commands/info/guildInfo.ts +++ b/src/commands/info/guildInfo.ts @@ -1,9 +1,9 @@ import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage, type OptionalArgType } from '#lib'; import assert from 'assert'; -import { GuildDefaultMessageNotifications, GuildExplicitContentFilter } from 'discord-api-types/v9'; +import { GuildDefaultMessageNotifications, GuildExplicitContentFilter } from 'discord-api-types/v10'; import { ApplicationCommandOptionType, - Embed, + EmbedBuilder, Guild, GuildMFALevel, GuildPremiumTier, @@ -64,7 +64,7 @@ export default class GuildInfoCommand extends BushCommand { await guild.fetch(); } - const guildInfoEmbed = new Embed().setTitle(guild.name).setColor(util.colors.default); + const guildInfoEmbed = new EmbedBuilder().setTitle(guild.name).setColor(util.colors.default); if (guild.icon) guildInfoEmbed.setThumbnail(guild.iconURL({ size: 2048, extension: 'png' })); await this.generateAboutField(guildInfoEmbed, guild); @@ -78,7 +78,7 @@ export default class GuildInfoCommand extends BushCommand { return await message.util.reply({ embeds: [guildInfoEmbed] }); } - private generateDescription(embed: Embed, guild: Guild | GuildPreview) { + private generateDescription(embed: EmbedBuilder, guild: Guild | GuildPreview) { const description: string[] = []; const otherEmojis = client.consts.mappings.otherEmojis; @@ -115,7 +115,7 @@ export default class GuildInfoCommand extends BushCommand { embed.setDescription(`\u200B${/*zero width space*/ description.join(' ')}`); } - private async generateAboutField(embed: Embed, guild: Guild | GuildPreview) { + private async generateAboutField(embed: EmbedBuilder, guild: Guild | GuildPreview) { const guildAbout = []; if (guild instanceof Guild) { @@ -158,12 +158,12 @@ export default class GuildInfoCommand extends BushCommand { embed.addFields({ name: '» About', value: guildAbout.join('\n') }); } - private generateStatsField(embed: Embed, guild: Guild | GuildPreview) { + private generateStatsField(embed: EmbedBuilder, guild: Guild | GuildPreview) { if (!(guild instanceof Guild)) return; const guildStats: string[] = []; - const channelTypes = (['Text', 'Voice', 'News', 'Stage', 'Store', 'Category', 'Thread'] as const).map( + const channelTypes = (['Text', 'Voice', 'News', 'Stage', 'Category', 'Thread'] as const).map( (type) => `${client.consts.mappings.otherEmojis[`Channel${type}`]} ${guild.channels.cache .filter((channel) => channel[`is${type}`]()) @@ -194,7 +194,7 @@ export default class GuildInfoCommand extends BushCommand { embed.addFields({ name: '» Stats', value: guildStats.join('\n') }); } - private generateSecurityField(embed: Embed, guild: Guild | GuildPreview) { + private generateSecurityField(embed: EmbedBuilder, guild: Guild | GuildPreview) { if (!(guild instanceof Guild)) return; const guildSecurity: string[] = []; diff --git a/src/commands/info/help.ts b/src/commands/info/help.ts index 04abd18..93979ac 100644 --- a/src/commands/info/help.ts +++ b/src/commands/info/help.ts @@ -1,12 +1,12 @@ import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; +import { ButtonBuilder } from '@discordjs/builders'; import assert from 'assert'; import { - ActionRow, + ActionRowBuilder, ApplicationCommandOptionType, AutocompleteInteraction, - ButtonComponent, ButtonStyle, - Embed, + EmbedBuilder, PermissionFlagsBits } 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 Embed().setColor(util.colors.default).setTimestamp(); + const embed = new EmbedBuilder().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) => { @@ -93,7 +93,7 @@ export default class HelpCommand extends BushCommand { return await message.util.reply({ embeds: [embed], components: row.components.length ? [row] : undefined }); } - const embed = new Embed() + const embed = new EmbedBuilder() .setColor(util.colors.default) .setTitle(`${command.id} Command`) .setDescription(`${command.description ?? '*This command does not have a description.*'}`); @@ -140,18 +140,18 @@ export default class HelpCommand extends BushCommand { } private addLinks(message: BushMessage | BushSlashMessage) { - const row = new ActionRow(); + const row = new ActionRowBuilder<ButtonBuilder>(); if (!client.config.isDevelopment && !client.guilds.cache.some((guild) => guild.ownerId === message.author.id)) { - row.addComponents(new ButtonComponent({ style: ButtonStyle.Link, label: 'Invite Me', url: util.invite })); + row.addComponents(new ButtonBuilder({ style: ButtonStyle.Link, label: 'Invite Me', url: util.invite })); } if (!client.guilds.cache.get(client.config.supportGuild.id)?.members.cache.has(message.author.id)) { row.addComponents( - new ButtonComponent({ style: ButtonStyle.Link, label: 'Support Server', url: client.config.supportGuild.invite }) + new ButtonBuilder({ style: ButtonStyle.Link, label: 'Support Server', url: client.config.supportGuild.invite }) ); } if (packageDotJSON?.repository) - row.addComponents(new ButtonComponent({ style: ButtonStyle.Link, label: 'GitHub', url: packageDotJSON.repository })); + row.addComponents(new ButtonBuilder({ style: ButtonStyle.Link, label: 'GitHub', url: packageDotJSON.repository })); else void message.channel?.send('Error importing package.json, please report this to my developer.'); return row; diff --git a/src/commands/info/icon.ts b/src/commands/info/icon.ts index 72e82d8..db390a5 100644 --- a/src/commands/info/icon.ts +++ b/src/commands/info/icon.ts @@ -1,6 +1,6 @@ import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib'; import assert from 'assert'; -import { Embed, PermissionFlagsBits } from 'discord.js'; +import { EmbedBuilder, PermissionFlagsBits } from 'discord.js'; export default class IconCommand extends BushCommand { public constructor() { @@ -20,7 +20,7 @@ export default class IconCommand extends BushCommand { public override async exec(message: BushMessage | BushSlashMessage) { assert(message.inGuild()); - const embed = new Embed() + const embed = new EmbedBuilder() .setTimestamp() .setColor(util.colors.default) .setImage( diff --git a/src/commands/info/links.ts b/src/commands/info/links.ts index e14195e..1cb6de0 100644 --- a/src/commands/info/links.ts +++ b/src/commands/info/links.ts @@ -1,6 +1,6 @@ import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib'; import assert from 'assert'; -import { ActionRow, ButtonComponent, ButtonStyle } from 'discord.js'; +import { ActionRowBuilder, ButtonBuilder, ButtonStyle } from 'discord.js'; import packageDotJSON from '../../../package.json' assert { type: 'json' }; assert(packageDotJSON); @@ -20,13 +20,13 @@ export default class LinksCommand extends BushCommand { } public override async exec(message: BushMessage | BushSlashMessage) { - const buttonRow = new ActionRow(); + const buttonRow = new ActionRowBuilder<ButtonBuilder>(); if (!client.config.isDevelopment || message.author.isOwner()) { - buttonRow.addComponents(new ButtonComponent({ style: ButtonStyle.Link, label: 'Invite Me', url: util.invite })); + buttonRow.addComponents(new ButtonBuilder({ style: ButtonStyle.Link, label: 'Invite Me', url: util.invite })); } buttonRow.addComponents( - new ButtonComponent({ style: ButtonStyle.Link, label: 'Support Server', url: client.config.supportGuild.invite }), - new ButtonComponent({ style: ButtonStyle.Link, label: 'GitHub', url: packageDotJSON.repository }) + new ButtonBuilder({ style: ButtonStyle.Link, label: 'Support Server', url: client.config.supportGuild.invite }), + new ButtonBuilder({ style: ButtonStyle.Link, label: 'GitHub', url: packageDotJSON.repository }) ); return await message.util.reply({ content: 'Here are some useful links:', components: [buttonRow] }); } diff --git a/src/commands/info/ping.ts b/src/commands/info/ping.ts index 1b5e45a..04ceedd 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 { Embed, PermissionFlagsBits, type Message } from 'discord.js'; +import { EmbedBuilder, PermissionFlagsBits, type Message } from 'discord.js'; export default class PingCommand extends BushCommand { public constructor() { @@ -20,7 +20,7 @@ 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 Embed() + const embed = new EmbedBuilder() .setTitle('Pong! 🏓') .addFields({ name: 'Bot Latency', value: botLatency, inline: true }) .addFields({ name: 'API Latency', value: apiLatency, inline: true }) @@ -39,7 +39,7 @@ 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 Embed() + const embed = new EmbedBuilder() .setTitle('Pong! 🏓') .addFields({ name: 'Bot Latency', value: botLatency, inline: true }) .addFields({ name: 'API Latency', value: apiLatency, inline: true }) diff --git a/src/commands/info/pronouns.ts b/src/commands/info/pronouns.ts index 3eccd85..043b660 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, Embed, PermissionFlagsBits } from 'discord.js'; +import { ApplicationCommandOptionType, EmbedBuilder, PermissionFlagsBits } 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 Embed({ + new EmbedBuilder({ 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 d9ca5fc..71ae80d 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, - Embed, + EmbedBuilder, PermissionFlagsBits, 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 Embed().setTitle('Unknown :snowflake:').setColor(util.colors.default); + const snowflakeEmbed = new EmbedBuilder().setTitle('Unknown :snowflake:').setColor(util.colors.default); // Channel if (client.channels.cache.has(snowflake)) { @@ -57,7 +57,6 @@ export default class SnowflakeCommand extends BushCommand { channel.isNews() || channel.isText() || channel.isVoice() || - channel.isStore() || channel.isStage() || channel.isThread() ) { diff --git a/src/commands/info/userInfo.ts b/src/commands/info/userInfo.ts index edf2b6d..0d6c891 100644 --- a/src/commands/info/userInfo.ts +++ b/src/commands/info/userInfo.ts @@ -8,13 +8,13 @@ import { type BushSlashMessage, type BushUser } from '#lib'; -import { TeamMemberMembershipState, type APIApplication } from 'discord-api-types/v9'; +import { TeamMemberMembershipState, type APIApplication } from 'discord-api-types/v10'; import { ActivityType, ApplicationCommandOptionType, ApplicationFlagsBitField, ApplicationFlagsString, - Embed, + EmbedBuilder, PermissionFlagsBits, UserFlags } from 'discord.js'; @@ -65,7 +65,7 @@ export default class UserInfoCommand extends BushCommand { const emojis = []; const superUsers = util.getShared('superUsers'); - const userEmbed = new Embed() + const userEmbed = new EmbedBuilder() .setTitle(util.discord.escapeMarkdown(user.tag)) .setThumbnail(user.displayAvatarURL({ size: 2048, extension: 'png' })) .setTimestamp() @@ -114,12 +114,14 @@ export default class UserInfoCommand extends BushCommand { if (emojis) userEmbed.setDescription( - `\u200B${emojis.filter((e) => e).join(' ')}${userEmbed.description?.length ? `\n\n${userEmbed.description}` : ''}` + `\u200B${emojis.filter((e) => e).join(' ')}${ + userEmbed.data.description?.length ? `\n\n${userEmbed.data.description}` : '' + }` ); // zero width space return userEmbed; } - public static async generateGeneralInfoField(embed: Embed, user: BushUser, title = '» General Information') { + public static async generateGeneralInfoField(embed: EmbedBuilder, user: BushUser, title = '» General Information') { // General Info const generalInfo = [ `**Mention:** <@${user.id}>`, @@ -136,7 +138,11 @@ export default class UserInfoCommand extends BushCommand { embed.addFields({ name: title, value: generalInfo.join('\n') }); } - public static generateServerInfoField(embed: Embed, member?: BushGuildMember | undefined, title = '» Server Information') { + public static generateServerInfoField( + embed: EmbedBuilder, + member?: BushGuildMember | undefined, + title = '» Server Information' + ) { if (!member) return; // Server User Info @@ -161,7 +167,7 @@ export default class UserInfoCommand extends BushCommand { if (serverUserInfo.length) embed.addFields({ name: title, value: serverUserInfo.join('\n') }); } - public static generatePresenceField(embed: Embed, member?: BushGuildMember | undefined, title = '» Presence') { + public static generatePresenceField(embed: EmbedBuilder, member?: BushGuildMember | undefined, title = '» Presence') { if (!member || !member.presence) return; if (!member.presence.status && !member.presence.clientStatus && !member.presence.activities) return; @@ -201,7 +207,7 @@ export default class UserInfoCommand extends BushCommand { }); } - public static generateRolesField(embed: Embed, member?: BushGuildMember | undefined) { + public static generateRolesField(embed: EmbedBuilder, member?: BushGuildMember | undefined) { if (!member || member.roles.cache.size <= 1) return; // roles @@ -217,7 +223,11 @@ export default class UserInfoCommand extends BushCommand { }); } - public static generatePermissionsField(embed: Embed, member: BushGuildMember | undefined, title = '» Important Permissions') { + public static generatePermissionsField( + embed: EmbedBuilder, + member: BushGuildMember | undefined, + title = '» Important Permissions' + ) { if (!member) return; // Important Perms @@ -235,7 +245,7 @@ export default class UserInfoCommand extends BushCommand { if (perms.length) embed.addFields({ name: title, value: perms.join(' ') }); } - public static async generateBotField(embed: Embed, user: BushUser, title = '» Bot Information') { + public static async generateBotField(embed: EmbedBuilder, user: BushUser, title = '» Bot Information') { if (!user.bot) return; const applicationInfo = (await client.rest.get(`/applications/${user.id}/rpc`).catch(() => null)) as APIApplication | null; diff --git a/src/commands/leveling/leaderboard.ts b/src/commands/leveling/leaderboard.ts index 0871811..c79a4e3 100644 --- a/src/commands/leveling/leaderboard.ts +++ b/src/commands/leveling/leaderboard.ts @@ -1,6 +1,6 @@ import { BushCommand, ButtonPaginator, Level, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; import assert from 'assert'; -import { ApplicationCommandOptionType, Embed, PermissionFlagsBits } from 'discord.js'; +import { ApplicationCommandOptionType, EmbedBuilder, PermissionFlagsBits } from 'discord.js'; export default class LeaderboardCommand extends BushCommand { public constructor() { @@ -45,7 +45,9 @@ 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 Embed().setTitle(`${message.guild.name}'s Leaderboard`).setDescription(c.join('\n'))); + const embeds = chunked.map((c) => + new EmbedBuilder().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/leveling/level.ts b/src/commands/leveling/level.ts index 803703e..50742e9 100644 --- a/src/commands/leveling/level.ts +++ b/src/commands/leveling/level.ts @@ -12,7 +12,7 @@ import { import { SimplifyNumber } from '@notenoughupdates/simplify-number'; import assert from 'assert'; import canvas from 'canvas'; -import { ApplicationCommandOptionType, MessageAttachment, PermissionFlagsBits } from 'discord.js'; +import { ApplicationCommandOptionType, Attachment, PermissionFlagsBits } from 'discord.js'; import got from 'got'; import { dirname, join } from 'path'; import { fileURLToPath } from 'url'; @@ -60,7 +60,7 @@ export default class LevelCommand extends BushCommand { const user = args.user ?? message.author; try { return await message.util.reply({ - files: [new MessageAttachment(await this.getImage(user, message.guild), 'level.png')] + files: [new Attachment(await this.getImage(user, message.guild), 'level.png')] }); } catch (e) { if (e instanceof Error && e.message === 'User does not have a level') { diff --git a/src/commands/moulberry-bush/capePermissions.ts b/src/commands/moulberry-bush/capePermissions.ts index 7bf3926..93cfb99 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, Embed, PermissionFlagsBits } from 'discord.js'; +import { ApplicationCommandOptionType, EmbedBuilder, PermissionFlagsBits } from 'discord.js'; import got from 'got'; export default class CapePermissionsCommand extends BushCommand { @@ -62,7 +62,7 @@ export default class CapePermissionsCommand extends BushCommand { `${util.emojis.error} ${util.format.input(args.ign)} does not appear to have any capes.` ); const userPerm: string[] = capePerms.perms[index].perms; - const embed = new Embed() + const embed = new EmbedBuilder() .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 ab9e8a7..5564279 100644 --- a/src/commands/moulberry-bush/capes.ts +++ b/src/commands/moulberry-bush/capes.ts @@ -1,6 +1,6 @@ import { BushCommand, ButtonPaginator, DeleteButton, type BushMessage, type OptionalArgType } from '#lib'; import assert from 'assert'; -import { APIEmbed } from 'discord-api-types/v9'; +import { APIEmbed } from 'discord-api-types/v10'; import { ApplicationCommandOptionType, AutocompleteInteraction, PermissionFlagsBits } from 'discord.js'; import Fuse from 'fuse.js'; import got from 'got'; diff --git a/src/commands/moulberry-bush/moulHammer.ts b/src/commands/moulberry-bush/moulHammer.ts index 9a16545..7a5a91c 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, Embed, PermissionFlagsBits } from 'discord.js'; +import { ApplicationCommandOptionType, EmbedBuilder, PermissionFlagsBits } 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 Embed() + const embed = new EmbedBuilder() .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 ed25df4..4d57fcd 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, Embed, PermissionFlagsBits } from 'discord.js'; +import { ApplicationCommandOptionType, EmbedBuilder, PermissionFlagsBits } from 'discord.js'; export default class ReportCommand extends BushCommand { public constructor() { @@ -61,7 +61,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 Embed() + const reportEmbed = new EmbedBuilder() .setFooter({ text: `Reporter ID: ${message.author.id} Reported ID: ${member.user.id}` }) .setTimestamp() .setAuthor({ diff --git a/src/commands/moulberry-bush/rule.ts b/src/commands/moulberry-bush/rule.ts index 913a4b6..ca0bba0 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, Embed, PermissionFlagsBits } from 'discord.js'; +import { ApplicationCommandOptionType, EmbedBuilder, PermissionFlagsBits } from 'discord.js'; const rules = [ { @@ -95,7 +95,7 @@ export default class RuleCommand extends BushCommand { message: BushMessage | BushSlashMessage, { rule, user }: { rule: OptionalArgType<'integer'>; user: OptionalArgType<'user'> } ) { - const rulesEmbed = new Embed() + const rulesEmbed = new EmbedBuilder() .setColor(0xef3929) .setFooter({ text: `Triggered by ${message.author.tag}`, diff --git a/src/commands/moulberry-bush/serverStatus.ts b/src/commands/moulberry-bush/serverStatus.ts index 703dfc4..5e9184a 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 { Embed, PermissionFlagsBits } from 'discord.js'; +import { EmbedBuilder, PermissionFlagsBits } 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: Embed = new Embed() + const msgEmbed = new EmbedBuilder() .setTitle('Server status') .setDescription(`Checking server:\n${util.emojis.loading}`) .setColor(util.colors.default) diff --git a/src/commands/utilities/calculator.ts b/src/commands/utilities/calculator.ts index 75dc63f..1a9d352 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, Embed } from 'discord.js'; +import { ApplicationCommandOptionType, EmbedBuilder } from 'discord.js'; import { evaluate } from 'mathjs'; assert(evaluate); @@ -31,7 +31,7 @@ export default class CalculatorCommand extends BushCommand { } public override async exec(message: BushMessage | BushSlashMessage, args: { expression: string }) { - const decodedEmbed = new Embed().addFields({ + const decodedEmbed = new EmbedBuilder().addFields({ name: '📥 Input', value: await util.inspectCleanRedactCodeblock(args.expression, 'mma') }); diff --git a/src/commands/utilities/decode.ts b/src/commands/utilities/decode.ts index 1d64145..978c1c6 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, Embed } from 'discord.js'; +import { ApplicationCommandOptionType, EmbedBuilder } 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,7 +53,7 @@ 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 Embed() + const decodedEmbed = new EmbedBuilder() .setTitle(`${encodeOrDecode} Information`) .addFields({ name: '📥 Input', value: await util.inspectCleanRedactCodeblock(data) }); try { diff --git a/src/commands/utilities/highlight-!.ts b/src/commands/utilities/highlight-!.ts index 2ec1a29..2b18198 100644 --- a/src/commands/utilities/highlight-!.ts +++ b/src/commands/utilities/highlight-!.ts @@ -1,6 +1,6 @@ import { BushCommand, Highlight, HighlightWord, type BushSlashMessage } from '#lib'; import { Flag, type ArgumentGeneratorReturn, type SlashOption } from 'discord-akairo'; -import { ApplicationCommandOptionType } from 'discord-api-types/v9'; +import { ApplicationCommandOptionType } from 'discord-api-types/v10'; import { ApplicationCommandSubCommandData, AutocompleteInteraction, CacheType } from 'discord.js'; type Unpacked<T> = T extends (infer U)[] ? U : T; diff --git a/src/commands/utilities/highlight-matches.ts b/src/commands/utilities/highlight-matches.ts index aa8308c..0e98c8d 100644 --- a/src/commands/utilities/highlight-matches.ts +++ b/src/commands/utilities/highlight-matches.ts @@ -1,7 +1,7 @@ import { BushCommand, ButtonPaginator, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; import assert from 'assert'; import { ArgumentGeneratorReturn } from 'discord-akairo'; -import { APIEmbed } from 'discord-api-types/v9'; +import { APIEmbed } from 'discord-api-types/v10'; import { highlightCommandArgs, highlightSubcommands } from './highlight-!.js'; export default class HighlightMatchesCommand extends BushCommand { diff --git a/src/commands/utilities/highlight-show.ts b/src/commands/utilities/highlight-show.ts index 7058675..1eb9fd0 100644 --- a/src/commands/utilities/highlight-show.ts +++ b/src/commands/utilities/highlight-show.ts @@ -1,6 +1,6 @@ import { AllowedMentions, BushCommand, Highlight, type BushMessage, type BushSlashMessage } from '#lib'; import assert from 'assert'; -import { Embed } from 'discord.js'; +import { EmbedBuilder } from 'discord.js'; import { highlightSubcommands } from './highlight-!.js'; export default class HighlightShowCommand extends BushCommand { @@ -28,7 +28,7 @@ export default class HighlightShowCommand extends BushCommand { if (!highlight.words.length) return message.util.reply(`${util.emojis.error} You are not highlighting any words.`); - const embed = new Embed() + const embed = new EmbedBuilder() .setTitle('Highlight List') .setDescription( highlight.words diff --git a/src/commands/utilities/price.ts b/src/commands/utilities/price.ts index f6d1104..0117715 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, Embed, PermissionFlagsBits } from 'discord.js'; +import { ApplicationCommandOptionType, AutocompleteInteraction, EmbedBuilder, PermissionFlagsBits } from 'discord.js'; import Fuse from 'fuse.js'; import got from 'got'; @@ -58,7 +58,7 @@ export default class PriceCommand extends BushCommand { ])) as [Bazaar | undefined, LowestBIN | undefined, LowestBIN | undefined, AuctionAverages | undefined]; let parsedItem = item.toString().toUpperCase().replace(/ /g, '_').replace(/'S/g, ''); - const priceEmbed = new Embed().setColor(errors?.length ? util.colors.warn : util.colors.success).setTimestamp(); + const priceEmbed = new EmbedBuilder().setColor(errors?.length ? util.colors.warn : util.colors.success).setTimestamp(); if (bazaar?.success === false) errors.push('bazaar'); @@ -104,10 +104,12 @@ export default class PriceCommand extends BushCommand { // checks if the item exists in any of the action information otherwise it is not a valid item if (currentLowestBIN?.[parsedItem] || averageLowestBIN?.[parsedItem] || auctionAverages?.[parsedItem]) { priceEmbed.setTitle(`Price Information for ${util.format.input(parsedItem)}`).setFooter({ - text: `${priceEmbed.footer?.text ? `${priceEmbed.footer.text} | ` : ''}All information is based on the last 3 days.` + text: `${ + priceEmbed.data.footer?.text ? `${priceEmbed.data.footer.text} | ` : '' + }All information is based on the last 3 days.` }); } else { - const errorEmbed = new Embed(); + const errorEmbed = new EmbedBuilder(); errorEmbed .setColor(util.colors.error) .setDescription( diff --git a/src/commands/utilities/reminders.ts b/src/commands/utilities/reminders.ts index 10206c1..653274a 100644 --- a/src/commands/utilities/reminders.ts +++ b/src/commands/utilities/reminders.ts @@ -1,6 +1,6 @@ import { BushCommand, ButtonPaginator, Reminder, type BushMessage, type BushSlashMessage } from '#lib'; import assert from 'assert'; -import { APIEmbed } from 'discord-api-types/v9'; +import { APIEmbed } from 'discord-api-types/v10'; import { PermissionFlagsBits } from 'discord.js'; import { Op } from 'sequelize'; diff --git a/src/commands/utilities/suicide.ts b/src/commands/utilities/suicide.ts index be6730b..136de78 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 { Embed } from 'discord.js'; +import { EmbedBuilder } 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 Embed() + const suicideEmbed = new EmbedBuilder() .setTitle('Mental Health Resources') .setColor(util.colors.red) .setAuthor({ diff --git a/src/commands/utilities/viewRaw.ts b/src/commands/utilities/viewRaw.ts index be79499..1da26f9 100644 --- a/src/commands/utilities/viewRaw.ts +++ b/src/commands/utilities/viewRaw.ts @@ -1,6 +1,6 @@ import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage, type OptionalArgType } from '#lib'; import assert from 'assert'; -import { ApplicationCommandOptionType, ChannelType, Embed, Message, PermissionFlagsBits } from 'discord.js'; +import { ApplicationCommandOptionType, ChannelType, EmbedBuilder, Message, PermissionFlagsBits } from 'discord.js'; export default class ViewRawCommand extends BushCommand { public constructor() { @@ -88,7 +88,7 @@ export default class ViewRawCommand extends BushCommand { return await message.util.reply({ embeds: [Embed] }); } - public static async getRawData(message: BushMessage, options: { json?: boolean; js: boolean }): Promise<Embed> { + public static async getRawData(message: BushMessage, options: { json?: boolean; js: boolean }): Promise<EmbedBuilder> { const content = options.json || options.js ? options.json @@ -96,7 +96,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 Embed() + return new EmbedBuilder() .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 948aec6..95df5e8 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, Embed, type MessageOptions } from 'discord.js'; +import { ApplicationCommandOptionType, EmbedBuilder, type MessageOptions } from 'discord.js'; assert(WolframAlphaAPI); @@ -45,7 +45,7 @@ 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 Embed().addFields({ + const decodedEmbed = new EmbedBuilder().addFields({ name: '📥 Input', value: await util.inspectCleanRedactCodeblock(args.expression) }); |