diff options
Diffstat (limited to 'src')
101 files changed, 388 insertions, 449 deletions
diff --git a/src/arguments/discordEmoji.ts b/src/arguments/discordEmoji.ts index 9c4991f..3edf123 100644 --- a/src/arguments/discordEmoji.ts +++ b/src/arguments/discordEmoji.ts @@ -1,5 +1,5 @@ import type { BushArgumentTypeCaster } from '#lib'; -import type { Snowflake } from 'discord-api-types/v9'; +import type { Snowflake } from 'discord-api-types/v10'; export const discordEmoji: BushArgumentTypeCaster<DiscordEmojiInfo | null> = (_, phrase) => { if (!phrase) return null; 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) }); diff --git a/src/lib/common/AutoMod.ts b/src/lib/common/AutoMod.ts index db3e709..5534728 100644 --- a/src/lib/common/AutoMod.ts +++ b/src/lib/common/AutoMod.ts @@ -1,7 +1,15 @@ import { banResponse, Moderation, type BushButtonInteraction, type BushMessage } from '#lib'; import assert from 'assert'; import chalk from 'chalk'; -import { ActionRow, ButtonComponent, ButtonStyle, Embed, GuildMember, PermissionFlagsBits, type TextChannel } from 'discord.js'; +import { + ActionRowBuilder, + ButtonBuilder, + ButtonStyle, + EmbedBuilder, + GuildMember, + PermissionFlagsBits, + type TextChannel +} from 'discord.js'; /** * Handles auto moderation functionality. @@ -153,7 +161,7 @@ export class AutoMod { const color = this.punish({ severity: Severity.TEMP_MUTE, reason: 'everyone mention and scam phrase' } as BadWordDetails); void this.message.guild!.sendLogChannel('automod', { embeds: [ - new Embed() + new EmbedBuilder() .setTitle(`[Severity ${Severity.TEMP_MUTE}] Mention Scam Deleted`) .setDescription( `**User:** ${this.message.author} (${this.message.author.tag})\n**Sent From:** <#${this.message.channel.id}> [Jump to context](${this.message.url})` @@ -163,8 +171,8 @@ export class AutoMod { .setTimestamp() ], components: [ - new ActionRow().addComponents( - new ButtonComponent({ + new ActionRowBuilder<ButtonBuilder>().addComponents( + new ButtonBuilder({ style: ButtonStyle.Danger, label: 'Ban User', customId: `automod;ban;${this.message.author.id};everyone mention and scam phrase` @@ -316,7 +324,7 @@ export class AutoMod { await this.message.guild!.sendLogChannel('automod', { embeds: [ - new Embed() + new EmbedBuilder() .setTitle(`[Severity ${highestOffence.severity}] Automod Action Performed`) .setDescription( `**User:** ${this.message.author} (${this.message.author.tag})\n**Sent From:** <#${ @@ -331,8 +339,8 @@ export class AutoMod { components: highestOffence.severity >= 2 ? [ - new ActionRow().addComponents( - new ButtonComponent({ + new ActionRowBuilder<ButtonBuilder>().addComponents( + new ButtonBuilder({ style: ButtonStyle.Danger, label: 'Ban User', customId: `automod;ban;${this.message.author.id};${highestOffence.reason}` diff --git a/src/lib/common/ButtonPaginator.ts b/src/lib/common/ButtonPaginator.ts index e3d4207..59dcb68 100644 --- a/src/lib/common/ButtonPaginator.ts +++ b/src/lib/common/ButtonPaginator.ts @@ -1,14 +1,7 @@ import { DeleteButton, type BushMessage, type BushSlashMessage } from '#lib'; import { CommandUtil } from 'discord-akairo'; -import { APIEmbed } from 'discord-api-types/v9'; -import { - ActionRow, - ButtonComponent, - ButtonStyle, - Embed, - type MessageActionRowComponent, - type MessageComponentInteraction -} from 'discord.js'; +import { APIEmbed } from 'discord-api-types/v10'; +import { ActionRowBuilder, ButtonBuilder, ButtonStyle, EmbedBuilder, type MessageComponentInteraction } from 'discord.js'; /** * Sends multiple embeds with controls to switch between them @@ -22,7 +15,7 @@ export class ButtonPaginator { /** * The embeds to paginate */ - protected embeds: Embed[] | APIEmbed[]; + protected embeds: EmbedBuilder[] | APIEmbed[]; /** * The optional text to send with the paginator @@ -53,7 +46,7 @@ export class ButtonPaginator { */ protected constructor( message: BushMessage | BushSlashMessage, - embeds: Embed[] | APIEmbed[], + embeds: EmbedBuilder[] | APIEmbed[], text: string | null, deleteOnExit: boolean, startOn: number @@ -66,8 +59,8 @@ export class ButtonPaginator { // add footers for (let i = 0; i < embeds.length; i++) { - if (embeds[i] instanceof Embed) { - (embeds[i] as Embed).setFooter({ text: `Page ${(i + 1).toLocaleString()}/${embeds.length.toLocaleString()}` }); + if (embeds[i] instanceof EmbedBuilder) { + (embeds[i] as EmbedBuilder).setFooter({ text: `Page ${(i + 1).toLocaleString()}/${embeds.length.toLocaleString()}` }); } else { (embeds[i] as APIEmbed).footer = { text: `Page ${(i + 1).toLocaleString()}/${embeds.length.toLocaleString()}` @@ -177,33 +170,33 @@ export class ButtonPaginator { * @param disableAll Whether to disable all buttons * @returns The generated {@link ActionRow} */ - protected getPaginationRow(disableAll = false): ActionRow<MessageActionRowComponent> { - return new ActionRow().addComponents( - new ButtonComponent({ + protected getPaginationRow(disableAll = false) { + return new ActionRowBuilder<ButtonBuilder>().addComponents( + new ButtonBuilder({ style: ButtonStyle.Primary, customId: 'paginate_beginning', emoji: PaginateEmojis.BEGINNING, disabled: disableAll || this.curPage === 0 }), - new ButtonComponent({ + new ButtonBuilder({ style: ButtonStyle.Primary, customId: 'paginate_back', emoji: PaginateEmojis.BACK, disabled: disableAll || this.curPage === 0 }), - new ButtonComponent({ + new ButtonBuilder({ style: ButtonStyle.Primary, customId: 'paginate_stop', emoji: PaginateEmojis.STOP, disabled: disableAll }), - new ButtonComponent({ + new ButtonBuilder({ style: ButtonStyle.Primary, customId: 'paginate_next', emoji: PaginateEmojis.FORWARD, disabled: disableAll || this.curPage === this.numPages - 1 }), - new ButtonComponent({ + new ButtonBuilder({ style: ButtonStyle.Primary, customId: 'paginate_end', emoji: PaginateEmojis.END, @@ -222,7 +215,7 @@ export class ButtonPaginator { */ public static async send( message: BushMessage | BushSlashMessage, - embeds: (Embed | APIEmbed)[], + embeds: EmbedBuilder[] | APIEmbed[], text: string | null = null, deleteOnExit = true, startOn = 1 diff --git a/src/lib/common/ConfirmationPrompt.ts b/src/lib/common/ConfirmationPrompt.ts index 4ff00ce..e86c236 100644 --- a/src/lib/common/ConfirmationPrompt.ts +++ b/src/lib/common/ConfirmationPrompt.ts @@ -1,5 +1,5 @@ import { type BushMessage, type BushSlashMessage } from '#lib'; -import { ActionRow, ButtonComponent, ButtonStyle, type MessageComponentInteraction, type MessageOptions } from 'discord.js'; +import { ActionRowBuilder, ButtonBuilder, ButtonStyle, type MessageComponentInteraction, type MessageOptions } from 'discord.js'; /** * Sends a message with buttons for the user to confirm or cancel the action. @@ -29,9 +29,9 @@ export class ConfirmationPrompt { */ protected async send(): Promise<boolean> { this.messageOptions.components = [ - new ActionRow().addComponents( - new ButtonComponent({ style: ButtonStyle.Success, customId: 'confirmationPrompt_confirm', label: 'Yes' }), - new ButtonComponent({ style: ButtonStyle.Danger, customId: 'confirmationPrompt_cancel', label: 'No' }) + new ActionRowBuilder<ButtonBuilder>().addComponents( + new ButtonBuilder({ style: ButtonStyle.Success, customId: 'confirmationPrompt_confirm', label: 'Yes' }), + new ButtonBuilder({ style: ButtonStyle.Danger, customId: 'confirmationPrompt_cancel', label: 'No' }) ) ]; diff --git a/src/lib/common/DeleteButton.ts b/src/lib/common/DeleteButton.ts index 0a9fd79..4874f78 100644 --- a/src/lib/common/DeleteButton.ts +++ b/src/lib/common/DeleteButton.ts @@ -1,8 +1,8 @@ import { PaginateEmojis, type BushMessage, type BushSlashMessage } from '#lib'; import { CommandUtil } from 'discord-akairo'; import { - ActionRow, - ButtonComponent, + ActionRowBuilder, + ButtonBuilder, ButtonStyle, MessageComponentInteraction, MessageEditOptions, @@ -66,8 +66,8 @@ export class DeleteButton { */ protected updateComponents(edit = false, disable = false): void { this.messageOptions.components = [ - new ActionRow().addComponents( - new ButtonComponent({ + new ActionRowBuilder<ButtonBuilder>().addComponents( + new ButtonBuilder({ style: ButtonStyle.Primary, customId: 'paginate__stop', emoji: PaginateEmojis.STOP, diff --git a/src/lib/common/util/Moderation.ts b/src/lib/common/util/Moderation.ts index afe220c..f388121 100644 --- a/src/lib/common/util/Moderation.ts +++ b/src/lib/common/util/Moderation.ts @@ -11,7 +11,7 @@ import { type ModLogType } from '#lib'; import assert from 'assert'; -import { ActionRow, ButtonComponent, ButtonStyle, Embed, PermissionFlagsBits, type Snowflake } from 'discord.js'; +import { ActionRowBuilder, ButtonBuilder, ButtonStyle, EmbedBuilder, PermissionFlagsBits, type Snowflake } from 'discord.js'; enum punishMap { 'warned' = 'warn', @@ -265,7 +265,7 @@ export class Moderation { const ending = await options.guild.getSetting('punishmentEnding'); const dmEmbed = ending && ending.length && options.sendFooter - ? new Embed().setDescription(ending).setColor(util.colors.newBlurple) + ? new EmbedBuilder().setDescription(ending).setColor(util.colors.newBlurple) : undefined; const appealsEnabled = !!( @@ -286,9 +286,9 @@ export class Moderation { let components; if (appealsEnabled && options.modlog) components = [ - new ActionRow({ + new ActionRowBuilder<ButtonBuilder>({ components: [ - new ButtonComponent({ + new ButtonBuilder({ customId: `appeal;${this.punishmentToPresentTense(options.punishment)};${options.guild.id};${client.users.resolveId( options.user )};${options.modlog}`, diff --git a/src/lib/extensions/discord-akairo/BushClient.ts b/src/lib/extensions/discord-akairo/BushClient.ts index 2fb559c..6516161 100644 --- a/src/lib/extensions/discord-akairo/BushClient.ts +++ b/src/lib/extensions/discord-akairo/BushClient.ts @@ -22,10 +22,11 @@ import type { } from '#lib'; import { patch, type PatchedElements } from '@notenoughupdates/events-intercept'; import * as Sentry from '@sentry/node'; -import { AkairoClient, ContextMenuCommandHandler, version as akairoVersion } from 'discord-akairo'; -import { GatewayIntentBits } from 'discord-api-types/v9'; +import { AkairoClient, ContextMenuCommandHandler, PromptContentModifier, version as akairoVersion } from 'discord-akairo'; +import { GatewayIntentBits } from 'discord-api-types/v10'; import { ActivityType, + MessagePayload, Options, Partials, Structures, @@ -36,7 +37,6 @@ import { type Message, type MessageEditOptions, type MessageOptions, - type MessagePayload, type ReplyMessageOptions, type Snowflake, type WebhookEditMessageOptions @@ -78,7 +78,6 @@ import { BushNewsChannel } from '../discord.js/BushNewsChannel.js'; import { BushPresence } from '../discord.js/BushPresence.js'; import { BushRole } from '../discord.js/BushRole.js'; import { BushSelectMenuInteraction } from '../discord.js/BushSelectMenuInteraction.js'; -import { BushStoreChannel } from '../discord.js/BushStoreChannel.js'; import { BushTextChannel } from '../discord.js/BushTextChannel.js'; import { BushThreadChannel } from '../discord.js/BushThreadChannel.js'; import { BushThreadMember } from '../discord.js/BushThreadMember.js'; @@ -235,6 +234,17 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re directory: path.join(__dirname, '..', '..', '..', 'tasks'), automateCategories: true }); + + const modify: PromptContentModifier = async (message, text, data) => { + const ending = '\n\n Type **cancel** to cancel the command'; + const options = typeof text === 'function' ? await text(message, data) : text; + if (typeof options === 'string') return text + ending; + if (options instanceof MessagePayload) { + if (options.options.content) options.options.content += ending; + } else options.content += ending; + return options; + }; + this.commandHandler = new BushCommandHandler(this, { directory: path.join(__dirname, '..', '..', '..', 'commands'), prefix: async ({ guild }: Message) => { @@ -251,9 +261,8 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re prompt: { start: 'Placeholder argument prompt. **If you see this please tell my developers**.', retry: 'Placeholder failed argument prompt. **If you see this please tell my developers**.', - modifyStart: (_: Message, str: string): string => `${str}\n\n Type \`cancel\` to cancel the command`, - modifyRetry: (_: Message, str: string): string => - `${str.replace('{error}', this.util.emojis.error)}\n\n Type \`cancel\` to cancel the command`, + modifyStart: modify, + modifyRetry: modify, timeout: ':hourglass: You took too long the command has been cancelled.', ended: 'You exceeded the maximum amount of tries the command has been cancelled', cancel: 'The command has been cancelled', @@ -317,7 +326,6 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re Structures.extend('VoiceChannel', () => BushVoiceChannel); Structures.extend('CategoryChannel', () => BushCategoryChannel); Structures.extend('NewsChannel', () => BushNewsChannel); - Structures.extend('StoreChannel', () => BushStoreChannel); Structures.extend('ThreadChannel', () => BushThreadChannel); Structures.extend('GuildMember', () => BushGuildMember); Structures.extend('ThreadMember', () => BushThreadMember); diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts index e92abe7..563df3d 100644 --- a/src/lib/extensions/discord-akairo/BushClientUtil.ts +++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts @@ -22,10 +22,10 @@ import assert from 'assert'; import { exec } from 'child_process'; import deepLock from 'deep-lock'; import { ClientUtil, Util as AkairoUtil } from 'discord-akairo'; -import { APIEmbed, APIMessage, OAuth2Scopes, Routes } from 'discord-api-types/v9'; +import { APIEmbed, APIMessage, OAuth2Scopes, Routes } from 'discord-api-types/v10'; import { Constants as DiscordConstants, - Embed, + EmbedBuilder, GuildMember, Message, PermissionFlagsBits, @@ -920,7 +920,11 @@ export class BushClientUtil extends ClientUtil { */ public get invite() { return client.generateInvite({ - permissions: PermissionsBitField.All, + permissions: + PermissionsBitField.All - + PermissionFlagsBits.UseEmbeddedActivities - + PermissionFlagsBits.ViewGuildInsights - + PermissionFlagsBits.Stream, scopes: [OAuth2Scopes.Bot, OAuth2Scopes.ApplicationsCommands] }); } @@ -970,17 +974,17 @@ export class BushClientUtil extends ClientUtil { * @param embed The options to be applied to the (first) embed. * @param lines Each line of the description as an element in an array. */ - public overflowEmbed(embed: Omit<APIEmbed, 'description'>, lines: string[], maxLength = 4096): Embed[] { - const embeds: Embed[] = []; + public overflowEmbed(embed: Omit<APIEmbed, 'description'>, lines: string[], maxLength = 4096): EmbedBuilder[] { + const embeds: EmbedBuilder[] = []; const makeEmbed = () => { - embeds.push(new Embed().setColor(embed.color ?? null)); + embeds.push(new EmbedBuilder().setColor(embed.color ?? null)); return embeds.at(-1)!; }; for (const line of lines) { let current = embeds.length ? embeds.at(-1)! : makeEmbed(); - const joined = current.description ? `${current.description}\n${line}` : line; + const joined = current.data.description ? `${current.data.description}\n${line}` : line; if (joined.length >= maxLength) current = makeEmbed(); current.setDescription(joined); diff --git a/src/lib/extensions/discord-akairo/BushCommand.ts b/src/lib/extensions/discord-akairo/BushCommand.ts index ff3748e..febe95a 100644 --- a/src/lib/extensions/discord-akairo/BushCommand.ts +++ b/src/lib/extensions/discord-akairo/BushCommand.ts @@ -18,7 +18,6 @@ import { type BushRole, type BushSlashMessage, type BushStageChannel, - type BushStoreChannel, type BushTask, type BushTextChannel, type BushThreadChannel, @@ -72,10 +71,6 @@ export interface OverriddenBaseArgumentType extends BaseArgumentType { categoryChannels: Collection<string, BushCategoryChannel> | null; newsChannel: BushNewsChannel | null; newsChannels: Collection<string, BushNewsChannel> | null; - // eslint-disable-next-line deprecation/deprecation - storeChannel: BushStoreChannel | null; - // eslint-disable-next-line deprecation/deprecation - storeChannels: Collection<string, BushStoreChannel> | null; stageChannel: BushStageChannel | null; stageChannels: Collection<string, BushStageChannel> | null; threadChannel: BushThreadChannel | null; diff --git a/src/lib/extensions/discord.js/BushApplicationCommandManager.ts b/src/lib/extensions/discord.js/BushApplicationCommandManager.ts index 68153b9..dc27dbf 100644 --- a/src/lib/extensions/discord.js/BushApplicationCommandManager.ts +++ b/src/lib/extensions/discord.js/BushApplicationCommandManager.ts @@ -6,7 +6,7 @@ import type { BushGuildResolvable, StripPrivate } from '#lib'; -import type { APIApplicationCommand } from 'discord-api-types/v9'; +import type { APIApplicationCommand } from 'discord-api-types/v10'; import { ApplicationCommandManager, CachedManager, diff --git a/src/lib/extensions/discord.js/BushApplicationCommandPermissionsManager.ts b/src/lib/extensions/discord.js/BushApplicationCommandPermissionsManager.ts index 49d4234..401f3e2 100644 --- a/src/lib/extensions/discord.js/BushApplicationCommandPermissionsManager.ts +++ b/src/lib/extensions/discord.js/BushApplicationCommandPermissionsManager.ts @@ -1,5 +1,5 @@ import type { BushClient, BushRoleResolvable, BushUserResolvable } from '#lib'; -import type { APIApplicationCommandPermission } from 'discord-api-types/v9'; +import type { APIApplicationCommandPermission } from 'discord-api-types/v10'; import { ApplicationCommandPermissionType, BaseManager, diff --git a/src/lib/extensions/discord.js/BushButtonInteraction.ts b/src/lib/extensions/discord.js/BushButtonInteraction.ts index 89cfabd..368d19d 100644 --- a/src/lib/extensions/discord.js/BushButtonInteraction.ts +++ b/src/lib/extensions/discord.js/BushButtonInteraction.ts @@ -1,5 +1,5 @@ import type { BushClient, BushGuild, BushGuildMember, BushGuildTextBasedChannel, BushTextBasedChannel, BushUser } from '#lib'; -import type { APIInteractionGuildMember } from 'discord-api-types/v9'; +import type { APIInteractionGuildMember } from 'discord-api-types/v10'; import { ButtonInteraction, type CacheType, type CacheTypeReducer } from 'discord.js'; import type { RawMessageButtonInteractionData } from 'discord.js/typings/rawDataTypes'; diff --git a/src/lib/extensions/discord.js/BushCategoryChannel.ts b/src/lib/extensions/discord.js/BushCategoryChannel.ts index 8c02a68..a2e1e1c 100644 --- a/src/lib/extensions/discord.js/BushCategoryChannel.ts +++ b/src/lib/extensions/discord.js/BushCategoryChannel.ts @@ -3,7 +3,6 @@ import { BushGuildBasedChannel, BushNewsChannel, BushStageChannel, - BushStoreChannel, BushTextBasedChannel, BushTextChannel, BushThreadChannel, @@ -35,8 +34,6 @@ export interface BushCategoryChannel extends CategoryChannel { isVoice(): this is BushVoiceChannel; isCategory(): this is BushCategoryChannel; isNews(): this is BushNewsChannel; - // eslint-disable-next-line deprecation/deprecation - isStore(): this is BushStoreChannel; isThread(): this is BushThreadChannel; isStage(): this is BushStageChannel; isTextBased(): this is BushGuildBasedChannel & BushTextBasedChannel; diff --git a/src/lib/extensions/discord.js/BushCategoryChannelChildManager.ts b/src/lib/extensions/discord.js/BushCategoryChannelChildManager.ts index b9a7ac7..2b0d56b 100644 --- a/src/lib/extensions/discord.js/BushCategoryChannelChildManager.ts +++ b/src/lib/extensions/discord.js/BushCategoryChannelChildManager.ts @@ -1,20 +1,23 @@ -/* eslint-disable deprecation/deprecation */ import type { BushCategoryChannel, BushGuild, BushGuildChannelResolvable, BushMappedChannelCategoryTypes, BushNonCategoryGuildBasedChannel, - BushStoreChannel, BushTextChannel } from '#lib'; -import type { CategoryChannelType, CategoryCreateChannelOptions, ChannelType, DataManager, Snowflake } from 'discord.js'; +import type { + CategoryChannelChildManager, + CategoryChannelType, + CategoryCreateChannelOptions, + DataManager, + Snowflake +} from 'discord.js'; -export declare class BushCategoryChannelChildManager extends DataManager< - Snowflake, - BushNonCategoryGuildBasedChannel, - BushGuildChannelResolvable -> { +export declare class BushCategoryChannelChildManager + extends DataManager<Snowflake, BushNonCategoryGuildBasedChannel, BushGuildChannelResolvable> + implements CategoryChannelChildManager +{ private constructor(channel: BushCategoryChannel); /** @@ -33,20 +36,9 @@ export declare class BushCategoryChannelChildManager extends DataManager< * @param name The name of the new channel * @param options Options for creating the new channel */ - public create<T extends Exclude<CategoryChannelType, ChannelType.GuildStore>>( + public create<T extends CategoryChannelType>( name: string, options: CategoryCreateChannelOptions & { type: T } ): Promise<BushMappedChannelCategoryTypes[T]>; - /** - * Creates a new channel within this category. - * <info>You cannot create a channel of type {@link ChannelType.GuildCategory} inside a CategoryChannel.</info> - * @param name The name of the new channel - * @param options Options for creating the new channel - * @deprecated See [Self-serve Game Selling Deprecation](https://support-dev.discord.com/hc/en-us/articles/4414590563479) for more information - */ - public create( - name: string, - options: CategoryCreateChannelOptions & { type: ChannelType.GuildStore } - ): Promise<BushStoreChannel>; public create(name: string, options?: CategoryCreateChannelOptions): Promise<BushTextChannel>; } diff --git a/src/lib/extensions/discord.js/BushChannel.ts b/src/lib/extensions/discord.js/BushChannel.ts index 3f0d070..e66135c 100644 --- a/src/lib/extensions/discord.js/BushChannel.ts +++ b/src/lib/extensions/discord.js/BushChannel.ts @@ -1,11 +1,9 @@ -/* eslint-disable deprecation/deprecation */ import type { BushCategoryChannel, BushClient, BushDMChannel, BushNewsChannel, BushStageChannel, - BushStoreChannel, BushTextBasedChannel, BushTextChannel, BushThreadChannel, @@ -34,7 +32,6 @@ export declare class BushChannel extends Channel { public isVoice(): this is BushVoiceChannel; public isCategory(): this is BushCategoryChannel; public isNews(): this is BushNewsChannel; - public isStore(): this is BushStoreChannel; public isThread(): this is BushThreadChannel; public isStage(): this is BushStageChannel; public isTextBased(): this is BushTextBasedChannel; diff --git a/src/lib/extensions/discord.js/BushChatInputCommandInteraction.ts b/src/lib/extensions/discord.js/BushChatInputCommandInteraction.ts index 5dbf7b9..2491a68 100644 --- a/src/lib/extensions/discord.js/BushChatInputCommandInteraction.ts +++ b/src/lib/extensions/discord.js/BushChatInputCommandInteraction.ts @@ -10,7 +10,7 @@ import type { BushTextBasedChannel, BushUser } from '#lib'; -import type { APIInteractionGuildMember } from 'discord-api-types/v9'; +import type { APIInteractionGuildMember } from 'discord-api-types/v10'; import { ChatInputCommandInteraction, type CacheType, type CacheTypeReducer, type Invite, type Snowflake } from 'discord.js'; import type { RawCommandInteractionData } from 'discord.js/typings/rawDataTypes'; diff --git a/src/lib/extensions/discord.js/BushClientEvents.ts b/src/lib/extensions/discord.js/BushClientEvents.ts index 4a10ce5..fc9993e 100644 --- a/src/lib/extensions/discord.js/BushClientEvents.ts +++ b/src/lib/extensions/discord.js/BushClientEvents.ts @@ -97,7 +97,8 @@ export interface BushClientEvents extends AkairoClientEvents { reaction: BushMessageReaction | PartialBushMessageReaction ]; messageDeleteBulk: [ - messages: Collection<Snowflake, BushMessage | PartialBushMessage> + messages: Collection<Snowflake, BushMessage | PartialBushMessage>, + channel: BushTextBasedChannel ]; messageReactionAdd: [ reaction: BushMessageReaction | PartialBushMessageReaction, @@ -119,14 +120,18 @@ export interface BushClientEvents extends AkairoClientEvents { roleUpdate: [oldRole: BushRole, newRole: BushRole]; threadCreate: [thread: BushThreadChannel, newlyCreated: boolean]; threadDelete: [thread: BushThreadChannel]; - threadListSync: [threads: Collection<Snowflake, BushThreadChannel>]; + threadListSync: [ + threads: Collection<Snowflake, BushThreadChannel>, + guild: BushGuild + ]; threadMemberUpdate: [ oldMember: BushThreadMember, newMember: BushThreadMember ]; threadMembersUpdate: [ oldMembers: Collection<Snowflake, BushThreadMember>, - newMembers: Collection<Snowflake, BushThreadMember> + newMembers: Collection<Snowflake, BushThreadMember>, + thread: BushThreadChannel ]; threadUpdate: [oldThread: BushThreadChannel, newThread: BushThreadChannel]; typingStart: [typing: Typing]; diff --git a/src/lib/extensions/discord.js/BushDMChannel.ts b/src/lib/extensions/discord.js/BushDMChannel.ts index dc7d309..87382ec 100644 --- a/src/lib/extensions/discord.js/BushDMChannel.ts +++ b/src/lib/extensions/discord.js/BushDMChannel.ts @@ -1,11 +1,9 @@ -/* eslint-disable deprecation/deprecation */ import type { BushCategoryChannel, BushClient, BushMessageManager, BushNewsChannel, BushStageChannel, - BushStoreChannel, BushTextBasedChannel, BushTextChannel, BushThreadChannel, @@ -36,7 +34,6 @@ export interface BushDMChannel extends DMChannel { isVoice(): this is BushVoiceChannel; isCategory(): this is BushCategoryChannel; isNews(): this is BushNewsChannel; - isStore(): this is BushStoreChannel; isThread(): this is BushThreadChannel; isStage(): this is BushStageChannel; isTextBased(): this is BushTextBasedChannel; diff --git a/src/lib/extensions/discord.js/BushGuild.ts b/src/lib/extensions/discord.js/BushGuild.ts index b0a34e7..8b1b5fa 100644 --- a/src/lib/extensions/discord.js/BushGuild.ts +++ b/src/lib/extensions/discord.js/BushGuild.ts @@ -20,7 +20,7 @@ import { type GuildLogType, type GuildModel } from '#lib'; -import { APIMessage } from 'discord-api-types/v9'; +import { APIMessage } from 'discord-api-types/v10'; import { Collection, Guild, diff --git a/src/lib/extensions/discord.js/BushGuildChannel.ts b/src/lib/extensions/discord.js/BushGuildChannel.ts index dd523e5..62bf05a 100644 --- a/src/lib/extensions/discord.js/BushGuildChannel.ts +++ b/src/lib/extensions/discord.js/BushGuildChannel.ts @@ -1,4 +1,3 @@ -/* eslint-disable deprecation/deprecation */ import type { BushCategoryChannel, BushClient, @@ -7,7 +6,6 @@ import type { BushGuildBasedChannel, BushNewsChannel, BushStageChannel, - BushStoreChannel, BushTextBasedChannel, BushTextChannel, BushThreadChannel, @@ -42,7 +40,6 @@ export interface BushGuildChannel extends GuildChannel { isVoice(): this is BushVoiceChannel; isCategory(): this is BushCategoryChannel; isNews(): this is BushNewsChannel; - isStore(): this is BushStoreChannel; isThread(): this is BushThreadChannel; isStage(): this is BushStageChannel; isTextBased(): this is BushGuildBasedChannel & BushTextBasedChannel; diff --git a/src/lib/extensions/discord.js/BushGuildChannelManager.ts b/src/lib/extensions/discord.js/BushGuildChannelManager.ts index 91bff07..4048b98 100644 --- a/src/lib/extensions/discord.js/BushGuildChannelManager.ts +++ b/src/lib/extensions/discord.js/BushGuildChannelManager.ts @@ -5,13 +5,11 @@ import type { BushGuildChannel, BushMappedGuildChannelTypes, BushNonThreadGuildBasedChannel, - BushStoreChannel, BushTextChannel } from '#lib'; import { CachedManager, ChannelData, - ChannelType, ChannelWebhookCreateOptions, SetChannelPositionOptions, Webhook, @@ -67,38 +65,10 @@ export declare class BushGuildChannelManager * ], * }) */ - public create<T extends Exclude<GuildChannelTypes, ChannelType.GuildStore>>( + public create<T extends GuildChannelTypes>( name: string, options: GuildChannelCreateOptions & { type: T } ): Promise<BushMappedGuildChannelTypes[T]>; - - /** - * Creates a new channel in the guild. - * @param name The name of the new channel - * @param options Options for creating the new channel - * @example - * // Create a new text channel - * guild.channels.create('new-general', { reason: 'Needed a cool new channel' }) - * .then(console.log) - * .catch(console.error); - * @example - * // Create a new channel with permission overwrites - * guild.channels.create('new-voice', { - * type: 'GuildVoice', - * permissionOverwrites: [ - * { - * id: message.author.id, - * deny: [PermissionFlagsBits.ViewChannel], - * }, - * ], - * }) - * @deprecated See [Self-serve Game Selling Deprecation](https://support-dev.discord.com/hc/en-us/articles/4414590563479) for more information - */ - public create( - name: string, - options: GuildChannelCreateOptions & { type: ChannelType.GuildStore } - ): // eslint-disable-next-line deprecation/deprecation - Promise<BushStoreChannel>; public create(name: string, options?: GuildChannelCreateOptions): Promise<BushTextChannel>; /** diff --git a/src/lib/extensions/discord.js/BushMessageManager.ts b/src/lib/extensions/discord.js/BushMessageManager.ts index 80b7a21..edb7982 100644 --- a/src/lib/extensions/discord.js/BushMessageManager.ts +++ b/src/lib/extensions/discord.js/BushMessageManager.ts @@ -1,9 +1,9 @@ import { BushMessageResolvable, BushTextBasedChannel, type BushMessage } from '#lib'; import { CachedManager, + FetchMessageOptions, + FetchMessagesOptions, MessageManager, - type BaseFetchOptions, - type ChannelLogsQueryOptions, type Collection, type EmojiIdentifierResolvable, type MessageEditOptions, @@ -72,8 +72,8 @@ export declare class BushMessageManager * .then(messages => console.log(`${messages.filter(m => m.author.id === '84484653687267328').size} messages`)) * .catch(console.error); */ - public fetch(message: Snowflake, options?: BaseFetchOptions): Promise<BushMessage>; - public fetch(options?: ChannelLogsQueryOptions, cacheOptions?: BaseFetchOptions): Promise<Collection<Snowflake, BushMessage>>; + public fetch(options: BushMessageResolvable | FetchMessageOptions): Promise<BushMessage>; + public fetch(options?: FetchMessagesOptions): Promise<Collection<Snowflake, BushMessage>>; /** * Fetches the pinned messages of this channel and returns a collection of them. @@ -107,3 +107,7 @@ export declare class BushMessageManager */ public unpin(message: BushMessageResolvable): Promise<void>; } + +export interface BushFetchMessageOptions extends FetchMessageOptions { + message: BushMessageResolvable; +} diff --git a/src/lib/extensions/discord.js/BushModalSubmitInteraction.ts b/src/lib/extensions/discord.js/BushModalSubmitInteraction.ts index b05c0d7..9bdc9e5 100644 --- a/src/lib/extensions/discord.js/BushModalSubmitInteraction.ts +++ b/src/lib/extensions/discord.js/BushModalSubmitInteraction.ts @@ -7,9 +7,10 @@ import type { BushTextBasedChannel, BushUser } from '#lib'; -import type { APIInteractionGuildMember, APIModalSubmitInteraction } from 'discord-api-types/v9'; +import type { APIInteractionGuildMember, APIModalSubmitInteraction } from 'discord-api-types/v10'; import { InteractionDeferUpdateOptions, + InteractionResponse, InteractionUpdateOptions, MessagePayload, ModalSubmitInteraction, @@ -49,7 +50,7 @@ export interface BushModalMessageModalSubmitInteraction<Cached extends CacheType /** * The message associated with this interaction */ - message: BushGuildCacheMessage<Cached> | null; + message: BushGuildCacheMessage<Cached>; /** * Updates the original message of the component on which the interaction was received on. @@ -64,7 +65,7 @@ export interface BushModalMessageModalSubmitInteraction<Cached extends CacheType * .catch(console.error); */ update(options: InteractionUpdateOptions & { fetchReply: true }): Promise<BushGuildCacheMessage<Cached>>; - update(options: string | MessagePayload | InteractionUpdateOptions): Promise<void>; + update(options: string | MessagePayload | InteractionUpdateOptions): Promise<InteractionResponse>; /** * Defers an update to the message to which the component was attached. @@ -76,7 +77,7 @@ export interface BushModalMessageModalSubmitInteraction<Cached extends CacheType * .catch(console.error); */ deferUpdate(options: InteractionDeferUpdateOptions & { fetchReply: true }): Promise<BushGuildCacheMessage<Cached>>; - deferUpdate(options?: InteractionDeferUpdateOptions): Promise<void>; + deferUpdate(options?: InteractionDeferUpdateOptions): Promise<InteractionResponse>; /** * Indicates whether this interaction is received from a guild. diff --git a/src/lib/extensions/discord.js/BushSelectMenuInteraction.ts b/src/lib/extensions/discord.js/BushSelectMenuInteraction.ts index 35e6301..66a5ea9 100644 --- a/src/lib/extensions/discord.js/BushSelectMenuInteraction.ts +++ b/src/lib/extensions/discord.js/BushSelectMenuInteraction.ts @@ -1,5 +1,5 @@ import type { BushClient, BushGuild, BushGuildMember, BushGuildTextBasedChannel, BushTextBasedChannel, BushUser } from '#lib'; -import type { APIInteractionGuildMember } from 'discord-api-types/v9'; +import type { APIInteractionGuildMember } from 'discord-api-types/v10'; import { SelectMenuInteraction, type CacheType, type CacheTypeReducer } from 'discord.js'; import type { RawMessageSelectMenuInteractionData } from 'discord.js/typings/rawDataTypes'; diff --git a/src/lib/extensions/discord.js/BushStoreChannel.ts b/src/lib/extensions/discord.js/BushStoreChannel.ts deleted file mode 100644 index a2cc114..0000000 --- a/src/lib/extensions/discord.js/BushStoreChannel.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* eslint-disable deprecation/deprecation */ -import type { - BushCategoryChannel, - BushClient, - BushDMChannel, - BushGuild, - BushGuildBasedChannel, - BushGuildMember, - BushNewsChannel, - BushStageChannel, - BushTextBasedChannel, - BushTextChannel, - BushThreadChannel, - BushVoiceBasedChannel, - BushVoiceChannel -} from '#lib'; -import { PartialGroupDMChannel, StoreChannel, type Collection, type Snowflake } from 'discord.js'; -import type { RawGuildChannelData } from 'discord.js/typings/rawDataTypes'; - -/** - * Represents a guild store channel on Discord. - * @deprecated Store channels are deprecated and will be removed from Discord in March 2022. See [Self-serve Game Selling Deprecation](https://support-dev.discord.com/hc/en-us/articles/4414590563479) for more information - */ -export class BushStoreChannel extends StoreChannel { - public declare guild: BushGuild; - - public constructor(guild: BushGuild, data?: RawGuildChannelData, client?: BushClient) { - super(guild, data, client); - } -} - -export interface BushStoreChannel extends StoreChannel { - get members(): Collection<Snowflake, BushGuildMember>; - get parent(): BushCategoryChannel | null; - isText(): this is BushTextChannel; - isDM(): this is BushDMChannel; - isDMBased(): this is PartialGroupDMChannel | BushDMChannel; - isVoice(): this is BushVoiceChannel; - isCategory(): this is BushCategoryChannel; - isNews(): this is BushNewsChannel; - isStore(): this is BushStoreChannel; - isThread(): this is BushThreadChannel; - isStage(): this is BushStageChannel; - isTextBased(): this is BushGuildBasedChannel & BushTextBasedChannel; - isVoiceBased(): this is BushVoiceBasedChannel; -} diff --git a/src/lib/extensions/discord.js/BushTextChannel.ts b/src/lib/extensions/discord.js/BushTextChannel.ts index ad54b76..575de20 100644 --- a/src/lib/extensions/discord.js/BushTextChannel.ts +++ b/src/lib/extensions/discord.js/BushTextChannel.ts @@ -1,4 +1,3 @@ -/* eslint-disable deprecation/deprecation */ import type { BushCategoryChannel, BushDMChannel, @@ -7,7 +6,6 @@ import type { BushMessageManager, BushNewsChannel, BushStageChannel, - BushStoreChannel, BushTextBasedChannel, BushThreadChannel, BushThreadManager, @@ -37,7 +35,6 @@ export interface BushTextChannel extends TextChannel { isVoice(): this is BushVoiceChannel; isCategory(): this is BushCategoryChannel; isNews(): this is BushNewsChannel; - isStore(): this is BushStoreChannel; isThread(): this is BushThreadChannel; isStage(): this is BushStageChannel; isTextBased(): this is BushGuildBasedChannel & BushTextBasedChannel; diff --git a/src/lib/extensions/discord.js/BushThreadChannel.ts b/src/lib/extensions/discord.js/BushThreadChannel.ts index 5663ba4..8b941f9 100644 --- a/src/lib/extensions/discord.js/BushThreadChannel.ts +++ b/src/lib/extensions/discord.js/BushThreadChannel.ts @@ -1,4 +1,3 @@ -/* eslint-disable deprecation/deprecation */ import type { BushCategoryChannel, BushClient, @@ -9,7 +8,6 @@ import type { BushMessageManager, BushNewsChannel, BushStageChannel, - BushStoreChannel, BushTextBasedChannel, BushTextChannel, BushThreadMemberManager, @@ -42,7 +40,6 @@ export interface BushThreadChannel extends ThreadChannel { isVoice(): this is BushVoiceChannel; isCategory(): this is BushCategoryChannel; isNews(): this is BushNewsChannel; - isStore(): this is BushStoreChannel; isThread(): this is BushThreadChannel; isStage(): this is BushStageChannel; isTextBased(): this is BushGuildBasedChannel & BushTextBasedChannel; diff --git a/src/lib/extensions/discord.js/BushVoiceChannel.ts b/src/lib/extensions/discord.js/BushVoiceChannel.ts index 6691045..6966727 100644 --- a/src/lib/extensions/discord.js/BushVoiceChannel.ts +++ b/src/lib/extensions/discord.js/BushVoiceChannel.ts @@ -1,4 +1,3 @@ -/* eslint-disable deprecation/deprecation */ import type { BushCategoryChannel, BushClient, @@ -8,7 +7,6 @@ import type { BushGuildMember, BushNewsChannel, BushStageChannel, - BushStoreChannel, BushTextBasedChannel, BushTextChannel, BushThreadChannel, @@ -35,7 +33,6 @@ export interface BushVoiceChannel extends VoiceChannel { isVoice(): this is BushVoiceChannel; isCategory(): this is BushCategoryChannel; isNews(): this is BushNewsChannel; - isStore(): this is BushStoreChannel; isThread(): this is BushThreadChannel; isStage(): this is BushStageChannel; isTextBased(): this is BushGuildBasedChannel & BushTextBasedChannel; diff --git a/src/lib/extensions/discord.js/other.ts b/src/lib/extensions/discord.js/other.ts index d7fb15b..086ace0 100644 --- a/src/lib/extensions/discord.js/other.ts +++ b/src/lib/extensions/discord.js/other.ts @@ -1,4 +1,3 @@ -/* eslint-disable deprecation/deprecation */ import type { BushApplicationCommand, BushCategoryChannel, @@ -11,7 +10,6 @@ import type { BushReactionEmoji, BushRole, BushStageChannel, - BushStoreChannel, BushTextChannel, BushThreadChannel, BushThreadMember, @@ -19,7 +17,7 @@ import type { BushVoiceChannel, PartialBushDMChannel } from '#lib'; -import { APIMessage } from 'discord-api-types/v9'; +import { APIMessage } from 'discord-api-types/v10'; import type { ApplicationCommandResolvable, CacheType, @@ -109,7 +107,6 @@ export type BushAnyChannel = | PartialBushDMChannel | BushNewsChannel | BushStageChannel - | BushStoreChannel | BushTextChannel | BushThreadChannel | BushVoiceChannel; @@ -146,8 +143,8 @@ export interface BushMappedChannelCategoryTypes { [ChannelType.GuildNews]: BushNewsChannel; [ChannelType.GuildVoice]: BushVoiceChannel; [ChannelType.GuildText]: BushTextChannel; - [ChannelType.GuildStore]: BushStoreChannel; [ChannelType.GuildStageVoice]: BushStageChannel; + [ChannelType.GuildForum]: never; // TODO: Fix when guild forums come out } export type BushMappedGuildChannelTypes = { diff --git a/src/lib/index.ts b/src/lib/index.ts index eb7cf76..59d8b53 100644 --- a/src/lib/index.ts +++ b/src/lib/index.ts @@ -57,7 +57,6 @@ export * from './extensions/discord.js/BushRole.js'; export * from './extensions/discord.js/BushSelectMenuInteraction.js'; export * from './extensions/discord.js/BushStageChannel.js'; export * from './extensions/discord.js/BushStageInstance.js'; -export * from './extensions/discord.js/BushStoreChannel.js'; export * from './extensions/discord.js/BushTextChannel.js'; export * from './extensions/discord.js/BushThreadChannel.js'; export type { BushThreadManager } from './extensions/discord.js/BushThreadManager.js'; diff --git a/src/lib/utils/BushConstants.ts b/src/lib/utils/BushConstants.ts index df69806..9befc5a 100644 --- a/src/lib/utils/BushConstants.ts +++ b/src/lib/utils/BushConstants.ts @@ -1,4 +1,4 @@ -import { Colors } from 'discord.js'; +import { Colors, GuildFeature } from 'discord.js'; import { BushClientUtil } from '../extensions/discord-akairo/BushClientUtil.js'; const rawCapeUrl = 'https://raw.githubusercontent.com/NotEnoughUpdates/capes/master/'; @@ -243,38 +243,43 @@ export class BushConstants { UseExternalStickers: { name: 'Use External Stickers', important: false }, SendMessagesInThreads: { name: 'Send Messages In Threads', important: false }, StartEmbeddedActivities: { name: 'Start Activities', important: false }, - ModerateMembers: { name: 'Timeout Members', important: true } + ModerateMembers: { name: 'Timeout Members', important: true }, + UseEmbeddedActivities: { name: 'Use Activities', important: false } }, // prettier-ignore features: { - VERIFIED: { name: 'Verified', important: true, emoji: '<:verified:850795049817473066>', weight: 0 }, - PARTNERED: { name: 'Partnered', important: true, emoji: '<:partneredServer:850794851955507240>', weight: 1 }, - MORE_STICKERS: { name: 'More Stickers', important: true, emoji: null, weight: 2 }, - MORE_EMOJI: { name: 'More Emoji', important: true, emoji: '<:moreEmoji:850786853497602080>', weight: 3 }, - FEATURABLE: { name: 'Featurable', important: true, emoji: '<:featurable:850786776372084756>', weight: 4 }, - RELAY_ENABLED: { name: 'Relay Enabled', important: true, emoji: '<:relayEnabled:850790531441229834>', weight: 5 }, - DISCOVERABLE: { name: 'Discoverable', important: true, emoji: '<:discoverable:850786735360966656>', weight: 6 }, + [GuildFeature.Verified]: { name: 'Verified', important: true, emoji: '<:verified:850795049817473066>', weight: 0 }, + [GuildFeature.Partnered]: { name: 'Partnered', important: true, emoji: '<:partneredServer:850794851955507240>', weight: 1 }, + [GuildFeature.MoreStickers]: { name: 'More Stickers', important: true, emoji: null, weight: 2 }, + 'MORE_EMOJIS': { name: 'More Emoji', important: true, emoji: '<:moreEmoji:850786853497602080>', weight: 3 }, + [GuildFeature.Featurable]: { name: 'Featurable', important: true, emoji: '<:featurable:850786776372084756>', weight: 4 }, + [GuildFeature.RelayEnabled]: { name: 'Relay Enabled', important: true, emoji: '<:relayEnabled:850790531441229834>', weight: 5 }, + [GuildFeature.Discoverable]: { name: 'Discoverable', important: true, emoji: '<:discoverable:850786735360966656>', weight: 6 }, ENABLED_DISCOVERABLE_BEFORE: { name: 'Enabled Discovery Before', important: false, emoji: '<:enabledDiscoverableBefore:850786754670624828>', weight: 7 }, - MONETIZATION_ENABLED: { name: 'Monetization Enabled', important: true, emoji: null, weight: 8 }, - TICKETED_EVENTS_ENABLED: { name: 'Ticketed Events Enabled', important: true, emoji: null, weight: 9 }, - PREVIEW_ENABLED: { name: 'Preview Enabled', important: true, emoji: '<:previewEnabled:850790508266913823>', weight: 10 }, - COMMERCE: { name: 'Store Channels', important: true, emoji: '<:storeChannels:850786692432396338>', weight: 11 }, - VANITY_URL: { name: 'Vanity URL', important: false, emoji: '<:vanityURL:850790553079644160>', weight: 12 }, - VIP_REGIONS: { name: 'VIP Regions', important: false, emoji: '<:VIPRegions:850794697496854538>', weight: 13 }, - ANIMATED_ICON: { name: 'Animated Icon', important: false, emoji: '<:animatedIcon:850774498071412746>', weight: 14 }, - BANNER: { name: 'Banner', important: false, emoji: '<:banner:850786673150787614>', weight: 15 }, - INVITE_SPLASH: { name: 'Invite Splash', important: false, emoji: '<:inviteSplash:850786798246559754>', weight: 16 }, - PRIVATE_THREADS: { name: 'Private Threads', important: false, emoji: '<:privateThreads:869763711894700093>', weight: 17 }, - THREE_DAY_THREAD_ARCHIVE: { name: 'Three Day Thread Archive', important: false, emoji: '<:threeDayThreadArchive:869767841652564008>', weight: 19 }, - SEVEN_DAY_THREAD_ARCHIVE: { name: 'Seven Day Thread Archive', important: false, emoji: '<:sevenDayThreadArchive:869767896123998288>', weight: 20 }, - ROLE_ICONS: { name: 'Role Icons', important: false, emoji: '<:roleIcons:876993381929222175>', weight: 21 }, - NEWS: { name: 'Announcement Channels', important: false, emoji: '<:announcementChannels:850790491796013067>', weight: 22 }, - MEMBER_VERIFICATION_GATE_ENABLED: { name: 'Membership Verification Gate', important: false, emoji: '<:memberVerificationGateEnabled:850786829984858212>', weight: 23 }, - WELCOME_SCREEN_ENABLED: { name: 'Welcome Screen Enabled', important: false, emoji: '<:welcomeScreenEnabled:850790575875817504>', weight: 24 }, - COMMUNITY: { name: 'Community', important: false, emoji: '<:community:850786714271875094>', weight: 25 }, + [GuildFeature.MonetizationEnabled]: { name: 'Monetization Enabled', important: true, emoji: null, weight: 8 }, + [GuildFeature.TicketedEventsEnabled]: { name: 'Ticketed Events Enabled', important: true, emoji: null, weight: 9 }, + [GuildFeature.PreviewEnabled]: { name: 'Preview Enabled', important: true, emoji: '<:previewEnabled:850790508266913823>', weight: 10 }, + [GuildFeature.Commerce]: { name: 'Store Channels', important: true, emoji: '<:storeChannels:850786692432396338>', weight: 11 }, + [GuildFeature.VanityURL]: { name: 'Vanity URL', important: false, emoji: '<:vanityURL:850790553079644160>', weight: 12 }, + [GuildFeature.VIPRegions]: { name: 'VIP Regions', important: false, emoji: '<:VIPRegions:850794697496854538>', weight: 13 }, + [GuildFeature.AnimatedIcon]: { name: 'Animated Icon', important: false, emoji: '<:animatedIcon:850774498071412746>', weight: 14 }, + [GuildFeature.Banner]: { name: 'Banner', important: false, emoji: '<:banner:850786673150787614>', weight: 15 }, + [GuildFeature.InviteSplash]: { name: 'Invite Splash', important: false, emoji: '<:inviteSplash:850786798246559754>', weight: 16 }, + [GuildFeature.PrivateThreads]: { name: 'Private Threads', important: false, emoji: '<:privateThreads:869763711894700093>', weight: 17 }, + [GuildFeature.ThreeDayThreadArchive]: { name: 'Three Day Thread Archive', important: false, emoji: '<:threeDayThreadArchive:869767841652564008>', weight: 19 }, + [GuildFeature.SevenDayThreadArchive]: { name: 'Seven Day Thread Archive', important: false, emoji: '<:sevenDayThreadArchive:869767896123998288>', weight: 20 }, + [GuildFeature.RoleIcons]: { name: 'Role Icons', important: false, emoji: '<:roleIcons:876993381929222175>', weight: 21 }, + [GuildFeature.News]: { name: 'Announcement Channels', important: false, emoji: '<:announcementChannels:850790491796013067>', weight: 22 }, + [GuildFeature.MemberVerificationGateEnabled]: { name: 'Membership Verification Gate', important: false, emoji: '<:memberVerificationGateEnabled:850786829984858212>', weight: 23 }, + [GuildFeature.WelcomeScreenEnabled]: { name: 'Welcome Screen Enabled', important: false, emoji: '<:welcomeScreenEnabled:850790575875817504>', weight: 24 }, + [GuildFeature.Community]: { name: 'Community', important: false, emoji: '<:community:850786714271875094>', weight: 25 }, THREADS_ENABLED: {name: 'Threads Enabled', important: false, emoji: '<:threadsEnabled:869756035345317919>', weight: 26 }, THREADS_ENABLED_TESTING: {name: 'Threads Enabled Testing', important: false, emoji: null, weight: 27 }, + [GuildFeature.AnimatedBanner]: { name: 'Animated Banner', important: false, emoji: null, weight: 28 }, + [GuildFeature.HasDirectoryEntry]: { name: 'Has Directory Entry', important: false, emoji: null, weight: 29 }, + [GuildFeature.Hub]: { name: 'Hub', important: false, emoji: null, weight: 30 }, + [GuildFeature.LinkedToHub]: { name: 'Linked To Hub', important: false, emoji: null, weight: 31 }, }, regions: { @@ -318,7 +323,7 @@ export class BushConstants { ChannelNews: '<:announcements:853375553531674644>', ChannelVoice: '<:voice:853375566735212584>', ChannelStage: '<:stage:853375583521210468>', - ChannelStore: '<:store:853375601175691266>', + // ChannelStore: '<:store:853375601175691266>', ChannelCategory: '<:category:853375615260819476>', ChannelThread: '<:thread:865033845753249813>' }, diff --git a/src/lib/utils/BushLogger.ts b/src/lib/utils/BushLogger.ts index 5effb52..91c23d3 100644 --- a/src/lib/utils/BushLogger.ts +++ b/src/lib/utils/BushLogger.ts @@ -1,6 +1,6 @@ import chalk from 'chalk'; // eslint-disable-next-line @typescript-eslint/no-unused-vars -import { Embed, Util, type Message, type PartialTextBasedChannelFields } from 'discord.js'; +import { EmbedBuilder, Util, type Message, type PartialTextBasedChannelFields } from 'discord.js'; import repl, { REPLServer, REPL_MODE_STRICT } from 'repl'; import { WriteStream } from 'tty'; import { inspect } from 'util'; @@ -206,7 +206,7 @@ export class BushLogger { `${chalk.bgGrey(this.#getTimeStamp())} ${chalk.grey(`[${header}]`)} ${this.#parseFormatting(newContent, 'blackBright')}` ); if (!sendChannel) return; - const embed = new Embed() + const embed = new EmbedBuilder() .setDescription(`**[${header}]** ${this.#parseFormatting(this.#stripColor(newContent), '', true)}`) .setColor(util.colors.gray) .setTimestamp(); @@ -251,7 +251,7 @@ export class BushLogger { `${chalk.bgCyan(this.#getTimeStamp())} ${chalk.cyan(`[${header}]`)} ${this.#parseFormatting(newContent, 'blueBright')}` ); if (!sendChannel) return; - const embed = new Embed() + const embed = new EmbedBuilder() .setDescription(`**[${header}]** ${this.#parseFormatting(this.#stripColor(newContent), '', true)}`) .setColor(util.colors.info) .setTimestamp(); @@ -275,7 +275,7 @@ export class BushLogger { ); if (!sendChannel) return; - const embed = new Embed() + const embed = new EmbedBuilder() .setDescription(`**[${header}]** ${this.#parseFormatting(this.#stripColor(newContent), '', true)}`) .setColor(util.colors.warn) .setTimestamp(); @@ -298,7 +298,7 @@ export class BushLogger { )}` ); if (!sendChannel) return; - const embed = new Embed() + const embed = new EmbedBuilder() .setDescription(`**[${header}]** ${this.#parseFormatting(this.#stripColor(newContent), '', true)}`) .setColor(util.colors.error) .setTimestamp(); @@ -322,7 +322,7 @@ export class BushLogger { )}` ); if (!sendChannel) return; - const embed = new Embed() + const embed = new EmbedBuilder() .setDescription(`**[${header}]** ${this.#parseFormatting(this.#stripColor(newContent), '', true)}`) .setColor(util.colors.success) .setTimestamp(); diff --git a/src/listeners/bush/appealListener.ts b/src/listeners/bush/appealListener.ts index 1dacb19..b50b3c5 100644 --- a/src/listeners/bush/appealListener.ts +++ b/src/listeners/bush/appealListener.ts @@ -1,7 +1,7 @@ /* eslint-disable no-control-regex */ import { BushListener, ModLog, type BushClientEvents } from '#lib'; import assert from 'assert'; -import { Embed } from 'discord.js'; +import { EmbedBuilder } from 'discord.js'; import UserInfoCommand from '../../commands/info/userInfo.js'; import ModlogCommand from '../../commands/moderation/modlog.js'; @@ -30,7 +30,7 @@ export default class AppealListener extends BushListener { if (!user) return await thread.send({ embeds: [ - new Embed() + new EmbedBuilder() .setTimestamp() .setColor(util.colors.error) .setTitle( @@ -55,7 +55,7 @@ export default class AppealListener extends BushListener { .slice(0, 3) .reverse(); - const embed = new Embed() + const embed = new EmbedBuilder() .setTimestamp() .setColor(util.colors.default) .setTitle(`${message.embeds[0].fields!.find((f) => f.name === 'What type of punishment are you appealing?')!.value} appeal`) diff --git a/src/listeners/bush/supportThread.ts b/src/listeners/bush/supportThread.ts index d408eef..23c1e44 100644 --- a/src/listeners/bush/supportThread.ts +++ b/src/listeners/bush/supportThread.ts @@ -1,7 +1,7 @@ import { BushListener, BushTextChannel, type BushClientEvents } from '#lib'; import assert from 'assert'; import { stripIndent } from 'common-tags'; -import { Embed, MessageType, PermissionFlagsBits } from 'discord.js'; +import { EmbedBuilder, MessageType, PermissionFlagsBits } from 'discord.js'; export default class SupportThreadListener extends BushListener { public constructor() { @@ -41,7 +41,7 @@ export default class SupportThreadListener extends BushListener { }) .catch(() => null); if (!thread) return; - const embed = new Embed() + const embed = new EmbedBuilder() .setTitle('NotEnoughUpdates Support') .setDescription( stripIndent` diff --git a/src/listeners/commands/commandError.ts b/src/listeners/commands/commandError.ts index 048c597..6a66375 100644 --- a/src/listeners/commands/commandError.ts +++ b/src/listeners/commands/commandError.ts @@ -1,7 +1,7 @@ import { type BushCommandHandlerEvents } from '#lib'; import { Severity } from '@sentry/types'; import { type AkairoMessage, type Command } from 'discord-akairo'; -import { Embed, Formatters, GuildTextBasedChannel, type Message } from 'discord.js'; +import { EmbedBuilder, Formatters, GuildTextBasedChannel, type Message } from 'discord.js'; import { BushListener } from '../../lib/extensions/discord-akairo/BushListener.js'; export default class CommandErrorListener extends BushListener { @@ -94,7 +94,7 @@ export default class CommandErrorListener extends BushListener { channel?: string; } | { error: Error | any; type: 'uncaughtException' | 'unhandledRejection'; context?: string } - ): Promise<Embed> { + ): Promise<EmbedBuilder> { const _haste = CommandErrorListener.getErrorHaste(options.error); const _stack = CommandErrorListener.getErrorStack(options.error); const [haste, stack] = await Promise.all([_haste, _stack]); @@ -122,8 +122,8 @@ export default class CommandErrorListener extends BushListener { haste: string[]; stack: string; } - ): Embed { - const embed = new Embed().setColor(util.colors.error).setTimestamp(); + ): EmbedBuilder { + const embed = new EmbedBuilder().setColor(util.colors.error).setTimestamp(); if (options.type === 'command-user') { return embed .setTitle('An Error Occurred') diff --git a/src/listeners/commands/commandStarted.ts b/src/listeners/commands/commandStarted.ts index 833eff0..4d2f0ad 100644 --- a/src/listeners/commands/commandStarted.ts +++ b/src/listeners/commands/commandStarted.ts @@ -22,7 +22,8 @@ export default class CommandStartedListener extends BushListener { 'message.type': message.util.isSlash ? 'slash' : 'normal', 'message.parsed.content': message.util.parsed?.content, 'channel.id': (message.channel.isDMBased() ? message.channel.recipient?.id : message.channel?.id) ?? '¯_(ツ)_/¯', - 'channel.name': (message.channel.isDMBased() ? message.channel.recipient?.tag : message.channel?.name) ?? '¯_(ツ)_/¯', + 'channel.name': + (message.channel.isDMBased() ? message.channel.recipient?.tag : (<any>message.channel)?.name) ?? '¯_(ツ)_/¯', 'guild.id': message.guild?.id ?? '¯_(ツ)_/¯', 'guild.name': message.guild?.name ?? '¯_(ツ)_/¯', 'environment': client.config.environment diff --git a/src/listeners/guild-custom/bushLockdown.ts b/src/listeners/guild-custom/bushLockdown.ts index b27dfba..54e1ab1 100644 --- a/src/listeners/guild-custom/bushLockdown.ts +++ b/src/listeners/guild-custom/bushLockdown.ts @@ -1,5 +1,5 @@ import { BushListener, type BushClientEvents } from '#lib'; -import { Embed } from 'discord.js'; +import { EmbedBuilder } from 'discord.js'; export default class BushLockdownListener extends BushListener { public constructor() { @@ -14,7 +14,7 @@ export default class BushLockdownListener extends BushListener { const logChannel = await moderator.guild.getLogChannel('moderation'); if (!logChannel) return; - const logEmbed = new Embed() + const logEmbed = new EmbedBuilder() .setColor(util.colors.Blurple) .setTimestamp() .addFields({ name: '**Action**', value: `${'Lockdown'}` }) diff --git a/src/listeners/guild-custom/bushUnlockdown.ts b/src/listeners/guild-custom/bushUnlockdown.ts index 0de83d2..4697c92 100644 --- a/src/listeners/guild-custom/bushUnlockdown.ts +++ b/src/listeners/guild-custom/bushUnlockdown.ts @@ -1,5 +1,5 @@ import { BushListener, type BushClientEvents } from '#lib'; -import { Embed } from 'discord.js'; +import { EmbedBuilder } from 'discord.js'; export default class BushUnlockdownListener extends BushListener { public constructor() { @@ -14,7 +14,7 @@ export default class BushUnlockdownListener extends BushListener { const logChannel = await moderator.guild.getLogChannel('moderation'); if (!logChannel) return; - const logEmbed = new Embed() + const logEmbed = new EmbedBuilder() .setColor(util.colors.Blurple) .setTimestamp() .addFields({ name: '**Action**', value: `${'Unlockdown'}` }) diff --git a/src/listeners/guild/guildMemberAdd.ts b/src/listeners/guild/guildMemberAdd.ts index adbca0f..27d5be2 100644 --- a/src/listeners/guild/guildMemberAdd.ts +++ b/src/listeners/guild/guildMemberAdd.ts @@ -1,5 +1,5 @@ import { BushListener, type BushClientEvents, type BushGuildMember, type BushTextChannel } from '#lib'; -import { Embed } from 'discord.js'; +import { EmbedBuilder } from 'discord.js'; export default class GuildMemberAddListener extends BushListener { public constructor() { @@ -28,7 +28,7 @@ export default class GuildMemberAddListener extends BushListener { // eslint-disable-next-line @typescript-eslint/no-base-to-string return welcome.guild.error('Send Welcome Message', `I do not have permission to send messages in ${welcome}.`); - const embed = new Embed() + const embed = new EmbedBuilder() .setDescription( `${util.emojis.join} ${util.format.input( member.user.tag diff --git a/src/listeners/guild/guildMemberRemove.ts b/src/listeners/guild/guildMemberRemove.ts index d71f3fd..8e7ce0d 100644 --- a/src/listeners/guild/guildMemberRemove.ts +++ b/src/listeners/guild/guildMemberRemove.ts @@ -7,7 +7,7 @@ import { type BushTextChannel, type PartialBushGuildMember } from '#lib'; -import { Embed } from 'discord.js'; +import { EmbedBuilder } from 'discord.js'; export default class GuildMemberRemoveListener extends BushListener { public constructor() { @@ -32,7 +32,7 @@ export default class GuildMemberRemoveListener extends BushListener { if (!welcomeChannel) return; const welcome = client.channels.cache.get(welcomeChannel) as BushTextChannel | undefined; if (member.guild.id !== welcome?.guild.id) throw new Error('Welcome channel must be in the guild.'); - const embed: Embed = new Embed() + const embed: EmbedBuilder = new EmbedBuilder() .setDescription( `${util.emojis.leave} ${util.format.input(user.tag)} ${ isBan ? 'got banned from' : 'left' diff --git a/src/listeners/interaction/interactionCreate.ts b/src/listeners/interaction/interactionCreate.ts index 6916134..f3b786c 100644 --- a/src/listeners/interaction/interactionCreate.ts +++ b/src/listeners/interaction/interactionCreate.ts @@ -1,5 +1,5 @@ import { AutoMod, BushListener, type BushButtonInteraction, type BushClientEvents } from '#lib'; -import { InteractionType } from 'discord-api-types/v9'; +import { InteractionType } from 'discord-api-types/v10'; export default class InteractionCreateListener extends BushListener { public constructor() { diff --git a/src/listeners/member-custom/bushBan.ts b/src/listeners/member-custom/bushBan.ts index cd700a9..efdabb9 100644 --- a/src/listeners/member-custom/bushBan.ts +++ b/src/listeners/member-custom/bushBan.ts @@ -1,5 +1,5 @@ import { BushListener, type BushClientEvents } from '#lib'; -import { Embed, GuildMember } from 'discord.js'; +import { EmbedBuilder, GuildMember } from 'discord.js'; export default class BushBanListener extends BushListener { public constructor() { @@ -15,7 +15,7 @@ export default class BushBanListener extends BushListener { if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; - const logEmbed = new Embed() + const logEmbed = new EmbedBuilder() .setColor(util.colors.Red) .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) diff --git a/src/listeners/member-custom/bushBlock.ts b/src/listeners/member-custom/bushBlock.ts index 111c945..26de816 100644 --- a/src/listeners/member-custom/bushBlock.ts +++ b/src/listeners/member-custom/bushBlock.ts @@ -1,5 +1,5 @@ import { BushListener, type BushClientEvents } from '#lib'; -import { Embed, GuildMember } from 'discord.js'; +import { EmbedBuilder, GuildMember } from 'discord.js'; export default class BushBlockListener extends BushListener { public constructor() { @@ -17,7 +17,7 @@ export default class BushBlockListener extends BushListener { if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; - const logEmbed = new Embed() + const logEmbed = new EmbedBuilder() .setColor(util.colors.Purple) .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) diff --git a/src/listeners/member-custom/bushKick.ts b/src/listeners/member-custom/bushKick.ts index f3e5df1..5494db3 100644 --- a/src/listeners/member-custom/bushKick.ts +++ b/src/listeners/member-custom/bushKick.ts @@ -1,5 +1,5 @@ import { BushListener, type BushClientEvents } from '#lib'; -import { Embed, GuildMember } from 'discord.js'; +import { EmbedBuilder, GuildMember } from 'discord.js'; export default class BushKickListener extends BushListener { public constructor() { @@ -15,7 +15,7 @@ export default class BushKickListener extends BushListener { if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; - const logEmbed = new Embed() + const logEmbed = new EmbedBuilder() .setColor(util.colors.Red) .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) diff --git a/src/listeners/member-custom/bushMute.ts b/src/listeners/member-custom/bushMute.ts index 6f05fcc..df723eb 100644 --- a/src/listeners/member-custom/bushMute.ts +++ b/src/listeners/member-custom/bushMute.ts @@ -1,5 +1,5 @@ import { BushListener, type BushClientEvents } from '#lib'; -import { Embed, GuildMember } from 'discord.js'; +import { EmbedBuilder, GuildMember } from 'discord.js'; export default class BushMuteListener extends BushListener { public constructor() { @@ -15,7 +15,7 @@ export default class BushMuteListener extends BushListener { if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; - const logEmbed = new Embed() + const logEmbed = new EmbedBuilder() .setColor(util.colors.Orange) .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) diff --git a/src/listeners/member-custom/bushPunishRole.ts b/src/listeners/member-custom/bushPunishRole.ts index b3eeef0..716488e 100644 --- a/src/listeners/member-custom/bushPunishRole.ts +++ b/src/listeners/member-custom/bushPunishRole.ts @@ -1,5 +1,5 @@ import { BushListener, type BushClientEvents } from '#lib'; -import { Embed, GuildMember } from 'discord.js'; +import { EmbedBuilder, GuildMember } from 'discord.js'; export default class BushPunishRoleListener extends BushListener { public constructor() { @@ -15,7 +15,7 @@ export default class BushPunishRoleListener extends BushListener { if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; - const logEmbed = new Embed() + const logEmbed = new EmbedBuilder() .setColor(util.colors.Yellow) .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) diff --git a/src/listeners/member-custom/bushPunishRoleRemove.ts b/src/listeners/member-custom/bushPunishRoleRemove.ts index 22b17a7..c5103e3 100644 --- a/src/listeners/member-custom/bushPunishRoleRemove.ts +++ b/src/listeners/member-custom/bushPunishRoleRemove.ts @@ -1,5 +1,5 @@ import { BushListener, type BushClientEvents } from '#lib'; -import { Embed, GuildMember } from 'discord.js'; +import { EmbedBuilder, GuildMember } from 'discord.js'; export default class BushPunishRoleRemoveListener extends BushListener { public constructor() { @@ -15,7 +15,7 @@ export default class BushPunishRoleRemoveListener extends BushListener { if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; - const logEmbed = new Embed() + const logEmbed = new EmbedBuilder() .setColor(util.colors.Green) .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) diff --git a/src/listeners/member-custom/bushPurge.ts b/src/listeners/member-custom/bushPurge.ts index 2834397..1c373fb 100644 --- a/src/listeners/member-custom/bushPurge.ts +++ b/src/listeners/member-custom/bushPurge.ts @@ -1,5 +1,5 @@ import { BushListener, type BushClientEvents } from '#lib'; -import { Embed } from 'discord.js'; +import { EmbedBuilder } from '@discordjs/builders'; export default class BushPurgeListener extends BushListener { public constructor() { @@ -23,7 +23,7 @@ export default class BushPurgeListener extends BushListener { })); const haste = await util.inspectCleanRedactHaste(mappedMessages); - const logEmbed = new Embed() + const logEmbed = new EmbedBuilder() .setColor(util.colors.DarkPurple) .setTimestamp() .setFooter({ text: `${messages.size.toLocaleString()} Messages` }) diff --git a/src/listeners/member-custom/bushRemoveTimeout.ts b/src/listeners/member-custom/bushRemoveTimeout.ts index f2a20ed..bf2e402 100644 --- a/src/listeners/member-custom/bushRemoveTimeout.ts +++ b/src/listeners/member-custom/bushRemoveTimeout.ts @@ -1,5 +1,5 @@ import { BushListener, type BushClientEvents } from '#lib'; -import { Embed, GuildMember } from 'discord.js'; +import { EmbedBuilder, GuildMember } from 'discord.js'; export default class BushRemoveTimeoutListener extends BushListener { public constructor() { @@ -15,7 +15,7 @@ export default class BushRemoveTimeoutListener extends BushListener { if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; - const logEmbed = new Embed() + const logEmbed = new EmbedBuilder() .setColor(util.colors.Green) .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) diff --git a/src/listeners/member-custom/bushTimeout.ts b/src/listeners/member-custom/bushTimeout.ts index d0eedf2..d319eb6 100644 --- a/src/listeners/member-custom/bushTimeout.ts +++ b/src/listeners/member-custom/bushTimeout.ts @@ -1,5 +1,5 @@ import { BushListener, type BushClientEvents } from '#lib'; -import { Embed, GuildMember } from 'discord.js'; +import { EmbedBuilder, GuildMember } from 'discord.js'; export default class BushTimeoutListener extends BushListener { public constructor() { @@ -17,7 +17,7 @@ export default class BushTimeoutListener extends BushListener { if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; - const logEmbed = new Embed() + const logEmbed = new EmbedBuilder() .setColor(util.colors.Orange) .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) diff --git a/src/listeners/member-custom/bushUnban.ts b/src/listeners/member-custom/bushUnban.ts index a3370c8..f7701b2 100644 --- a/src/listeners/member-custom/bushUnban.ts +++ b/src/listeners/member-custom/bushUnban.ts @@ -1,5 +1,5 @@ import { BushListener, type BushClientEvents } from '#lib'; -import { Embed, GuildMember } from 'discord.js'; +import { EmbedBuilder, GuildMember } from 'discord.js'; export default class BushUnbanListener extends BushListener { public constructor() { @@ -15,7 +15,7 @@ export default class BushUnbanListener extends BushListener { if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; - const logEmbed = new Embed() + const logEmbed = new EmbedBuilder() .setColor(util.colors.Green) .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) diff --git a/src/listeners/member-custom/bushUnblock.ts b/src/listeners/member-custom/bushUnblock.ts index 19d7fad..4b6ce11 100644 --- a/src/listeners/member-custom/bushUnblock.ts +++ b/src/listeners/member-custom/bushUnblock.ts @@ -1,5 +1,5 @@ import { BushListener, type BushClientEvents } from '#lib'; -import { Embed, GuildMember } from 'discord.js'; +import { EmbedBuilder, GuildMember } from 'discord.js'; export default class BushUnblockListener extends BushListener { public constructor() { @@ -15,7 +15,7 @@ export default class BushUnblockListener extends BushListener { if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; - const logEmbed = new Embed() + const logEmbed = new EmbedBuilder() .setColor(util.colors.Green) .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) diff --git a/src/listeners/member-custom/bushUnmute.ts b/src/listeners/member-custom/bushUnmute.ts index 791fa19..9857f64 100644 --- a/src/listeners/member-custom/bushUnmute.ts +++ b/src/listeners/member-custom/bushUnmute.ts @@ -1,5 +1,5 @@ import { BushListener, type BushClientEvents } from '#lib'; -import { Embed, GuildMember } from 'discord.js'; +import { EmbedBuilder, GuildMember } from 'discord.js'; export default class BushUnmuteListener extends BushListener { public constructor() { @@ -15,7 +15,7 @@ export default class BushUnmuteListener extends BushListener { if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; - const logEmbed = new Embed() + const logEmbed = new EmbedBuilder() .setColor(util.colors.Green) .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) diff --git a/src/listeners/member-custom/bushUpdateModlog.ts b/src/listeners/member-custom/bushUpdateModlog.ts index a8fb277..2cc5e48 100644 --- a/src/listeners/member-custom/bushUpdateModlog.ts +++ b/src/listeners/member-custom/bushUpdateModlog.ts @@ -1,5 +1,5 @@ import { BushListener, type BushClientEvents } from '#lib'; -import { Embed } from 'discord.js'; +import { EmbedBuilder } from 'discord.js'; export default class BushUpdateModlogListener extends BushListener { public constructor() { @@ -14,7 +14,7 @@ export default class BushUpdateModlogListener extends BushListener { const logChannel = await moderator.guild.getLogChannel('moderation'); if (!logChannel) return; - const logEmbed = new Embed() + const logEmbed = new EmbedBuilder() .setColor(util.colors.Blurple) .setTimestamp() .setAuthor({ diff --git a/src/listeners/member-custom/bushUpdateSettings.ts b/src/listeners/member-custom/bushUpdateSettings.ts index 1ce8806..7c7828e 100644 --- a/src/listeners/member-custom/bushUpdateSettings.ts +++ b/src/listeners/member-custom/bushUpdateSettings.ts @@ -1,5 +1,5 @@ import { BushListener, type BushClientEvents } from '#lib'; -import { Embed } from 'discord.js'; +import { EmbedBuilder } from 'discord.js'; export default class BushUpdateSettingsListener extends BushListener { public constructor() { @@ -14,7 +14,7 @@ export default class BushUpdateSettingsListener extends BushListener { const logChannel = await guild.getLogChannel('moderation'); if (!logChannel) return; - const logEmbed = new Embed().setColor(util.colors.Blurple).setTimestamp(); + const logEmbed = new EmbedBuilder().setColor(util.colors.Blurple).setTimestamp(); if (moderator) logEmbed.setAuthor({ diff --git a/src/listeners/member-custom/bushWarn.ts b/src/listeners/member-custom/bushWarn.ts index c22f61f..724a266 100644 --- a/src/listeners/member-custom/bushWarn.ts +++ b/src/listeners/member-custom/bushWarn.ts @@ -1,5 +1,5 @@ import { BushListener, type BushClientEvents } from '#lib'; -import { Embed, GuildMember } from 'discord.js'; +import { EmbedBuilder, GuildMember } from 'discord.js'; export default class BushWarnListener extends BushListener { public constructor() { @@ -15,7 +15,7 @@ export default class BushWarnListener extends BushListener { if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; - const logEmbed = new Embed() + const logEmbed = new EmbedBuilder() .setColor(util.colors.Yellow) .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) diff --git a/src/listeners/message/blacklistedFile.ts b/src/listeners/message/blacklistedFile.ts index 77c4971..a6216a5 100644 --- a/src/listeners/message/blacklistedFile.ts +++ b/src/listeners/message/blacklistedFile.ts @@ -67,7 +67,6 @@ export default class BlacklistedFileListener extends BushListener { public override async exec(...[message]: BushClientEvents['messageCreate']) { if (!message.guild || !(await message.guild.hasFeature('blacklistedFile'))) return; - // eslint-disable-next-line deprecation/deprecation // const embedAttachments = message.embeds.filter((e) => ['image', 'video', 'gifv'].includes(e.type)); const foundEmojis = [...message.content.matchAll(/<(?<animated>a?):\w+:(?<id>\d+)>/g)]; if (message.attachments.size + /* embedAttachments.length + */ foundEmojis.length < 1) return; diff --git a/src/listeners/message/directMessage.ts b/src/listeners/message/directMessage.ts index 575fbda..dd0c8ae 100644 --- a/src/listeners/message/directMessage.ts +++ b/src/listeners/message/directMessage.ts @@ -1,5 +1,5 @@ import { BushListener, type BushClientEvents } from '#lib'; -import { ChannelType, Embed } from 'discord.js'; +import { ChannelType, EmbedBuilder } from 'discord.js'; export default class DirectMessageListener extends BushListener { public constructor() { @@ -14,7 +14,7 @@ export default class DirectMessageListener extends BushListener { if (message.channel.type === ChannelType.DM) { if (!(message.author.id == client.user!.id) && message.author.bot) return; if (client.cache.global.blacklistedUsers.includes(message.author.id)) return; - const dmLogEmbed = new Embed().setTimestamp().setFooter({ text: `User ID • ${message.channel.recipientId}` }); + const dmLogEmbed = new EmbedBuilder().setTimestamp().setFooter({ text: `User ID • ${message.channel.recipientId}` }); if (message.author.id != client.user!.id) { dmLogEmbed diff --git a/src/listeners/other/consoleListener.ts b/src/listeners/other/consoleListener.ts index 15461f2..0c30724 100644 --- a/src/listeners/other/consoleListener.ts +++ b/src/listeners/other/consoleListener.ts @@ -25,7 +25,7 @@ import { promisify } from 'util'; Interaction, Message, ActionRow, - MessageAttachment, + Attachment, ButtonComponent, MessageCollector, InteractionCollector, diff --git a/src/listeners/track-manual-punishments/modlogSyncBan.ts b/src/listeners/track-manual-punishments/modlogSyncBan.ts index b1bdcee..106224a 100644 --- a/src/listeners/track-manual-punishments/modlogSyncBan.ts +++ b/src/listeners/track-manual-punishments/modlogSyncBan.ts @@ -1,6 +1,7 @@ import { BushListener, BushUser, Moderation, ModLogType, Time, type BushClientEvents } from '#lib'; -import { AuditLogEvent } from 'discord-api-types/v9'; -import { Embed, PermissionFlagsBits } from 'discord.js'; +import { EmbedBuilder } from '@discordjs/builders'; +import { AuditLogEvent } from 'discord-api-types/v10'; +import { PermissionFlagsBits } from 'discord.js'; export default class ModlogSyncBanListener extends BushListener { public constructor() { @@ -51,7 +52,7 @@ export default class ModlogSyncBanListener extends BushListener { const logChannel = await ban.guild.getLogChannel('moderation'); if (!logChannel) return; - const logEmbed = new Embed() + const logEmbed = new EmbedBuilder() .setColor(util.colors.Red) .setTimestamp() .setFooter({ text: `CaseID: ${log.id}` }) diff --git a/src/listeners/track-manual-punishments/modlogSyncKick.ts b/src/listeners/track-manual-punishments/modlogSyncKick.ts index 59b43bc..cff397b 100644 --- a/src/listeners/track-manual-punishments/modlogSyncKick.ts +++ b/src/listeners/track-manual-punishments/modlogSyncKick.ts @@ -1,6 +1,6 @@ import { BushListener, BushUser, Moderation, ModLogType, Time, type BushClientEvents } from '#lib'; -import { AuditLogEvent } from 'discord-api-types/v9'; -import { Embed, PermissionFlagsBits } from 'discord.js'; +import { AuditLogEvent } from 'discord-api-types/v10'; +import { EmbedBuilder, PermissionFlagsBits } from 'discord.js'; export default class ModlogSyncKickListener extends BushListener { public constructor() { @@ -51,7 +51,7 @@ export default class ModlogSyncKickListener extends BushListener { const logChannel = await member.guild.getLogChannel('moderation'); if (!logChannel) return; - const logEmbed = new Embed() + const logEmbed = new EmbedBuilder() .setColor(util.colors.Red) .setTimestamp() .setFooter({ text: `CaseID: ${log.id}` }) diff --git a/src/listeners/track-manual-punishments/modlogSyncTimeout.ts b/src/listeners/track-manual-punishments/modlogSyncTimeout.ts index 8ad8b79..57e7ae6 100644 --- a/src/listeners/track-manual-punishments/modlogSyncTimeout.ts +++ b/src/listeners/track-manual-punishments/modlogSyncTimeout.ts @@ -1,6 +1,6 @@ import { BushListener, BushUser, Moderation, ModLogType, Time, type BushClientEvents } from '#lib'; -import { AuditLogEvent } from 'discord-api-types/v9'; -import { Embed, PermissionFlagsBits } from 'discord.js'; +import { AuditLogEvent } from 'discord-api-types/v10'; +import { EmbedBuilder, PermissionFlagsBits } from 'discord.js'; export default class ModlogSyncTimeoutListener extends BushListener { public constructor() { @@ -56,7 +56,7 @@ export default class ModlogSyncTimeoutListener extends BushListener { const logChannel = await newMember.guild.getLogChannel('moderation'); if (!logChannel) return; - const logEmbed = new Embed() + const logEmbed = new EmbedBuilder() .setColor(util.colors[newTime ? 'Orange' : 'Green']) .setTimestamp() .setFooter({ text: `CaseID: ${log.id}` }) diff --git a/src/listeners/track-manual-punishments/modlogSyncUnban.ts b/src/listeners/track-manual-punishments/modlogSyncUnban.ts index 1c5de1d..f7b9730 100644 --- a/src/listeners/track-manual-punishments/modlogSyncUnban.ts +++ b/src/listeners/track-manual-punishments/modlogSyncUnban.ts @@ -1,6 +1,7 @@ import { BushListener, BushUser, Moderation, ModLogType, Time, type BushClientEvents } from '#lib'; -import { AuditLogEvent } from 'discord-api-types/v9'; -import { Embed, PermissionFlagsBits } from 'discord.js'; +import { EmbedBuilder } from '@discordjs/builders'; +import { AuditLogEvent } from 'discord-api-types/v10'; +import { PermissionFlagsBits } from 'discord.js'; export default class ModlogSyncUnbanListener extends BushListener { public constructor() { @@ -50,7 +51,7 @@ export default class ModlogSyncUnbanListener extends BushListener { const logChannel = await ban.guild.getLogChannel('moderation'); if (!logChannel) return; - const logEmbed = new Embed() + const logEmbed = new EmbedBuilder() .setColor(util.colors.Orange) .setTimestamp() .setFooter({ text: `CaseID: ${log.id}` }) diff --git a/src/listeners/ws/INTERACTION_CREATE.ts b/src/listeners/ws/INTERACTION_CREATE.ts index c245418..76b5a0e 100644 --- a/src/listeners/ws/INTERACTION_CREATE.ts +++ b/src/listeners/ws/INTERACTION_CREATE.ts @@ -1,4 +1,5 @@ import { BushListener, BushUser, Moderation, ModLog, PunishmentTypePresent } from '#lib'; +import { EmbedBuilder } from '@discordjs/builders'; import assert from 'assert'; import { APIEmbed, @@ -14,8 +15,8 @@ import { InteractionType, Routes, TextInputStyle -} from 'discord-api-types/v9'; -import { ActionRow, ButtonComponent, Embed, Snowflake } from 'discord.js'; +} from 'discord-api-types/v10'; +import { ActionRowBuilder, ButtonBuilder, Snowflake } from 'discord.js'; export default class WsInteractionCreateListener extends BushListener { public constructor() { @@ -192,7 +193,7 @@ export default class WsInteractionCreateListener extends BushListener { const caseId = await ModLog.findOne({ where: { user: userId, guild: guildId, id: modlogCase } }); - const embed = new Embed() + const embed = new EmbedBuilder() .setTitle(`${util.capitalize(punishment)} Appeal`) .setColor(util.colors.newBlurple) .setTimestamp() @@ -213,14 +214,14 @@ export default class WsInteractionCreateListener extends BushListener { .toJSON() as APIEmbed; const components = [ - new ActionRow({ + new ActionRowBuilder<ButtonBuilder>({ components: [ - new ButtonComponent({ + new ButtonBuilder({ customId: `appeal_accept;${punishment};${guildId};${userId};${modlogCase}`, label: 'Accept', style: ButtonStyle.Success }).toJSON(), - new ButtonComponent({ + new ButtonBuilder({ customId: `appeal_deny;${punishment};${guildId};${userId};${modlogCase}`, label: 'Deny', style: ButtonStyle.Danger |