diff options
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 |
