diff options
Diffstat (limited to 'src')
86 files changed, 583 insertions, 523 deletions
diff --git a/src/commands/admin/channelPermissions.ts b/src/commands/admin/channelPermissions.ts index f0d2c65..4f511cd 100644 --- a/src/commands/admin/channelPermissions.ts +++ b/src/commands/admin/channelPermissions.ts @@ -1,5 +1,5 @@ import { BushCommand, ButtonPaginator, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; -import { ApplicationCommandOptionType, MessageEmbed, Permissions } from 'discord.js'; +import { ApplicationCommandOptionType, Embed, Permissions } from 'discord.js'; export default class ChannelPermissionsCommand extends BushCommand { public constructor() { @@ -89,9 +89,9 @@ export default class ChannelPermissionsCommand extends BushCommand { } const failure = failedChannels.map((c) => `<#${c.id}>`).join(' '); if (failure.length > 2000) { - const paginate: MessageEmbed[] = []; + const paginate: Embed[] = []; for (let i = 0; i < failure.length; i += 4000) { - paginate.push(new MessageEmbed().setDescription(failure.substring(i, Math.min(failure.length, i + 4000)))); + paginate.push(new Embed().setDescription(failure.substring(i, Math.min(failure.length, i + 4000)))); } const normalMessage = `Finished changing perms! Failed channels:`; return await ButtonPaginator.send(message, paginate, normalMessage); diff --git a/src/commands/config/config.ts b/src/commands/config/config.ts index 41bdc04..42ff309 100644 --- a/src/commands/config/config.ts +++ b/src/commands/config/config.ts @@ -16,9 +16,10 @@ import { ButtonComponent, ButtonStyle, Channel, + Embed, Formatters, GuildMember, - MessageEmbed, + InteractionUpdateOptions, Permissions, Role, SelectMenuComponent, @@ -286,9 +287,9 @@ export default class ConfigCommand extends BushCommand { public async generateMessageOptions( message: BushMessage | BushSlashMessage, setting?: undefined | keyof typeof guildSettingsObj - ): Promise<MessageOptions> { + ): Promise<MessageOptions & InteractionUpdateOptions> { if (!message.guild) throw new Error('message.guild is null'); - const settingsEmbed = new MessageEmbed().setColor(util.colors.default); + const settingsEmbed = new Embed().setColor(util.colors.default); if (!setting) { settingsEmbed.setTitle(`${message.guild!.name}'s Settings`); const desc = settingsArr.map((s) => `:wrench: **${guildSettingsObj[s].name}**`).join('\n'); @@ -364,7 +365,10 @@ export default class ConfigCommand extends BushCommand { message.util.isSlash ? _.snakeCase(setting) : setting } ${guildSettingsObj[setting].type.includes('-array') ? 'add/remove' : 'set'} <value>" to set this setting.` }); - settingsEmbed.addField('value', (await generateCurrentValue(guildSettingsObj[setting].type)) || '[No Value Set]'); + settingsEmbed.addField({ + name: 'value', + value: (await generateCurrentValue(guildSettingsObj[setting].type)) || '[No Value Set]' + }); return { embeds: [settingsEmbed], components: [components] }; } } diff --git a/src/commands/config/features.ts b/src/commands/config/features.ts index fdd6c1e..04c0425 100644 --- a/src/commands/config/features.ts +++ b/src/commands/config/features.ts @@ -9,7 +9,7 @@ import { import { ActionRow, ComponentType, - MessageEmbed, + Embed, Permissions, SelectMenuComponent, SelectMenuOption, @@ -35,7 +35,7 @@ export default class FeaturesCommand extends BushCommand { public override async exec(message: BushMessage | BushSlashMessage) { if (!message.guild) return await message.util.reply(`${util.emojis.error} This command can only be used in servers.`); - const featureEmbed = new MessageEmbed().setTitle(`${message.guild!.name}'s Features`).setColor(util.colors.default); + const featureEmbed = new Embed().setTitle(`${message.guild!.name}'s Features`).setColor(util.colors.default); const enabledFeatures = await message.guild!.getSetting('enabledFeatures'); this.generateDescription(guildFeaturesArr, enabledFeatures, featureEmbed); @@ -71,7 +71,7 @@ export default class FeaturesCommand extends BushCommand { }); } - public generateDescription(allFeatures: GuildFeatures[], currentFeatures: GuildFeatures[], embed: MessageEmbed): void { + public generateDescription(allFeatures: GuildFeatures[], currentFeatures: GuildFeatures[], embed: Embed): void { embed.setDescription( allFeatures .map( diff --git a/src/commands/config/log.ts b/src/commands/config/log.ts index 5906623..4c9a20b 100644 --- a/src/commands/config/log.ts +++ b/src/commands/config/log.ts @@ -1,6 +1,6 @@ import { BushCommand, guildLogsArr, type ArgType, type BushMessage, type BushSlashMessage, type GuildLogType } from '#lib'; -import { type ArgumentOptions, type Flag } from 'discord-akairo'; -import { ApplicationCommandOptionType, Permissions } from 'discord.js'; +import { ArgumentGeneratorReturn } from 'discord-akairo'; +import { ApplicationCommandOptionType, ChannelType, Permissions } from 'discord.js'; export default class LogCommand extends BushCommand { public constructor() { @@ -26,7 +26,13 @@ export default class LogCommand extends BushCommand { type: 'channel', prompt: 'What channel would you like these logs to be sent in?', slashType: ApplicationCommandOptionType.Channel, - channelTypes: ['GuildText', 'GuildNews', 'GuildNewsThread', 'GuildPublicThread', 'GuildPrivateThread'], + channelTypes: [ + ChannelType.GuildText, + ChannelType.GuildNews, + ChannelType.GuildNewsThread, + ChannelType.GuildPublicThread, + ChannelType.GuildPrivateThread + ], only: 'slash' } ], @@ -36,7 +42,7 @@ export default class LogCommand extends BushCommand { }); } - public override *args(): IterableIterator<ArgumentOptions | Flag> { + public override *args(): ArgumentGeneratorReturn { const log_type = yield { id: 'log_type', type: guildLogsArr, diff --git a/src/commands/dev/eval.ts b/src/commands/dev/eval.ts index 92b1117..c8541c6 100644 --- a/src/commands/dev/eval.ts +++ b/src/commands/dev/eval.ts @@ -25,13 +25,13 @@ import { CommandInteraction, ContextMenuCommandInteraction, DMChannel, + Embed, Emoji, Interaction, InteractionCollector, Message, MessageAttachment, MessageCollector, - MessageEmbed, ReactionCollector, SelectMenuComponent, Util @@ -194,7 +194,7 @@ export default class EvalCommand extends BushCommand { lang: isTypescript ? 'ts' : 'js' }; - const embed = new MessageEmbed(); + const embed = new Embed(); const badPhrases = ['delete', 'destroy']; if (badPhrases.some((p) => code[code.lang]!.includes(p)) && !args.sudo) { @@ -233,16 +233,22 @@ export default class EvalCommand extends BushCommand { : undefined; embed.setTitle(`${emojis.successFull} Successfully Evaluated Expression`).setColor(colors.success); - if (inputTS) embed.addField('📥 Input (typescript)', inputTS).addField('📥 Input (transpiled javascript)', inputJS); - else embed.addField('📥 Input', inputJS); - embed.addField('📤 Output', output); - if (methods) embed.addField('🔧 Methods', methods); - if (proto) embed.addField('⚙️ Proto', proto); + if (inputTS) + embed + .addField({ name: '📥 Input (typescript)', value: inputTS }) + .addField({ name: '📥 Input (transpiled javascript)', value: inputJS }); + else embed.addField({ name: '📥 Input', value: inputJS }); + embed.addField({ name: '📤 Output', value: output }); + if (methods) embed.addField({ name: '🔧 Methods', value: methods }); + if (proto) embed.addField({ name: '⚙️ Proto', value: proto }); } catch (e) { embed.setTitle(`${emojis.errorFull} Unable to Evaluate Expression`).setColor(colors.error); - if (inputTS) embed.addField('📥 Input (typescript)', inputTS).addField('📥 Input (transpiled javascript)', inputJS); - else embed.addField('📥 Input', inputJS); - embed.addField('📤 Error', await util.inspectCleanRedactCodeblock(e, 'js')); + if (inputTS) + embed + .addField({ name: '📥 Input (typescript)', value: inputTS }) + .addField({ name: '📥 Input (transpiled javascript)', value: inputJS }); + else embed.addField({ name: '📥 Input', value: inputJS }); + embed.addField({ name: '📤 Error', value: await util.inspectCleanRedactCodeblock(e, 'js') }); } embed.setTimestamp().setFooter({ text: message.author.tag, iconURL: message.author.displayAvatarURL() ?? undefined }); diff --git a/src/commands/dev/javascript.ts b/src/commands/dev/javascript.ts index 9d6a20b..3ede3e2 100644 --- a/src/commands/dev/javascript.ts +++ b/src/commands/dev/javascript.ts @@ -1,6 +1,6 @@ import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; import assert from 'assert'; -import { ApplicationCommandOptionType, MessageEmbed } from 'discord.js'; +import { ApplicationCommandOptionType, Embed } from 'discord.js'; import { VM } from 'vm2'; assert(VM); @@ -53,7 +53,7 @@ export default class JavascriptCommand extends BushCommand { await message.interaction.deferReply({ ephemeral: false }); } const code = args.code.replace(/[“”]/g, '"').replace(/```*(?:js)?/g, ''); - const embed = new MessageEmbed(); + const embed = new Embed(); const input = await util.inspectCleanRedactCodeblock(code, 'js'); try { @@ -67,12 +67,12 @@ export default class JavascriptCommand extends BushCommand { }); embed.setTitle(`${util.emojis.successFull} Successfully Evaluated Expression`).setColor(util.colors.success); - embed.addField('📥 Input', input); - embed.addField('📤 Output', output); + embed.addField({ name: '📥 Input', value: input }); + embed.addField({ name: '📤 Output', value: output }); } catch (e) { embed.setTitle(`${util.emojis.errorFull} Unable to Evaluate Expression`).setColor(util.colors.error); - embed.addField('📥 Input', input); - embed.addField('📤 Error', await util.inspectCleanRedactCodeblock(e, 'js')); + embed.addField({ name: '📥 Input', value: input }); + embed.addField({ name: '📤 Error', value: await util.inspectCleanRedactCodeblock(e, 'js') }); } embed.setTimestamp().setFooter({ text: message.author.tag, iconURL: message.author.displayAvatarURL() ?? undefined }); diff --git a/src/commands/dev/servers.ts b/src/commands/dev/servers.ts index 308d1db..173970b 100644 --- a/src/commands/dev/servers.ts +++ b/src/commands/dev/servers.ts @@ -1,5 +1,6 @@ import { BushCommand, ButtonPaginator, type BushMessage, type BushSlashMessage } from '#lib'; -import { type Guild, type MessageEmbedOptions } from 'discord.js'; +import { APIEmbed } from 'discord-api-types'; +import { type Guild } from 'discord.js'; export default class ServersCommand extends BushCommand { public constructor() { @@ -18,7 +19,7 @@ export default class ServersCommand extends BushCommand { public override async exec(message: BushMessage | BushSlashMessage) { const guilds = [...client.guilds.cache.sort((a, b) => (a.memberCount < b.memberCount ? 1 : -1)).values()]; const chunkedGuilds: Guild[][] = util.chunk(guilds, 10); - const embeds: MessageEmbedOptions[] = chunkedGuilds.map((chunk) => { + const embeds: APIEmbed[] = chunkedGuilds.map((chunk) => { return { title: `Server List [\`${guilds.length.toLocaleString()}\`]`, color: util.colors.default, @@ -30,7 +31,7 @@ export default class ServersCommand extends BushCommand { `**Members:** ${guild.memberCount.toLocaleString()}` ].join('\n') })) - } as MessageEmbedOptions; + } as APIEmbed; }); return await ButtonPaginator.send(message, embeds); diff --git a/src/commands/dev/sh.ts b/src/commands/dev/sh.ts index f74dedf..7d29df7 100644 --- a/src/commands/dev/sh.ts +++ b/src/commands/dev/sh.ts @@ -2,7 +2,7 @@ import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib'; import assert from 'assert'; import chalk from 'chalk'; import { exec } from 'child_process'; -import { ApplicationCommandOptionType, MessageEmbed, Util } from 'discord.js'; +import { ApplicationCommandOptionType, Embed, Util } from 'discord.js'; import { promisify } from 'util'; assert(chalk); @@ -45,13 +45,13 @@ export default class ShCommand extends BushCommand { return await message.util.reply(`${util.emojis.error} Only my developers can run this command.`); const input = clean(command); - const embed = new MessageEmbed() + const embed = new Embed() .setColor(util.colors.gray) .setFooter({ text: message.author.tag, iconURL: message.author.avatarURL() ?? undefined }) .setTimestamp() .setTitle('Shell Command') - .addField('📥 Input', await util.codeblock(input, 1024, 'sh', true)) - .addField('Running', util.emojis.loading); + .addField({ name: '📥 Input', value: await util.codeblock(input, 1024, 'sh', true) }) + .addField({ name: 'Running', value: util.emojis.loading }); await message.util.reply({ embeds: [embed] }); @@ -72,15 +72,15 @@ export default class ShCommand extends BushCommand { .setColor(util.colors.success) .spliceFields(1, 1); - if (stdout) embed.addField('📤 stdout', await util.codeblock(stdout, 1024, 'json', true)); - if (stderr) embed.addField('📤 stderr', await util.codeblock(stderr, 1024, 'json', true)); + if (stdout) embed.addField({ name: '📤 stdout', value: await util.codeblock(stdout, 1024, 'json', true) }); + if (stderr) embed.addField({ name: '📤 stderr', value: await util.codeblock(stderr, 1024, 'json', true) }); } catch (e) { embed .setTitle(`${util.emojis.errorFull} An error occurred while executing.`) .setColor(util.colors.error) .spliceFields(1, 1); - embed.addField('📤 Output', await util.codeblock(e?.stack, 1024, 'js', true)); + embed.addField({ name: '📤 Output', value: await util.codeblock(e?.stack, 1024, 'js', true) }); } await message.util.edit({ embeds: [embed] }); } diff --git a/src/commands/dev/superUser.ts b/src/commands/dev/superUser.ts index f937ad4..9cdac4a 100644 --- a/src/commands/dev/superUser.ts +++ b/src/commands/dev/superUser.ts @@ -1,5 +1,6 @@ import { BushCommand, type ArgType, type BushMessage } from '#lib'; -import { type ArgumentOptions, type Flag } from 'discord-akairo'; +import { ArgumentGeneratorReturn } from 'discord-akairo'; +import { ArgumentTypeCasterReturn } from 'discord-akairo/dist/src/struct/commands/arguments/Argument'; export default class SuperUserCommand extends BushCommand { public constructor() { @@ -30,8 +31,8 @@ export default class SuperUserCommand extends BushCommand { }); } - override *args(): IterableIterator<ArgumentOptions | Flag> { - const action = yield { + override *args(): ArgumentGeneratorReturn { + const action: 'add' | 'remove' = yield { id: 'action', type: ['add', 'remove'], prompt: { @@ -40,7 +41,8 @@ export default class SuperUserCommand extends BushCommand { optional: false } }; - const user = yield { + + const user: ArgumentTypeCasterReturn<'user'> = yield { id: 'user', type: 'user', match: 'restContent', @@ -50,6 +52,7 @@ export default class SuperUserCommand extends BushCommand { optional: false } }; + return { action, user }; } diff --git a/src/commands/dev/test.ts b/src/commands/dev/test.ts index 63c1112..b53b2d8 100644 --- a/src/commands/dev/test.ts +++ b/src/commands/dev/test.ts @@ -4,7 +4,7 @@ import { ActionRowComponent, ButtonComponent, ButtonStyle, - MessageEmbed, + Embed, type ApplicationCommand, type Collection } from 'discord.js'; @@ -60,8 +60,8 @@ export default class TestCommand extends BushCommand { ); return await message.util.reply({ content: 'buttons', components: [ButtonRow] }); } else if (['embed', 'button embed'].includes(args?.feature?.toLowerCase())) { - const embed = new MessageEmbed() - .addField('Field Name', 'Field Content') + const embed = new Embed() + .addField({ name: 'Field Name', value: 'Field Content' }) .setAuthor({ name: 'Author', iconURL: 'https://www.w3schools.com/w3css/img_snowtops.jpg', url: 'https://google.com/' }) .setColor(message.member?.displayColor ?? util.colors.default) .setDescription('Description') @@ -93,7 +93,7 @@ export default class TestCommand extends BushCommand { } else if (['paginate'].includes(args?.feature?.toLowerCase())) { const embeds = []; for (let i = 1; i <= 5; i++) { - embeds.push(new MessageEmbed().setDescription(i.toString())); + embeds.push(new Embed().setDescription(i.toString())); } return await ButtonPaginator.send(message, embeds); } else if (['lots of embeds'].includes(args?.feature?.toLowerCase())) { diff --git a/src/commands/info/avatar.ts b/src/commands/info/avatar.ts index 58d8bca..1d1a27b 100644 --- a/src/commands/info/avatar.ts +++ b/src/commands/info/avatar.ts @@ -1,5 +1,5 @@ import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; -import { ApplicationCommandOptionType, GuildMember, MessageEmbed, Permissions } from 'discord.js'; +import { ApplicationCommandOptionType, Embed, GuildMember, Permissions } from 'discord.js'; export default class AvatarCommand extends BushCommand { constructor() { @@ -36,7 +36,7 @@ export default class AvatarCommand extends BushCommand { const guildAvatar = member?.avatarURL(params); - const embed = new MessageEmbed().setTimestamp().setColor(util.colors.default).setTitle(`${user.tag}'s Avatar`); + const embed = new Embed().setTimestamp().setColor(util.colors.default).setTitle(`${user.tag}'s Avatar`); guildAvatar ? embed.setImage(guildAvatar).setThumbnail(user.avatarURL(params) ?? defaultAvatar) : embed.setImage(user.avatarURL(params) ?? defaultAvatar); diff --git a/src/commands/info/botInfo.ts b/src/commands/info/botInfo.ts index 3aea3cd..d899a95 100644 --- a/src/commands/info/botInfo.ts +++ b/src/commands/info/botInfo.ts @@ -1,6 +1,6 @@ import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib'; import assert from 'assert'; -import { MessageEmbed, Permissions, version as discordJSVersion } from 'discord.js'; +import { Embed, Permissions, version as discordJSVersion } from 'discord.js'; import * as os from 'os'; const { default: prettyBytes } = await import('pretty-bytes'); assert(prettyBytes); @@ -39,32 +39,36 @@ export default class BotInfoCommand extends BushCommand { const currentCommit = (await util.shell('git rev-parse HEAD')).stdout.replace('\n', ''); let repoUrl = (await util.shell('git remote get-url origin')).stdout.replace('\n', ''); if (repoUrl.includes('.git')) repoUrl = repoUrl.substring(0, repoUrl.length - 4); - const embed = new MessageEmbed() + const embed = new Embed() .setTitle('Bot Info:') - .addField('**Uptime**', util.humanizeDuration(client.uptime!, 2), true) - .addField( - '**Memory Usage**', - `System: ${prettyBytes(os.totalmem() - os.freemem(), { binary: true })}/${prettyBytes(os.totalmem(), { + .addField({ name: '**Uptime**', value: util.humanizeDuration(client.uptime!, 2), inline: true }) + .addField({ + name: '**Memory Usage**', + value: `System: ${prettyBytes(os.totalmem() - os.freemem(), { binary: true })}/${prettyBytes(os.totalmem(), { binary: true })}\nHeap: ${prettyBytes(process.memoryUsage().heapUsed, { binary: true })}/${prettyBytes( process.memoryUsage().heapTotal, { binary: true } )}`, - true - ) - .addField('**CPU Usage**', `${client.stats.cpu}%`, true) - .addField('**Platform**', Platform[process.platform], true) - .addField('**Commands Used**', `${client.stats.commandsUsed.toLocaleString()}`, true) - .addField('**Servers**', client.guilds.cache.size.toLocaleString(), true) - .addField('**Users**', client.users.cache.size.toLocaleString(), true) - .addField('**Discord.js Version**', discordJSVersion, true) - .addField('**Node.js Version**', process.version.slice(1), true) - .addField('**Commands**', client.commandHandler.modules.size.toLocaleString(), true) - .addField('**Listeners**', client.listenerHandler.modules.size.toLocaleString(), true) - .addField('**Inhibitors**', client.inhibitorHandler.modules.size.toLocaleString(), true) - .addField('**Tasks**', client.taskHandler.modules.size.toLocaleString(), true) - .addField('**Current Commit**', `[${currentCommit.substring(0, 7)}](${repoUrl}/commit/${currentCommit})`, true) - .addField('**Developers**', developers, true) + inline: true + }) + .addField({ name: '**CPU Usage**', value: `${client.stats.cpu}%`, inline: true }) + .addField({ name: '**Platform**', value: Platform[process.platform], inline: true }) + .addField({ name: '**Commands Used**', value: `${client.stats.commandsUsed.toLocaleString()}`, inline: true }) + .addField({ name: '**Servers**', value: client.guilds.cache.size.toLocaleString(), inline: true }) + .addField({ name: '**Users**', value: client.users.cache.size.toLocaleString(), inline: true }) + .addField({ name: '**Discord.js Version**', value: discordJSVersion, inline: true }) + .addField({ name: '**Node.js Version**', value: process.version.slice(1), inline: true }) + .addField({ name: '**Commands**', value: client.commandHandler.modules.size.toLocaleString(), inline: true }) + .addField({ name: '**Listeners**', value: client.listenerHandler.modules.size.toLocaleString(), inline: true }) + .addField({ name: '**Inhibitors**', value: client.inhibitorHandler.modules.size.toLocaleString(), inline: true }) + .addField({ name: '**Tasks**', value: client.taskHandler.modules.size.toLocaleString(), inline: true }) + .addField({ + name: '**Current Commit**', + value: `[${currentCommit.substring(0, 7)}](${repoUrl}/commit/${currentCommit})`, + inline: true + }) + .addField({ name: '**Developers**', value: developers, inline: true }) .setTimestamp() .setColor(util.colors.default); await message.util.reply({ embeds: [embed] }); diff --git a/src/commands/info/color.ts b/src/commands/info/color.ts index d385c53..0e1be81 100644 --- a/src/commands/info/color.ts +++ b/src/commands/info/color.ts @@ -9,7 +9,7 @@ import { type BushSlashMessage } from '#lib'; import assert from 'assert'; -import { ApplicationCommandOptionType, MessageEmbed, Permissions, Role } from 'discord.js'; +import { ApplicationCommandOptionType, Embed, Permissions, Role } from 'discord.js'; import tinycolor from 'tinycolor2'; assert(tinycolor); @@ -74,12 +74,12 @@ export default class ColorCommand extends BushCommand { }); } - const embed = new MessageEmbed() - .addField('» Hexadecimal', color.toHexString()) - .addField('» Decimal', `${parseInt(color.toHex(), 16)}`) - .addField('» HSL', this.removePrefixAndParenthesis(color.toHslString())) - .addField('» RGB', this.removePrefixAndParenthesis(color.toRgbString())) - .setColor(color.toHex() as `#${string}`); + const embed = new Embed() + .addField({ name: '» Hexadecimal', value: color.toHexString() }) + .addField({ name: '» Decimal', value: `${parseInt(color.toHex(), 16)}` }) + .addField({ name: '» HSL', value: this.removePrefixAndParenthesis(color.toHslString()) }) + .addField({ name: '» RGB', value: this.removePrefixAndParenthesis(color.toRgbString()) }) + .setColor(parseInt(color.toHex(), 16)); return await message.util.reply({ embeds: [embed] }); } diff --git a/src/commands/info/guildInfo.ts b/src/commands/info/guildInfo.ts index afc5111..03f6441 100644 --- a/src/commands/info/guildInfo.ts +++ b/src/commands/info/guildInfo.ts @@ -3,11 +3,11 @@ import assert from 'assert'; import { GuildDefaultMessageNotifications, GuildExplicitContentFilter } from 'discord-api-types'; import { ApplicationCommandOptionType, + Embed, Guild, GuildMFALevel, GuildPremiumTier, GuildVerificationLevel, - MessageEmbed, Permissions, type BaseGuildVoiceChannel, type GuildPreview, @@ -74,7 +74,7 @@ export default class GuildInfoCommand extends BushCommand { if (verifiedGuilds.includes(guild.id as typeof verifiedGuilds[number])) emojis.push(otherEmojis.BushVerified); if (!isPreview && guild instanceof Guild) { - if (guild.premiumTier !== 'None') emojis.push(otherEmojis[`Boost${guild.premiumTier}`]); + if (guild.premiumTier !== GuildPremiumTier.None) emojis.push(otherEmojis[`BoostTier${guild.premiumTier}`]); await guild.fetch(); const channels = guild.channels.cache; @@ -124,14 +124,14 @@ export default class GuildInfoCommand extends BushCommand { `**Channels:** ${guild.channels.cache.size.toLocaleString()} / 500 (${channelTypes.join(', ')})`, // subtract 1 for @everyone role `**Roles:** ${((guild.roles.cache.size ?? 0) - 1).toLocaleString()} / 250`, - `**Emojis:** ${guild.emojis.cache.size?.toLocaleString() ?? 0} / ${(<any>EmojiTierMap)[guild.premiumTier]}`, - `**Stickers:** ${guild.stickers.cache.size?.toLocaleString() ?? 0} / ${(<any>StickerTierMap)[guild.premiumTier]}` + `**Emojis:** ${guild.emojis.cache.size?.toLocaleString() ?? 0} / ${EmojiTierMap[guild.premiumTier]}`, + `**Stickers:** ${guild.stickers.cache.size?.toLocaleString() ?? 0} / ${StickerTierMap[guild.premiumTier]}` ); guildSecurity.push( - `**Verification Level**: ${(<any>BushGuildVerificationLevel)[guild.verificationLevel]}`, - `**Explicit Content Filter:** ${(<any>BushGuildExplicitContentFilter)[guild.explicitContentFilter]}`, - `**Default Message Notifications:** ${(<any>BushGuildDefaultMessageNotifications)[guild.defaultMessageNotifications]}`, + `**Verification Level**: ${BushGuildVerificationLevel[guild.verificationLevel]}`, + `**Explicit Content Filter:** ${BushGuildExplicitContentFilter[guild.explicitContentFilter]}`, + `**Default Message Notifications:** ${BushGuildDefaultMessageNotifications[guild.defaultMessageNotifications]}`, `**2FA Required**: ${guild.mfaLevel === GuildMFALevel.Elevated ? 'True' : 'False'}` ); } else { @@ -168,17 +168,17 @@ export default class GuildInfoCommand extends BushCommand { emojis.push(`\n\n${guild.description}`); } - const guildInfoEmbed = new MessageEmbed() + const guildInfoEmbed = new Embed() .setTitle(guild.name) .setColor(util.colors.default) - .addField('» About', guildAbout.join('\n')); - if (guildStats.length) guildInfoEmbed.addField('» Stats', guildStats.join('\n')); + .addField({ name: '» About', value: guildAbout.join('\n') }); + if (guildStats.length) guildInfoEmbed.addField({ name: '» Stats', value: guildStats.join('\n') }); const guildIcon = guild.iconURL({ size: 2048, format: 'png' }); if (guildIcon) { guildInfoEmbed.setThumbnail(guildIcon); } if (!isPreview) { - guildInfoEmbed.addField('» Security', guildSecurity.join('\n')); + guildInfoEmbed.addField({ name: '» Security', value: guildSecurity.join('\n') }); } if (emojis) { guildInfoEmbed.setDescription(`\u200B${/*zero width space*/ emojis.join(' ')}`); diff --git a/src/commands/info/help.ts b/src/commands/info/help.ts index c77b5d2..67f99d1 100644 --- a/src/commands/info/help.ts +++ b/src/commands/info/help.ts @@ -6,7 +6,7 @@ import { AutocompleteInteraction, ButtonComponent, ButtonStyle, - MessageEmbed, + Embed, Permissions } from 'discord.js'; import Fuse from 'fuse.js'; @@ -68,7 +68,7 @@ export default class HelpCommand extends BushCommand { : null; if (!isOwner) args.showHidden = false; if (!command || command.pseudo) { - const embed = new MessageEmbed().setColor(util.colors.default).setTimestamp(); + const embed = new Embed().setColor(util.colors.default).setTimestamp(); embed.setFooter({ text: `For more information about a command use ${prefix}help <command>` }); for (const [, category] of this.handler.categories) { const categoryFilter = category.filter((command) => { @@ -84,23 +84,29 @@ export default class HelpCommand extends BushCommand { .replace(/'(S)/g, (letter) => letter.toLowerCase()); const categoryCommands = categoryFilter.filter((cmd) => cmd.aliases.length > 0).map((cmd) => `\`${cmd.aliases[0]}\``); if (categoryCommands.length > 0) { - embed.addField(`${categoryNice}`, `${categoryCommands.join(' ')}`); + embed.addField({ name: `${categoryNice}`, value: `${categoryCommands.join(' ')}` }); } } return await message.util.reply({ embeds: [embed], components: row.components.length ? [row] : undefined }); } - const embed = new MessageEmbed() + const embed = new Embed() .setColor(util.colors.default) .setTitle(`${command.id} Command`) .setDescription(`${command.description ?? '*This command does not have a description.*'}`); if (command.usage?.length) { - embed.addField(`» Usage${command.usage.length > 1 ? 's' : ''}`, command.usage.map((u) => `\`${u}\``).join('\n')); + embed.addField({ + name: `» Usage${command.usage.length > 1 ? 's' : ''}`, + value: command.usage.map((u) => `\`${u}\``).join('\n') + }); } if (command.examples?.length) { - embed.addField(`» Example${command.examples.length > 1 ? 's' : ''}`, command.examples.map((u) => `\`${u}\``).join('\n')); + embed.addField({ + name: `» Example${command.examples.length > 1 ? 's' : ''}`, + value: command.examples.map((u) => `\`${u}\``).join('\n') + }); } - if (command.aliases?.length > 1) embed.addField('» Aliases', `\`${command.aliases.join('` `')}\``); + if (command.aliases?.length > 1) embed.addField({ name: '» Aliases', value: `\`${command.aliases.join('` `')}\`` }); if ( command.ownerOnly || command.superUserOnly || @@ -123,7 +129,7 @@ export default class HelpCommand extends BushCommand { .map((g) => util.format.inlineCode(client.guilds.cache.find((g1) => g1.id === g)?.name ?? 'Unknown')) .join(' ')}` ); - if (restrictions.length) embed.addField('» Restrictions', restrictions.join('\n')); + if (restrictions.length) embed.addField({ name: '» Restrictions', value: restrictions.join('\n') }); } const params = { embeds: [embed], components: row.components.length ? [row] : undefined }; diff --git a/src/commands/info/icon.ts b/src/commands/info/icon.ts index 9602d40..ed9ab0f 100644 --- a/src/commands/info/icon.ts +++ b/src/commands/info/icon.ts @@ -1,5 +1,5 @@ import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib'; -import { MessageEmbed, Permissions } from 'discord.js'; +import { Embed, Permissions } from 'discord.js'; export default class IconCommand extends BushCommand { constructor() { @@ -17,7 +17,7 @@ export default class IconCommand extends BushCommand { } override async exec(message: BushMessage | BushSlashMessage) { - const embed = new MessageEmbed() + const embed = new Embed() .setTimestamp() .setColor(util.colors.default) .setImage( diff --git a/src/commands/info/ping.ts b/src/commands/info/ping.ts index 1a8f542..35e9748 100644 --- a/src/commands/info/ping.ts +++ b/src/commands/info/ping.ts @@ -1,5 +1,5 @@ import { BushCommand, type BushMessage, type BushSlashMessage } from '#lib'; -import { MessageEmbed, Permissions, type Message } from 'discord.js'; +import { Embed, Permissions, type Message } from 'discord.js'; export default class PingCommand extends BushCommand { public constructor() { @@ -20,10 +20,10 @@ export default class PingCommand extends BushCommand { const timestamp: number = message.editedTimestamp ? message.editedTimestamp : message.createdTimestamp; const botLatency = `${'```'}\n ${Math.round(sentMessage.createdTimestamp - timestamp)}ms ${'```'}`; const apiLatency = `${'```'}\n ${Math.round(message.client.ws.ping)}ms ${'```'}`; - const embed = new MessageEmbed() + const embed = new Embed() .setTitle('Pong! 🏓') - .addField('Bot Latency', botLatency, true) - .addField('API Latency', apiLatency, true) + .addField({ name: 'Bot Latency', value: botLatency, inline: true }) + .addField({ name: 'API Latency', value: apiLatency, inline: true }) .setFooter({ text: message.author.username, iconURL: message.author.displayAvatarURL() }) .setColor(util.colors.default) .setTimestamp(); @@ -39,10 +39,10 @@ export default class PingCommand extends BushCommand { const timestamp2 = await message.interaction.fetchReply().then((m) => (m as Message).createdTimestamp); const botLatency = `${'```'}\n ${Math.round(timestamp2 - timestamp1)}ms ${'```'}`; const apiLatency = `${'```'}\n ${Math.round(client.ws.ping)}ms ${'```'}`; - const embed = new MessageEmbed() + const embed = new Embed() .setTitle('Pong! 🏓') - .addField('Bot Latency', botLatency, true) - .addField('API Latency', apiLatency, true) + .addField({ name: 'Bot Latency', value: botLatency, inline: true }) + .addField({ name: 'API Latency', value: apiLatency, inline: true }) .setFooter({ text: message.interaction.user.username, iconURL: message.interaction.user.displayAvatarURL() diff --git a/src/commands/info/pronouns.ts b/src/commands/info/pronouns.ts index e390865..9ba2a2a 100644 --- a/src/commands/info/pronouns.ts +++ b/src/commands/info/pronouns.ts @@ -1,5 +1,5 @@ import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; -import { ApplicationCommandOptionType, MessageEmbed, Permissions } from 'discord.js'; +import { ApplicationCommandOptionType, Embed, Permissions } from 'discord.js'; export default class PronounsCommand extends BushCommand { public constructor() { @@ -42,7 +42,7 @@ export default class PronounsCommand extends BushCommand { } else { return await message.util.reply({ embeds: [ - new MessageEmbed({ + new Embed({ title: `${author ? 'Your' : `${util.discord.escapeMarkdown(user.tag)}'s`} pronouns:`, description: pronouns, footer: { diff --git a/src/commands/info/snowflake.ts b/src/commands/info/snowflake.ts index d9ad108..feaa724 100644 --- a/src/commands/info/snowflake.ts +++ b/src/commands/info/snowflake.ts @@ -1,7 +1,7 @@ import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; import { ApplicationCommandOptionType, - MessageEmbed, + Embed, Permissions, SnowflakeUtil, type DeconstructedSnowflake, @@ -37,7 +37,7 @@ export default class SnowflakeCommand extends BushCommand { public override async exec(message: BushMessage | BushSlashMessage, args: { snowflake: ArgType<'snowflake'> }) { const snowflake = `${args.snowflake}` as Snowflake; - const snowflakeEmbed = new MessageEmbed().setTitle('Unknown :snowflake:').setColor(util.colors.default); + const snowflakeEmbed = new Embed().setTitle('Unknown :snowflake:').setColor(util.colors.default); // Channel if (client.channels.cache.has(snowflake)) { @@ -61,7 +61,7 @@ export default class SnowflakeCommand extends BushCommand { ); snowflakeEmbed.setTitle(`:snowflake: ${util.discord.escapeMarkdown(channel.name)} \`[Channel]\``); } - snowflakeEmbed.addField('» Channel Info', channelInfo.join('\n')); + snowflakeEmbed.addField({ name: '» Channel Info', value: channelInfo.join('\n') }); } // Guild @@ -75,7 +75,7 @@ export default class SnowflakeCommand extends BushCommand { `**Members:** ${guild.memberCount?.toLocaleString()}` ]; if (guild.icon) snowflakeEmbed.setThumbnail(guild.iconURL({ size: 2048 })!); - snowflakeEmbed.addField('» Server Info', guildInfo.join('\n')); + snowflakeEmbed.addField({ name: '» Server Info', value: guildInfo.join('\n') }); snowflakeEmbed.setTitle(`:snowflake: ${util.discord.escapeMarkdown(guild.name)} \`[Server]\``); } @@ -85,7 +85,7 @@ export default class SnowflakeCommand extends BushCommand { const user: User = (client.users.cache.get(snowflake) ?? fetchedUser)!; const userInfo = [`**Name:** <@${user.id}> (${util.discord.escapeMarkdown(user.tag)})`]; if (user.avatar) snowflakeEmbed.setThumbnail(user.avatarURL({ size: 2048 })!); - snowflakeEmbed.addField('» User Info', userInfo.join('\n')); + snowflakeEmbed.addField({ name: '» User Info', value: userInfo.join('\n') }); snowflakeEmbed.setTitle(`:snowflake: ${util.discord.escapeMarkdown(user.tag)} \`[User]\``); } @@ -97,7 +97,7 @@ export default class SnowflakeCommand extends BushCommand { `**Animated:** ${emoji.animated}` ]; if (emoji.url) snowflakeEmbed.setThumbnail(emoji.url); - snowflakeEmbed.addField('» Emoji Info', emojiInfo.join('\n')); + snowflakeEmbed.addField({ name: '» Emoji Info', value: emojiInfo.join('\n') }); snowflakeEmbed.setTitle(`:snowflake: ${util.discord.escapeMarkdown(emoji.name ?? '¯\\_(ツ)_/¯')} \`[Emoji]\``); } @@ -113,7 +113,7 @@ export default class SnowflakeCommand extends BushCommand { `**Hex Color:** ${role.hexColor}` ]; if (role.color) snowflakeEmbed.setColor(role.color); - snowflakeEmbed.addField('» Role Info', roleInfo.join('\n')); + snowflakeEmbed.addField({ name: '» Role Info', value: roleInfo.join('\n') }); snowflakeEmbed.setTitle(`:snowflake: ${util.discord.escapeMarkdown(role.name)} \`[Role]\``); } @@ -126,7 +126,7 @@ export default class SnowflakeCommand extends BushCommand { `**Process ID:** ${deconstructedSnowflake.processId}`, `**Increment:** ${deconstructedSnowflake.increment}` ]; - snowflakeEmbed.addField('» Snowflake Info', snowflakeInfo.join('\n')); + snowflakeEmbed.addField({ name: '» Snowflake Info', value: snowflakeInfo.join('\n') }); return await message.util.reply({ embeds: [snowflakeEmbed] }); } diff --git a/src/commands/info/userInfo.ts b/src/commands/info/userInfo.ts index 38c9ea6..b8d97a8 100644 --- a/src/commands/info/userInfo.ts +++ b/src/commands/info/userInfo.ts @@ -7,7 +7,7 @@ import { type BushSlashMessage, type BushUser } from '#lib'; -import { ActivityType, ApplicationCommandOptionType, MessageEmbed, Permissions, UserFlags } from 'discord.js'; +import { ActivityType, ApplicationCommandOptionType, Embed, Permissions, UserFlags } from 'discord.js'; // TODO: Add bot information export default class UserInfoCommand extends BushCommand { @@ -56,7 +56,7 @@ export default class UserInfoCommand extends BushCommand { const emojis = []; const superUsers = util.getShared('superUsers'); - const userEmbed: MessageEmbed = new MessageEmbed() + const userEmbed: Embed = new Embed() .setTitle(util.discord.escapeMarkdown(user.tag)) .setThumbnail(user.displayAvatarURL({ size: 2048, format: 'png' })) .setTimestamp(); @@ -101,7 +101,7 @@ export default class UserInfoCommand extends BushCommand { const pronouns = await Promise.race([util.getPronounsOf(user), util.sleep(2)]); if (pronouns && typeof pronouns === 'string') generalInfo.push(`**Pronouns:** ${pronouns}`); - userEmbed.addField('» General Info', generalInfo.join('\n')); + userEmbed.addField({ name: '» General Info', value: generalInfo.join('\n') }); // Server User Info const serverUserInfo = []; @@ -118,7 +118,9 @@ export default class UserInfoCommand extends BushCommand { serverUserInfo.push(`**General Deletions:** ⅓`); if (member?.nickname) serverUserInfo.push(`**Nickname:** ${util.discord.escapeMarkdown(member?.nickname)}`); if (serverUserInfo.length) - userEmbed.addField('» Server Info', serverUserInfo.join('\n')).setColor(member?.displayColor ?? util.colors.default); + userEmbed + .addField({ name: '» Server Info', value: serverUserInfo.join('\n') }) + .setColor(member?.displayColor ?? util.colors.default); // User Presence Info if (member?.presence?.status || member?.presence?.clientStatus || member?.presence?.activities) { @@ -143,7 +145,7 @@ export default class UserInfoCommand extends BushCommand { presenceInfo.push(`**Activit${activitiesNames.length - 1 ? 'ies' : 'y'}:** ${util.oxford(activitiesNames, 'and', '')}`); if (customStatus && customStatus.length) presenceInfo.push(`**Custom Status:** ${util.discord.escapeMarkdown(customStatus)}`); - userEmbed.addField('» Presence', presenceInfo.join('\n')); + userEmbed.addField({ name: '» Presence', value: presenceInfo.join('\n') }); enum statusEmojis { online = '787550449435803658', @@ -164,7 +166,7 @@ export default class UserInfoCommand extends BushCommand { .filter((role) => role.name !== '@everyone') .sort((role1, role2) => role2.position - role1.position) .map((role) => `${role}`); - userEmbed.addField(`» Role${roles.length - 1 ? 's' : ''} [${roles.length}]`, roles.join(', ')); + userEmbed.addField({ name: `» Role${roles.length - 1 ? 's' : ''} [${roles.length}]`, value: roles.join(', ') }); } // Important Perms @@ -179,7 +181,7 @@ export default class UserInfoCommand extends BushCommand { }); } - if (perms.length) userEmbed.addField('» Important Perms', perms.join(' ')); + if (perms.length) userEmbed.addField({ name: '» Important Perms', value: perms.join(' ') }); if (emojis) userEmbed.setDescription(`\u200B${emojis.join(' ')}`); // zero width space return userEmbed; } diff --git a/src/commands/leveling/leaderboard.ts b/src/commands/leveling/leaderboard.ts index 2e0ce5d..3a00036 100644 --- a/src/commands/leveling/leaderboard.ts +++ b/src/commands/leveling/leaderboard.ts @@ -1,5 +1,5 @@ import { BushCommand, ButtonPaginator, Level, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; -import { ApplicationCommandOptionType, MessageEmbed, Permissions } from 'discord.js'; +import { ApplicationCommandOptionType, Embed, Permissions } from 'discord.js'; export default class LeaderboardCommand extends BushCommand { public constructor() { @@ -43,9 +43,7 @@ export default class LeaderboardCommand extends BushCommand { (val, index) => `\`${index + 1}\` <@${val.user}> - Level ${val.level} (${val.xp.toLocaleString()} xp)` ); const chunked = util.chunk(mappedRanks, 25); - const embeds = chunked.map((c) => - new MessageEmbed().setTitle(`${message.guild!.name}'s Leaderboard`).setDescription(c.join('\n')) - ); + const embeds = chunked.map((c) => new Embed().setTitle(`${message.guild!.name}'s Leaderboard`).setDescription(c.join('\n'))); return await ButtonPaginator.send(message, embeds, undefined, true, args?.page ?? undefined); } } diff --git a/src/commands/moderation/evidence.ts b/src/commands/moderation/evidence.ts index 155d804..84138f6 100644 --- a/src/commands/moderation/evidence.ts +++ b/src/commands/moderation/evidence.ts @@ -1,5 +1,6 @@ import { BushCommand, ModLog, type BushMessage, type BushSlashMessage } from '#lib'; -import { type ArgumentOptions, type Flag } from 'discord-akairo'; +import { ArgumentGeneratorReturn } from 'discord-akairo'; +import { ArgumentTypeCasterReturn } from 'discord-akairo/dist/src/struct/commands/arguments/Argument'; import { ApplicationCommandOptionType, Permissions } from 'discord.js'; export default class EvidenceCommand extends BushCommand { @@ -35,8 +36,8 @@ export default class EvidenceCommand extends BushCommand { }); } - override *args(message: BushMessage): IterableIterator<ArgumentOptions | Flag> { - const case_id = yield { + override *args(message: BushMessage): ArgumentGeneratorReturn { + const case_id: ArgumentTypeCasterReturn<'string'> = yield { id: 'case_id', type: 'string', prompt: { @@ -46,7 +47,7 @@ export default class EvidenceCommand extends BushCommand { } }; - const evidence = yield { + const evidence: ArgumentTypeCasterReturn<'string'> = yield { id: 'evidence', type: 'string', match: 'restContent', diff --git a/src/commands/moderation/lockdown.ts b/src/commands/moderation/lockdown.ts index 350ce26..ea7c08b 100644 --- a/src/commands/moderation/lockdown.ts +++ b/src/commands/moderation/lockdown.ts @@ -11,7 +11,7 @@ import { type OptionalArgType } from '#lib'; import assert from 'assert'; -import { ApplicationCommandOptionType, Collection, Permissions } from 'discord.js'; +import { ApplicationCommandOptionType, ChannelType, Collection, Permissions } from 'discord.js'; export default class LockdownCommand extends BushCommand { public constructor() { @@ -28,7 +28,13 @@ export default class LockdownCommand extends BushCommand { type: util.arg.union('textChannel', 'newsChannel', 'threadChannel'), prompt: 'What channel would you like to lockdown?', slashType: ApplicationCommandOptionType.Channel, - channelTypes: ['GuildText', 'GuildNews', 'GuildNewsThread', 'GuildPublicThread', 'GuildPrivateThread'], + channelTypes: [ + ChannelType.GuildText, + ChannelType.GuildNews, + ChannelType.GuildNewsThread, + ChannelType.GuildPublicThread, + ChannelType.GuildPrivateThread + ], optional: true }, { diff --git a/src/commands/moderation/modlog.ts b/src/commands/moderation/modlog.ts index e7b3576..d6ecc37 100644 --- a/src/commands/moderation/modlog.ts +++ b/src/commands/moderation/modlog.ts @@ -1,5 +1,5 @@ import { BushCommand, ButtonPaginator, ModLog, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; -import { ApplicationCommandOptionType, MessageEmbed, Permissions, User } from 'discord.js'; +import { ApplicationCommandOptionType, Embed, Permissions, User } from 'discord.js'; export default class ModlogCommand extends BushCommand { public constructor() { @@ -57,7 +57,7 @@ export default class ModlogCommand extends BushCommand { const chunked: string[][] = util.chunk(niceLogs, 4); const embedPages = chunked.map( (chunk) => - new MessageEmbed({ + new Embed({ title: `${foundUser.tag}'s Mod Logs`, description: chunk.join('\n━━━━━━━━━━━━━━━\n'), color: util.colors.default diff --git a/src/commands/moderation/slowmode.ts b/src/commands/moderation/slowmode.ts index a724006..96c3881 100644 --- a/src/commands/moderation/slowmode.ts +++ b/src/commands/moderation/slowmode.ts @@ -29,7 +29,7 @@ export default class SlowmodeCommand extends BushCommand { retry: '{error} Choose a valid channel.', optional: true, slashType: ApplicationCommandOptionType.Channel, - channelTypes: ['GuildText', 'GuildPrivateThread', 'GuildPublicThread'] + channelTypes: [ChannelType.GuildText, ChannelType.GuildPrivateThread, ChannelType.GuildPublicThread] } ], slash: true, diff --git a/src/commands/moderation/unlockdown.ts b/src/commands/moderation/unlockdown.ts index d7ba5ee..ea36b67 100644 --- a/src/commands/moderation/unlockdown.ts +++ b/src/commands/moderation/unlockdown.ts @@ -1,6 +1,6 @@ import { LockdownCommand } from '#commands'; import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage, type OptionalArgType } from '#lib'; -import { ApplicationCommandOptionType, Permissions } from 'discord.js'; +import { ApplicationCommandOptionType, ChannelType, Permissions } from 'discord.js'; export default class UnlockdownCommand extends BushCommand { public constructor() { @@ -17,7 +17,13 @@ export default class UnlockdownCommand extends BushCommand { type: util.arg.union('textChannel', 'newsChannel', 'threadChannel'), prompt: 'What channel would you like to unlockdown?', slashType: ApplicationCommandOptionType.Channel, - channelTypes: ['GuildText', 'GuildNews', 'GuildNewsThread', 'GuildPublicThread', 'GuildPrivateThread'], + channelTypes: [ + ChannelType.GuildText, + ChannelType.GuildNews, + ChannelType.GuildNewsThread, + ChannelType.GuildPublicThread, + ChannelType.GuildPrivateThread + ], optional: true }, { diff --git a/src/commands/moulberry-bush/capePermissions.ts b/src/commands/moulberry-bush/capePermissions.ts index 19c1381..7f261d5 100644 --- a/src/commands/moulberry-bush/capePermissions.ts +++ b/src/commands/moulberry-bush/capePermissions.ts @@ -1,5 +1,5 @@ import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; -import { ApplicationCommandOptionType, MessageEmbed, Permissions } from 'discord.js'; +import { ApplicationCommandOptionType, Embed, Permissions } from 'discord.js'; import got from 'got'; export default class CapePermissionsCommand extends BushCommand { @@ -66,7 +66,7 @@ export default class CapePermissionsCommand extends BushCommand { if (index == null) return await message.util.reply(`${util.emojis.error} \`${args.ign}\` does not appear to have any capes.`); const userPerm: string[] = capePerms.perms[index].perms; - const embed = new MessageEmbed() + const embed = new Embed() .setTitle(`${args.ign}'s Capes`) .setDescription(userPerm.join('\n')) .setColor(util.colors.default); diff --git a/src/commands/moulberry-bush/capes.ts b/src/commands/moulberry-bush/capes.ts index 3a956fc..7965713 100644 --- a/src/commands/moulberry-bush/capes.ts +++ b/src/commands/moulberry-bush/capes.ts @@ -1,6 +1,7 @@ import { BushCommand, ButtonPaginator, DeleteButton, type BushMessage, type OptionalArgType } from '#lib'; import assert from 'assert'; -import { ApplicationCommandOptionType, AutocompleteInteraction, Permissions, type MessageEmbedOptions } from 'discord.js'; +import { APIEmbed } from 'discord-api-types'; +import { ApplicationCommandOptionType, AutocompleteInteraction, Permissions } from 'discord.js'; import Fuse from 'fuse.js'; import got from 'got'; @@ -87,16 +88,16 @@ export default class CapesCommand extends BushCommand { await message.util.reply(`${util.emojis.error} Cannot find a cape called \`${args.cape}\`.`); } } else { - const embeds: MessageEmbedOptions[] = sortedCapes.map(this.makeEmbed); + const embeds: APIEmbed[] = sortedCapes.map(this.makeEmbed); await ButtonPaginator.send(message, embeds, null); } } - private makeEmbed(cape: { name: string; url: string; index: number; purchasable?: boolean | undefined }): MessageEmbedOptions { + private makeEmbed(cape: { name: string; url: string; index: number; purchasable?: boolean | undefined }): APIEmbed { return { title: `${cape.name} cape`, color: util.colors.default, - timestamp: Date.now(), + timestamp: new Date().toISOString(), image: { url: cape.url }, description: cape.purchasable ? ':money_with_wings: **purchasable** :money_with_wings:' : undefined }; diff --git a/src/commands/moulberry-bush/moulHammer.ts b/src/commands/moulberry-bush/moulHammer.ts index 4cf3f35..6aa5ca3 100644 --- a/src/commands/moulberry-bush/moulHammer.ts +++ b/src/commands/moulberry-bush/moulHammer.ts @@ -1,5 +1,5 @@ import { BushCommand, type ArgType, type BushMessage, type BushSlashMessage } from '#lib'; -import { ApplicationCommandOptionType, MessageEmbed, Permissions } from 'discord.js'; +import { ApplicationCommandOptionType, Embed, Permissions } from 'discord.js'; export default class MoulHammerCommand extends BushCommand { public constructor() { @@ -29,7 +29,7 @@ export default class MoulHammerCommand extends BushCommand { public override async exec(message: BushMessage | BushSlashMessage, { user }: { user: ArgType<'user'> }) { await message.delete(); - const embed = new MessageEmbed() + const embed = new Embed() .setTitle('L') .setDescription(`${user.username} got moul'ed <:wideberry1:756223352598691942><:wideberry2:756223336832303154>`) .setColor(util.colors.purple); diff --git a/src/commands/moulberry-bush/report.ts b/src/commands/moulberry-bush/report.ts index f2c10bc..a2a18ef 100644 --- a/src/commands/moulberry-bush/report.ts +++ b/src/commands/moulberry-bush/report.ts @@ -1,6 +1,6 @@ import { AllowedMentions, BushCommand, type ArgType, type BushMessage } from '#lib'; import assert from 'assert'; -import { ApplicationCommandOptionType, MessageEmbed, Permissions } from 'discord.js'; +import { ApplicationCommandOptionType, Embed, Permissions } from 'discord.js'; import moment from 'moment'; assert(moment); @@ -62,7 +62,7 @@ export default class ReportCommand extends BushCommand { ); //The formatting of the report is mostly copied from carl since it is pretty good when it actually works - const reportEmbed = new MessageEmbed() + const reportEmbed = new Embed() .setFooter({ text: `Reporter ID: ${message.author.id} Reported ID: ${member.user.id}` }) .setTimestamp() .setAuthor({ @@ -72,29 +72,29 @@ export default class ReportCommand extends BushCommand { .setTitle('New Report') .setColor(util.colors.red) .setDescription(evidence) - .addField( - 'Reporter', - `**Name:**${message.author.tag} <@${message.author.id}>\n**Joined:** ${moment( + .addField({ + name: 'Reporter', + value: `**Name:**${message.author.tag} <@${message.author.id}>\n**Joined:** ${moment( message.member!.joinedTimestamp ).fromNow()}\n**Created:** ${moment(message.author.createdTimestamp).fromNow()}\n**Sent From**: <#${ message.channel.id }> [Jump to context](${message.url})`, - true - ) - .addField( - 'Reported User', - `**Name:**${member.user.tag} <@${member.user.id}>\n**Joined:** ${moment( + inline: true + }) + .addField({ + name: 'Reported User', + value: `**Name:**${member.user.tag} <@${member.user.id}>\n**Joined:** ${moment( member.joinedTimestamp ).fromNow()}\n**Created:** ${moment(member.user.createdTimestamp).fromNow()}`, - true - ); + inline: true + }); if (message.attachments.size > 0) { const fileName = message.attachments.first()!.name!.toLowerCase(); if (fileName.endsWith('.png') || fileName.endsWith('.jpg') || fileName.endsWith('.gif') || fileName.endsWith('.webp')) { reportEmbed.setImage(message.attachments.first()!.url); } else { - reportEmbed.addField('Attachment', message.attachments.first()!.url); + reportEmbed.addField({ name: 'Attachment', value: message.attachments.first()!.url }); } } await reportChannel.send({ embeds: [reportEmbed] }).then(async (ReportMessage) => { diff --git a/src/commands/moulberry-bush/rule.ts b/src/commands/moulberry-bush/rule.ts index 1bfcfe7..dfb65f3 100644 --- a/src/commands/moulberry-bush/rule.ts +++ b/src/commands/moulberry-bush/rule.ts @@ -1,5 +1,5 @@ import { AllowedMentions, BushCommand, BushSlashMessage, type BushMessage, type OptionalArgType } from '#lib'; -import { ApplicationCommandOptionType, MessageEmbed, Permissions } from 'discord.js'; +import { ApplicationCommandOptionType, Embed, Permissions } from 'discord.js'; const rules = [ { @@ -95,8 +95,8 @@ export default class RuleCommand extends BushCommand { message: BushMessage | BushSlashMessage, { rule, user }: { rule: OptionalArgType<'integer'>; user: OptionalArgType<'user'> } ) { - const rulesEmbed = new MessageEmbed() - .setColor('#ef3929') + const rulesEmbed = new Embed() + .setColor(0xef3929) .setFooter({ text: `Triggered by ${message.author.tag}`, iconURL: message.author.avatarURL() ?? undefined @@ -108,10 +108,10 @@ export default class RuleCommand extends BushCommand { } if (rule) { if (rules[rule - 1]?.title && rules[rule - 1]?.description) - rulesEmbed.addField(rules[rule - 1].title, rules[rule - 1].description); + rulesEmbed.addField({ name: rules[rule - 1].title, value: rules[rule - 1].description }); } else { for (let i = 0; i < rules.length; i++) { - if (rules[i]?.title && rules[i]?.description) rulesEmbed.addField(rules[i].title, rules[i].description); + if (rules[i]?.title && rules[i]?.description) rulesEmbed.addField({ name: rules[i].title, value: rules[i].description }); } } await message.util.send({ diff --git a/src/commands/moulberry-bush/serverStatus.ts b/src/commands/moulberry-bush/serverStatus.ts index 28b38a5..435b99e 100644 --- a/src/commands/moulberry-bush/serverStatus.ts +++ b/src/commands/moulberry-bush/serverStatus.ts @@ -1,6 +1,6 @@ import { BushCommand, type BushMessage } from '#lib'; import assert from 'assert'; -import { MessageEmbed, Permissions } from 'discord.js'; +import { Embed, Permissions } from 'discord.js'; import got from 'got'; assert(got); @@ -20,7 +20,7 @@ export default class ServerStatusCommand extends BushCommand { } public override async exec(message: BushMessage) { - const msgEmbed: MessageEmbed = new MessageEmbed() + const msgEmbed: Embed = new Embed() .setTitle('Server status') .setDescription(`Checking server:\n${util.emojis.loading}`) .setColor(util.colors.default) @@ -38,7 +38,7 @@ export default class ServerStatusCommand extends BushCommand { await message.util.edit({ embeds: [ msgEmbed - .addField('Status', 'The server is online, all features related to prices will likely work.') + .addField({ name: 'Status', value: 'The server is online, all features related to prices will likely work.' }) .setColor(util.colors.success) ] }); @@ -46,10 +46,11 @@ export default class ServerStatusCommand extends BushCommand { await message.util.edit({ embeds: [ msgEmbed - .addField( - 'Status', - "It appears Moulberry's server is offline, this means that everything related to prices will likely not work." - ) + .addField({ + name: 'Status', + value: + "It appears Moulberry's server is offline, this means that everything related to prices will likely not work." + }) .setColor(util.colors.error) ] }); diff --git a/src/commands/utilities/activity.ts b/src/commands/utilities/activity.ts index 948f82a..5a56978 100644 --- a/src/commands/utilities/activity.ts +++ b/src/commands/utilities/activity.ts @@ -94,7 +94,7 @@ export default class ActivityCommand extends BushCommand { type: 'voiceChannel', prompt: 'What channel would you like to use?', slashType: ApplicationCommandOptionType.Channel, - channelTypes: ['GuildVoice'], + channelTypes: [ChannelType.GuildVoice], only: 'slash' }, { diff --git a/src/commands/utilities/calculator.ts b/src/commands/utilities/calculator.ts index df79cc2..7492fc5 100644 --- a/src/commands/utilities/calculator.ts +++ b/src/commands/utilities/calculator.ts @@ -1,6 +1,6 @@ import { AllowedMentions, BushCommand, type BushMessage, type BushSlashMessage } from '#lib'; import assert from 'assert'; -import { ApplicationCommandOptionType, MessageEmbed } from 'discord.js'; +import { ApplicationCommandOptionType, Embed } from 'discord.js'; import { evaluate } from 'mathjs'; assert(evaluate); @@ -31,18 +31,21 @@ export default class CalculatorCommand extends BushCommand { } public override async exec(message: BushMessage | BushSlashMessage, args: { expression: string }) { - const decodedEmbed = new MessageEmbed().addField('📥 Input', await util.inspectCleanRedactCodeblock(args.expression, 'mma')); + const decodedEmbed = new Embed().addField({ + name: '📥 Input', + value: await util.inspectCleanRedactCodeblock(args.expression, 'mma') + }); try { const calculated = /^(9\s*?\+\s*?10)|(10\s*?\+\s*?9)$/.test(args.expression) ? '21' : evaluate(args.expression); decodedEmbed .setTitle(`${util.emojis.successFull} Successfully Calculated Expression`) .setColor(util.colors.success) - .addField('📤 Output', await util.inspectCleanRedactCodeblock(calculated.toString(), 'mma')); + .addField({ name: '📤 Output', value: await util.inspectCleanRedactCodeblock(calculated.toString(), 'mma') }); } catch (error) { decodedEmbed .setTitle(`${util.emojis.errorFull} Unable to Calculate Expression`) .setColor(util.colors.error) - .addField(`📤 Error`, await util.inspectCleanRedactCodeblock(`${error.name}: ${error.message}`, 'js')); + .addField({ name: `📤 Error`, value: await util.inspectCleanRedactCodeblock(`${error.name}: ${error.message}`, 'js') }); } return await message.util.reply({ embeds: [decodedEmbed], allowedMentions: AllowedMentions.none() }); } diff --git a/src/commands/utilities/decode.ts b/src/commands/utilities/decode.ts index f5d8920..00420da 100644 --- a/src/commands/utilities/decode.ts +++ b/src/commands/utilities/decode.ts @@ -1,6 +1,6 @@ import { AllowedMentions, BushCommand, type BushMessage } from '#lib'; import { type AkairoMessage } from 'discord-akairo'; -import { ApplicationCommandOptionType, MessageEmbed } from 'discord.js'; +import { ApplicationCommandOptionType, Embed } from 'discord.js'; const encodingTypesArray = ['ascii', 'utf8', 'utf-8', 'utf16le', 'ucs2', 'ucs-2', 'base64', 'latin1', 'binary', 'hex']; const encodingTypesString = encodingTypesArray.map((e) => `\`${e}\``).join(', '); @@ -53,16 +53,19 @@ export default class DecodeCommand extends BushCommand { { from, to, data }: { from: BufferEncoding; to: BufferEncoding; data: string } ) { const encodeOrDecode = util.capitalizeFirstLetter(message?.util?.parsed?.alias ?? 'decoded'); - const decodedEmbed = new MessageEmbed() + const decodedEmbed = new Embed() .setTitle(`${encodeOrDecode} Information`) - .addField('📥 Input', await util.inspectCleanRedactCodeblock(data)); + .addField({ name: '📥 Input', value: await util.inspectCleanRedactCodeblock(data) }); try { const decoded = Buffer.from(data, from).toString(to); - decodedEmbed.setColor(util.colors.success).addField('📤 Output', await util.inspectCleanRedactCodeblock(decoded)); - } catch (error) { decodedEmbed - .setColor(util.colors.error) - .addField(`📤 Error ${encodeOrDecode.slice(1)}ing`, await util.inspectCleanRedactCodeblock(error?.stack ?? error)); + .setColor(util.colors.success) + .addField({ name: '📤 Output', value: await util.inspectCleanRedactCodeblock(decoded) }); + } catch (error) { + decodedEmbed.setColor(util.colors.error).addField({ + name: `📤 Error ${encodeOrDecode.slice(1)}ing`, + value: await util.inspectCleanRedactCodeblock(error?.stack ?? error) + }); } return await message.util.reply({ embeds: [decodedEmbed], allowedMentions: AllowedMentions.none() }); } diff --git a/src/commands/utilities/price.ts b/src/commands/utilities/price.ts index 9fb79bc..2df70b7 100644 --- a/src/commands/utilities/price.ts +++ b/src/commands/utilities/price.ts @@ -1,6 +1,6 @@ import { BushCommand, type BushMessage } from '#lib'; import assert from 'assert'; -import { ApplicationCommandOptionType, AutocompleteInteraction, MessageEmbed, Permissions } from 'discord.js'; +import { ApplicationCommandOptionType, AutocompleteInteraction, Embed, Permissions } from 'discord.js'; import Fuse from 'fuse.js'; import got from 'got'; @@ -58,7 +58,7 @@ export default class PriceCommand extends BushCommand { ])) as [Bazaar, LowestBIN, LowestBIN, AuctionAverages]; let parsedItem = item.toString().toUpperCase().replace(/ /g, '_').replace(/'S/g, ''); - const priceEmbed = new MessageEmbed(); + const priceEmbed = new Embed(); if (bazaar?.success === false) errors.push('bazaar'); @@ -86,17 +86,17 @@ export default class PriceCommand extends BushCommand { // if its a bazaar item then it there should not be any ah data if (bazaar['products']?.[parsedItem]) { - const bazaarPriceEmbed = new MessageEmbed() + const bazaarPriceEmbed = new Embed() .setColor(errors?.length ? util.colors.warn : util.colors.success) .setTitle(`Bazaar Information for **${parsedItem}**`) - .addField('Sell Price', addBazaarInformation('sellPrice', 2, true)) - .addField('Buy Price', addBazaarInformation('buyPrice', 2, true)) - .addField( - 'Margin', - (+addBazaarInformation('buyPrice', 2, false) - +addBazaarInformation('sellPrice', 2, false)).toLocaleString() - ) - .addField('Current Sell Orders', addBazaarInformation('sellOrders', 0, true)) - .addField('Current Buy Orders', addBazaarInformation('buyOrders', 0, true)); + .addField({ name: 'Sell Price', value: addBazaarInformation('sellPrice', 2, true) }) + .addField({ name: 'Buy Price', value: addBazaarInformation('buyPrice', 2, true) }) + .addField({ + name: 'Margin', + value: (+addBazaarInformation('buyPrice', 2, false) - +addBazaarInformation('sellPrice', 2, false)).toLocaleString() + }) + .addField({ name: 'Current Sell Orders', value: addBazaarInformation('sellOrders', 0, true) }) + .addField({ name: 'Current Buy Orders', value: addBazaarInformation('buyOrders', 0, true) }); return await message.util.reply({ embeds: [bazaarPriceEmbed] }); } @@ -107,7 +107,7 @@ export default class PriceCommand extends BushCommand { .setTitle(`Price Information for \`${parsedItem}\``) .setFooter({ text: 'All information is based on the last 3 days.' }); } else { - const errorEmbed = new MessageEmbed(); + const errorEmbed = new Embed(); errorEmbed .setColor(util.colors.error) .setDescription(`${util.emojis.error} \`${parsedItem}\` is not a valid item id, or it has no auction data.`); @@ -136,7 +136,10 @@ export default class PriceCommand extends BushCommand { } function addPrice(name: string, price: number | undefined) { if (price) - priceEmbed.addField(name, price.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 })); + priceEmbed.addField({ + name: name, + value: price.toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 }) + }); } } diff --git a/src/commands/utilities/reminders.ts b/src/commands/utilities/reminders.ts index 40ec9a2..369a1a5 100644 --- a/src/commands/utilities/reminders.ts +++ b/src/commands/utilities/reminders.ts @@ -1,6 +1,7 @@ import { BushCommand, ButtonPaginator, Reminder, type BushMessage, type BushSlashMessage } from '#lib'; import assert from 'assert'; -import { Permissions, type MessageEmbedOptions } from 'discord.js'; +import { APIEmbed } from 'discord-api-types'; +import { Permissions } from 'discord.js'; import { Op } from 'sequelize'; assert(Op); @@ -26,7 +27,7 @@ export default class RemindersCommand extends BushCommand { const formattedReminders = reminders.map((reminder) => `${util.timestamp(reminder.expires, 't')} - ${reminder.content}`); const chunked = util.chunk(formattedReminders, 15); - const embeds: MessageEmbedOptions[] = chunked.map((chunk) => ({ + const embeds: APIEmbed[] = chunked.map((chunk) => ({ title: `Reminders`, description: chunk.join('\n'), color: util.colors.default diff --git a/src/commands/utilities/suicide.ts b/src/commands/utilities/suicide.ts index d880215..293008c 100644 --- a/src/commands/utilities/suicide.ts +++ b/src/commands/utilities/suicide.ts @@ -1,5 +1,5 @@ import { AllowedMentions, BushCommand, type BushMessage, type BushSlashMessage } from '#lib'; -import { MessageEmbed } from 'discord.js'; +import { Embed } from 'discord.js'; export default class SuicideCommand extends BushCommand { public constructor() { @@ -18,7 +18,7 @@ export default class SuicideCommand extends BushCommand { public override async exec(message: BushMessage | BushSlashMessage) { // stolen from https://github.com/dexbiobot/Zeppelin - const suicideEmbed = new MessageEmbed() + const suicideEmbed = new Embed() .setTitle('Mental Health Resources') .setColor(util.colors.red) .setAuthor({ @@ -26,23 +26,23 @@ export default class SuicideCommand extends BushCommand { iconURL: 'https://media.discordapp.net/attachments/770256340639416320/854689949193076737/Medical_31-60_974.jpg?width=523&height=523' }) - .addField( - '**National Suicide Prevention Hotline (U.S.):**', - [ + .addField({ + name: '**National Suicide Prevention Hotline (U.S.):**', + value: [ '**Call:** 1-800-273-8255, available 24/7 for emotional support', '**Text: HOME** to 741741', 'https://suicidepreventionlifeline.org/chat/', '', '**Outside the U.S**: Find a supportive resource on [this Wikipedia list of worldwide crisis hotlines](https://en.wikipedia.org/wiki/List_of_suicide_crisis_lines)' ].join('\n') - ) - .addField( - '**More Support**', - [ + }) + .addField({ + name: '**More Support**', + value: [ 'For Substance Abuse Support, Eating Disorder Support & Child Abuse and Domestic Violence:', "[Click to go to Discord's Health & Safety Page](https://discord.com/safety/360044103771-Mental-health-on-Discord#h_01EGRGT08QSZ5BNCH2E9HN0NYV)" ].join('\n') - ); + }); return message.util.send({ embeds: [suicideEmbed], diff --git a/src/commands/utilities/viewRaw.ts b/src/commands/utilities/viewRaw.ts index 4b1ff1e..fc50e31 100644 --- a/src/commands/utilities/viewRaw.ts +++ b/src/commands/utilities/viewRaw.ts @@ -7,7 +7,7 @@ import { type BushTextChannel, type OptionalArgType } from '#lib'; -import { ApplicationCommandOptionType, Message, MessageEmbed, Permissions, type Snowflake } from 'discord.js'; +import { ApplicationCommandOptionType, ChannelType, Embed, Message, Permissions, type Snowflake } from 'discord.js'; export default class ViewRawCommand extends BushCommand { public constructor() { @@ -35,7 +35,14 @@ export default class ViewRawCommand extends BushCommand { retry: '{error} Choose a valid channel.', optional: true, slashType: ApplicationCommandOptionType.Channel, - channelTypes: ['GuildText', 'DM', 'GuildNews', 'GuildNewsThread', 'GuildPublicThread', 'GuildPrivateThread'] + channelTypes: [ + ChannelType.GuildText, + ChannelType.DM, + ChannelType.GuildNews, + ChannelType.GuildNewsThread, + ChannelType.GuildPublicThread, + ChannelType.GuildPrivateThread + ] }, { id: 'json', @@ -82,12 +89,12 @@ export default class ViewRawCommand extends BushCommand { `${util.emojis.error} There was an error fetching that message, make sure that is a valid id and if the message is not in this channel, please provide a channel.` ); - const messageEmbed = await ViewRawCommand.getRawData(newMessage as BushMessage, { json: args.json, js: args.js }); + const Embed = await ViewRawCommand.getRawData(newMessage as BushMessage, { json: args.json, js: args.js }); - return await message.util.reply({ embeds: [messageEmbed] }); + return await message.util.reply({ embeds: [Embed] }); } - public static async getRawData(message: BushMessage, options: { json?: boolean; js: boolean }): Promise<MessageEmbed> { + public static async getRawData(message: BushMessage, options: { json?: boolean; js: boolean }): Promise<Embed> { const content = options.json || options.js ? options.json @@ -95,7 +102,7 @@ export default class ViewRawCommand extends BushCommand { : util.inspect(message.toJSON()) || '[No Content]' : message.content || '[No Content]'; const lang = options.json ? 'json' : options.js ? 'js' : undefined; - return new MessageEmbed() + return new Embed() .setFooter({ text: message.author.tag, iconURL: message.author.avatarURL() ?? undefined }) .setTimestamp(message.createdTimestamp) .setColor(message.member?.roles?.color?.color ?? util.colors.default) diff --git a/src/commands/utilities/wolframAlpha.ts b/src/commands/utilities/wolframAlpha.ts index 984d617..f8e5c22 100644 --- a/src/commands/utilities/wolframAlpha.ts +++ b/src/commands/utilities/wolframAlpha.ts @@ -1,7 +1,7 @@ import { AllowedMentions, BushCommand, type BushMessage, type BushSlashMessage } from '#lib'; import { initializeClass as WolframAlphaAPI } from '@notenoughupdates/wolfram-alpha-api'; import assert from 'assert'; -import { ApplicationCommandOptionType, MessageEmbed, type MessageOptions } from 'discord.js'; +import { ApplicationCommandOptionType, Embed, type MessageOptions } from 'discord.js'; assert(WolframAlphaAPI); @@ -45,7 +45,10 @@ export default class WolframAlphaCommand extends BushCommand { args.image && void message.util.reply({ content: `${util.emojis.loading} Loading...`, embeds: [] }); const waApi = WolframAlphaAPI(client.config.credentials.wolframAlphaAppId); - const decodedEmbed = new MessageEmbed().addField('📥 Input', await util.inspectCleanRedactCodeblock(args.expression)); + const decodedEmbed = new Embed().addField({ + name: '📥 Input', + value: await util.inspectCleanRedactCodeblock(args.expression) + }); const sendOptions: MessageOptions = { content: null, allowedMentions: AllowedMentions.none() }; try { const calculated = await (args.image @@ -55,15 +58,15 @@ export default class WolframAlphaCommand extends BushCommand { if (args.image) { decodedEmbed.setImage(await util.uploadImageToImgur(calculated.split(',')[1])); - decodedEmbed.addField('📤 Output', ''); + decodedEmbed.addField({ name: '📤 Output', value: '' }); } else { - decodedEmbed.addField('📤 Output', await util.inspectCleanRedactCodeblock(calculated.toString())); + decodedEmbed.addField({ name: '📤 Output', value: await util.inspectCleanRedactCodeblock(calculated.toString()) }); } } catch (error) { decodedEmbed .setTitle(`${util.emojis.errorFull} Unable to Query Expression`) .setColor(util.colors.error) - .addField(`📤 Error`, await util.inspectCleanRedactCodeblock(`${error.name}: ${error.message}`, 'js')); + .addField({ name: `📤 Error`, value: await util.inspectCleanRedactCodeblock(`${error.name}: ${error.message}`, 'js') }); } sendOptions.embeds = [decodedEmbed]; diff --git a/src/lib/common/AutoMod.ts b/src/lib/common/AutoMod.ts index 4de242a..c57d581 100644 --- a/src/lib/common/AutoMod.ts +++ b/src/lib/common/AutoMod.ts @@ -4,8 +4,8 @@ import { ButtonComponent, ButtonStyle, ChannelType, + Embed, GuildMember, - MessageEmbed, Permissions, type TextChannel } from 'discord.js'; @@ -142,12 +142,12 @@ 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 MessageEmbed() + new Embed() .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})` ) - .addField('Message Content', `${await util.codeblock(this.message.content, 1024)}`) + .addField({ name: 'Message Content', value: `${await util.codeblock(this.message.content, 1024)}` }) .setColor(color) .setTimestamp() ], @@ -250,7 +250,7 @@ export class AutoMod { * @param color The color that the log embed should be (based on the severity) * @param offences The other offences that were also matched in the message */ - private async log(highestOffence: BadWordDetails, color: `#${string}`, offences: BadWordDetails[]) { + private async log(highestOffence: BadWordDetails, color: number, offences: BadWordDetails[]) { void client.console.info( 'autoMod', `Severity <<${highestOffence.severity}>> action performed on <<${this.message.author.tag}>> (<<${ @@ -260,14 +260,14 @@ export class AutoMod { await this.message.guild!.sendLogChannel('automod', { embeds: [ - new MessageEmbed() + new Embed() .setTitle(`[Severity ${highestOffence.severity}] Automod Action Performed`) .setDescription( `**User:** ${this.message.author} (${this.message.author.tag})\n**Sent From**: <#${ this.message.channel.id }> [Jump to context](${this.message.url})\n**Blacklisted Words:** ${offences.map((o) => `\`${o.match}\``).join(', ')}` ) - .addField('Message Content', `${await util.codeblock(this.message.content, 1024)}`) + .addField({ name: 'Message Content', value: `${await util.codeblock(this.message.content, 1024)}` }) .setColor(color) .setTimestamp() .setAuthor({ name: this.message.author.tag, url: this.message.author.displayAvatarURL() }) diff --git a/src/lib/common/ButtonPaginator.ts b/src/lib/common/ButtonPaginator.ts index 9e72551..0c18119 100644 --- a/src/lib/common/ButtonPaginator.ts +++ b/src/lib/common/ButtonPaginator.ts @@ -1,15 +1,7 @@ import { DeleteButton, type BushMessage, type BushSlashMessage } from '#lib'; import { CommandUtil } from 'discord-akairo'; -import { - ActionRow, - ActionRowComponent, - ButtonComponent, - ButtonStyle, - ComponentType, - MessageEmbed, - type MessageComponentInteraction, - type MessageEmbedOptions -} from 'discord.js'; +import { APIEmbed } from 'discord-api-types'; +import { ActionRow, ActionRowComponent, ButtonComponent, ButtonStyle, Embed, type MessageComponentInteraction } from 'discord.js'; /** * Sends multiple embeds with controls to switch between them @@ -23,7 +15,7 @@ export class ButtonPaginator { /** * The embeds to paginate */ - protected embeds: MessageEmbed[] | MessageEmbedOptions[]; + protected embeds: Embed[] | APIEmbed[]; /** * The optional text to send with the paginator @@ -54,7 +46,7 @@ export class ButtonPaginator { */ protected constructor( message: BushMessage | BushSlashMessage, - embeds: MessageEmbed[] | MessageEmbedOptions[], + embeds: Embed[] | APIEmbed[], text: string | null, deleteOnExit: boolean, startOn: number @@ -68,10 +60,10 @@ export class ButtonPaginator { // add footers for (let i = 0; i < embeds.length; i++) { - if (embeds[i] instanceof MessageEmbed) { - (embeds[i] as MessageEmbed).setFooter({ text: `Page ${(i + 1).toLocaleString()}/${embeds.length.toLocaleString()}` }); + if (embeds[i] instanceof Embed) { + (embeds[i] as Embed).setFooter({ text: `Page ${(i + 1).toLocaleString()}/${embeds.length.toLocaleString()}` }); } else { - (embeds[i] as MessageEmbedOptions).footer = { + (embeds[i] as APIEmbed).footer = { text: `Page ${(i + 1).toLocaleString()}/${embeds.length.toLocaleString()}` }; } @@ -96,16 +88,9 @@ export class ButtonPaginator { })) as BushMessage; const collector = this.sentMessage.createMessageComponentCollector({ - componentType: ComponentType.Button, - filter: (i) => { - const ret = i.customId.startsWith('paginate_') && i.message.id === this.sentMessage!.id; - console.debug(ret); - return ret; - }, - idle: 300000 + filter: (i) => i.customId.startsWith('paginate_'), + time: 300_000 }); - console.debug('got here'); - collector.on('collect', (i) => void this.collect(i)); collector.on('end', () => void this.end()); } @@ -115,9 +100,8 @@ export class ButtonPaginator { * @param interaction The interaction received */ protected async collect(interaction: MessageComponentInteraction) { - console.debug(1); if (interaction.user.id !== this.message.author.id && !client.config.owners.includes(interaction.user.id)) - return await interaction?.deferUpdate(); /* .catch(() => null); */ + return await interaction?.deferUpdate().catch(() => null); switch (interaction.customId) { case 'paginate_beginning': @@ -130,16 +114,17 @@ export class ButtonPaginator { break; case 'paginate_stop': if (this.deleteOnExit) { - await interaction.deferUpdate(); /* .catch(() => null); */ - await this.sentMessage!.delete(); /* .catch(() => null); */ + await interaction.deferUpdate().catch(() => null); + await this.sentMessage!.delete().catch(() => null); break; } else { - await interaction?.update({ - content: `${this.text ? `${this.text}\n` : ''}Command closed by user.`, - embeds: [], - components: [] - }); - /* .catch(() => null); */ + await interaction + ?.update({ + content: `${this.text ? `${this.text}\n` : ''}Command closed by user.`, + embeds: [], + components: [] + }) + .catch(() => null); break; } case 'paginate_next': @@ -158,12 +143,13 @@ export class ButtonPaginator { */ protected async end() { if (this.sentMessage && !CommandUtil.deletedMessages.has(this.sentMessage.id)) - await this.sentMessage.edit({ - content: this.text, - embeds: [this.embeds[this.curPage]], - components: [this.getPaginationRow(true)] - }); - /* .catch(() => null); */ + await this.sentMessage + .edit({ + content: this.text, + embeds: [this.embeds[this.curPage]], + components: [this.getPaginationRow(true)] + }) + .catch(() => null); } /** @@ -171,12 +157,13 @@ export class ButtonPaginator { * @param interaction The interaction received */ protected async edit(interaction: MessageComponentInteraction) { - await interaction?.update({ - content: this.text, - embeds: [this.embeds[this.curPage]], - components: [this.getPaginationRow()] - }); - /* .catch(() => null); */ + await interaction + ?.update({ + content: this.text, + embeds: [this.embeds[this.curPage]], + components: [this.getPaginationRow()] + }) + .catch(() => null); } /** @@ -224,7 +211,7 @@ export class ButtonPaginator { */ public static async send( message: BushMessage | BushSlashMessage, - embeds: MessageEmbed[] | MessageEmbedOptions[], + embeds: (Embed | APIEmbed)[], text: string | null = null, deleteOnExit = true, startOn = 1 diff --git a/src/lib/common/DeleteButton.ts b/src/lib/common/DeleteButton.ts index edc40fe..cf3b416 100644 --- a/src/lib/common/DeleteButton.ts +++ b/src/lib/common/DeleteButton.ts @@ -1,6 +1,14 @@ import { PaginateEmojis, type BushMessage, type BushSlashMessage } from '#lib'; import { CommandUtil } from 'discord-akairo'; -import { ActionRow, ButtonComponent, ButtonStyle, MessageComponentInteraction, type MessageOptions } from 'discord.js'; +import { + ActionRow, + ButtonComponent, + ButtonStyle, + MessageComponentInteraction, + MessageEditOptions, + MessagePayload, + type MessageOptions +} from 'discord.js'; /** * Sends a message with a button for the user to delete it. @@ -47,7 +55,7 @@ export class DeleteButton { collector.on('end', async () => { this.updateComponents(true, true); - await msg.edit(this.messageOptions).catch(() => undefined); + await msg.edit(<string | MessagePayload | MessageEditOptions>this.messageOptions).catch(() => undefined); }); } diff --git a/src/lib/common/util/Moderation.ts b/src/lib/common/util/Moderation.ts index 84d9fbf..62dbc90 100644 --- a/src/lib/common/util/Moderation.ts +++ b/src/lib/common/util/Moderation.ts @@ -10,7 +10,7 @@ import { type BushUserResolvable, type ModLogType } from '#lib'; -import { MessageEmbed, Permissions, type Snowflake } from 'discord.js'; +import { Embed, Permissions, type Snowflake } from 'discord.js'; /** * A utility class with moderation-related methods. @@ -208,7 +208,7 @@ export class Moderation { const ending = await options.guild.getSetting('punishmentEnding'); const dmEmbed = ending && ending.length && options.sendFooter - ? new MessageEmbed().setDescription(ending).setColor(util.colors.newBlurple) + ? new Embed().setDescription(ending).setColor(util.colors.newBlurple) : undefined; const dmSuccess = await client.users diff --git a/src/lib/extensions/discord-akairo/BushClient.ts b/src/lib/extensions/discord-akairo/BushClient.ts index 01620a8..712d610 100644 --- a/src/lib/extensions/discord-akairo/BushClient.ts +++ b/src/lib/extensions/discord-akairo/BushClient.ts @@ -190,6 +190,7 @@ export class BushClient<Ready extends boolean = boolean> extends AkairoClient<Re super({ ownerID: config.owners, intents: Object.values(Intents.FLAGS).reduce((acc, p) => acc | p, 0), + partials: ['USER', 'CHANNEL', 'GUILD_MEMBER', 'MESSAGE', 'REACTION', 'GUILD_SCHEDULED_EVENT'], presence: { activities: [ { diff --git a/src/lib/extensions/discord-akairo/BushClientUtil.ts b/src/lib/extensions/discord-akairo/BushClientUtil.ts index 79aa4c1..968a805 100644 --- a/src/lib/extensions/discord-akairo/BushClientUtil.ts +++ b/src/lib/extensions/discord-akairo/BushClientUtil.ts @@ -16,21 +16,19 @@ import { type Pronoun, type PronounCode } from '#lib'; -import type { APIMessage } from '@discordjs/builders/node_modules/discord-api-types'; import { humanizeDuration } from '@notenoughupdates/humanize-duration'; import { exec } from 'child_process'; import deepLock from 'deep-lock'; import { ClientUtil, Util as AkairoUtil } from 'discord-akairo'; +import type { APIMessage } from 'discord-api-types'; import { Constants as DiscordConstants, GuildMember, Message, - MessageEmbed, Permissions, ThreadMember, User, Util as DiscordUtil, - type ColorResolvable, type CommandInteraction, type InteractionReplyOptions, type Snowflake, @@ -197,27 +195,6 @@ export class BushClientUtil extends ClientUtil { } /** - * A simple utility to create and embed with the needed style for the bot. - * @param color The color to set the embed to. - * @param author The author to set the embed to. - * @returns The generated embed. - */ - public createEmbed(color?: ColorResolvable, author?: User | GuildMember): MessageEmbed { - if (author instanceof GuildMember) { - author = author.user; // Convert to User if GuildMember - } - let embed = new MessageEmbed().setTimestamp(); - if (author) - embed = embed.setAuthor({ - name: author.username, - iconURL: author.displayAvatarURL(), - url: `https://discord.com/users/${author.id}` - }); - if (color) embed = embed.setColor(color); - return embed; - } - - /** * Fetches a user's uuid from the mojang api. * @param username The username to get the uuid of. * @returns The the uuid of the user. diff --git a/src/lib/extensions/discord.js/BushButtonInteraction.ts b/src/lib/extensions/discord.js/BushButtonInteraction.ts index 191ad5c..b7ad77c 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 '@discordjs/builders/node_modules/discord-api-types/payloads/v9/_interactions/base'; +import type { APIInteractionGuildMember } from 'discord-api-types'; 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/BushChatInputCommandInteraction.ts b/src/lib/extensions/discord.js/BushChatInputCommandInteraction.ts index 56bef21..4d68f79 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 '@discordjs/builders/node_modules/discord-api-types'; +import type { APIInteractionGuildMember } from 'discord-api-types'; 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/BushGuild.ts b/src/lib/extensions/discord.js/BushGuild.ts index 9f114b6..bbef953 100644 --- a/src/lib/extensions/discord.js/BushGuild.ts +++ b/src/lib/extensions/discord.js/BushGuild.ts @@ -367,11 +367,11 @@ export class BushGuild extends Guild { await channel.send({ embeds: [ { - author: { name: moderator.user.tag, iconURL: moderator.displayAvatarURL() }, + author: { name: moderator.user.tag, icon_url: moderator.displayAvatarURL() }, title: `This channel has been ${options.unlock ? 'un' : ''}locked`, description: options.reason ?? 'No reason provided', color: options.unlock ? util.colors.discord.GREEN : util.colors.discord.RED, - timestamp: Date.now() + timestamp: new Date().toISOString() } ] }); diff --git a/src/lib/extensions/discord.js/BushSelectMenuInteraction.ts b/src/lib/extensions/discord.js/BushSelectMenuInteraction.ts index 23e2453..2c7c329 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 '@discordjs/builders/node_modules/discord-api-types'; +import type { APIInteractionGuildMember } from 'discord-api-types'; import { SelectMenuInteraction, type CacheType, type CacheTypeReducer } from 'discord.js'; import type { RawMessageSelectMenuInteractionData } from 'discord.js/typings/rawDataTypes'; diff --git a/src/lib/models/Guild.ts b/src/lib/models/Guild.ts index fd90dbf..7e67e21 100644 --- a/src/lib/models/Guild.ts +++ b/src/lib/models/Guild.ts @@ -182,7 +182,7 @@ export interface GuildSetting { name: string; description: string; type: GuildSettingType; - subType: (keyof typeof ChannelType)[] | undefined; + subType: ChannelType[] | undefined; configurable: boolean; } const asGuildSetting = <T>(et: { [K in keyof T]: GuildSetting }) => et; @@ -199,14 +199,20 @@ export const guildSettingsObj = asGuildSetting({ name: 'Auto Publish Channels', description: 'Channels were every message is automatically published.', type: 'channel-array', - subType: ['GuildNews'], + subType: [ChannelType.GuildNews], configurable: true }, welcomeChannel: { name: 'Welcome Channel', description: 'The channel where the bot will send join and leave message.', type: 'channel', - subType: ['GuildText', 'GuildNews', 'GuildNewsThread', 'GuildPublicThread', 'GuildPrivateThread'], + subType: [ + ChannelType.GuildText, + ChannelType.GuildNews, + ChannelType.GuildNewsThread, + ChannelType.GuildPublicThread, + ChannelType.GuildPrivateThread + ], configurable: true }, muteRole: { @@ -227,7 +233,7 @@ export const guildSettingsObj = asGuildSetting({ name: 'Lockdown Channels', description: 'Channels that are locked down when a mass lockdown is specified.', type: 'channel-array', - subType: ['GuildText'], + subType: [ChannelType.GuildText], configurable: true }, joinRoles: { @@ -248,7 +254,7 @@ export const guildSettingsObj = asGuildSetting({ name: 'Log Channels', description: 'The channel were logs are sent.', type: 'custom', - subType: ['GuildText'], + subType: [ChannelType.GuildText], configurable: false }, autoModPhases: { @@ -262,7 +268,13 @@ export const guildSettingsObj = asGuildSetting({ name: 'No Xp Channels', description: 'Channels where users will not earn xp for leveling.', type: 'channel-array', - subType: ['GuildText', 'GuildNews', 'GuildNewsThread', 'GuildPublicThread', 'GuildPrivateThread'], + subType: [ + ChannelType.GuildText, + ChannelType.GuildNews, + ChannelType.GuildNewsThread, + ChannelType.GuildPublicThread, + ChannelType.GuildPrivateThread + ], configurable: true }, levelRoles: { @@ -276,7 +288,13 @@ export const guildSettingsObj = asGuildSetting({ name: 'Level Up Channel', description: 'The channel to send level up messages in instead of last channel.', type: 'channel', - subType: ['GuildText', 'GuildNews', 'GuildNewsThread', 'GuildPublicThread', 'GuildPrivateThread'], + subType: [ + ChannelType.GuildText, + ChannelType.GuildNews, + ChannelType.GuildNewsThread, + ChannelType.GuildPublicThread, + ChannelType.GuildPrivateThread + ], configurable: true } }); diff --git a/src/lib/utils/BushConstants.ts b/src/lib/utils/BushConstants.ts index e8366a1..4e73672 100644 --- a/src/lib/utils/BushConstants.ts +++ b/src/lib/utils/BushConstants.ts @@ -23,28 +23,28 @@ export class BushConstants { } as const); public static colors = BushClientUtil.deepFreeze({ - default: '#1FD8F1', - error: '#EF4947', - warn: '#FEBA12', - success: '#3BB681', - info: '#3B78FF', - red: '#ff0000', - blue: '#0055ff', - aqua: '#00bbff', - purple: '#8400ff', - blurple: '#5440cd', - newBlurple: '#5865f2', - pink: '#ff00e6', - green: '#00ff1e', - darkGreen: '#008f11', - gold: '#b59400', - yellow: '#ffff00', - white: '#ffffff', - gray: '#a6a6a6', - lightGray: '#cfcfcf', - darkGray: '#7a7a7a', - black: '#000000', - orange: '#E86100', + default: 0x1fd8f1, + error: 0xef4947, + warn: 0xfeba12, + success: 0x3bb681, + info: 0x3b78ff, + red: 0xff0000, + blue: 0x0055ff, + aqua: 0x00bbff, + purple: 0x8400ff, + blurple: 0x5440cd, + newBlurple: 0x5865f2, + pink: 0xff00e6, + green: 0x00ff1e, + darkGreen: 0x008f11, + gold: 0xb59400, + yellow: 0xffff00, + white: 0xffffff, + gray: 0xa6a6a6, + lightGray: 0xcfcfcf, + darkGray: 0x7a7a7a, + black: 0x000000, + orange: 0xe86100, discord: Object.assign({}, Constants.Colors) } as const); diff --git a/src/lib/utils/BushLogger.ts b/src/lib/utils/BushLogger.ts index 476a86d..341fb7e 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 { MessageEmbed, Util, type Message, type PartialTextBasedChannelFields } from 'discord.js'; +import { Embed, Util, type Message, type PartialTextBasedChannelFields } from 'discord.js'; import { inspect } from 'util'; import { type BushSendMessageType } from '../extensions/discord-akairo/BushClient'; @@ -152,7 +152,7 @@ export class BushLogger { `${chalk.bgGrey(this.#getTimeStamp())} ${chalk.grey(`[${header}]`)} ${this.#parseFormatting(newContent, 'blackBright')}` ); if (!sendChannel) return; - const embed = new MessageEmbed() + const embed = new Embed() .setDescription(`**[${header}]** ${this.#parseFormatting(this.#stripColor(newContent), '', true)}`) .setColor(util.colors.gray) .setTimestamp(); @@ -197,7 +197,7 @@ export class BushLogger { `${chalk.bgCyan(this.#getTimeStamp())} ${chalk.cyan(`[${header}]`)} ${this.#parseFormatting(newContent, 'blueBright')}` ); if (!sendChannel) return; - const embed = new MessageEmbed() + const embed = new Embed() .setDescription(`**[${header}]** ${this.#parseFormatting(this.#stripColor(newContent), '', true)}`) .setColor(util.colors.info) .setTimestamp(); @@ -221,7 +221,7 @@ export class BushLogger { ); if (!sendChannel) return; - const embed = new MessageEmbed() + const embed = new Embed() .setDescription(`**[${header}]** ${this.#parseFormatting(this.#stripColor(newContent), '', true)}`) .setColor(util.colors.warn) .setTimestamp(); @@ -244,7 +244,7 @@ export class BushLogger { )}` ); if (!sendChannel) return; - const embed = new MessageEmbed() + const embed = new Embed() .setDescription(`**[${header}]** ${this.#parseFormatting(this.#stripColor(newContent), '', true)}`) .setColor(util.colors.error) .setTimestamp(); @@ -268,7 +268,7 @@ export class BushLogger { )}` ); if (!sendChannel) return; - const embed = new MessageEmbed() + const embed = new Embed() .setDescription(`**[${header}]** ${this.#parseFormatting(this.#stripColor(newContent), '', true)}`) .setColor(util.colors.success) .setTimestamp(); diff --git a/src/listeners/bush/joinAutoBan.ts b/src/listeners/bush/joinAutoBan.ts index 421e708..5ded5b4 100644 --- a/src/listeners/bush/joinAutoBan.ts +++ b/src/listeners/bush/joinAutoBan.ts @@ -40,7 +40,7 @@ export default class JoinAutoBanListener extends BushListener { color: client.consts.colors.red, author: { name: member.user.tag, - iconURL: member.displayAvatarURL() + icon_url: member.displayAvatarURL() } } ] diff --git a/src/listeners/bush/userUpdateAutoBan.ts b/src/listeners/bush/userUpdateAutoBan.ts index 67d9f5c..97fcf48 100644 --- a/src/listeners/bush/userUpdateAutoBan.ts +++ b/src/listeners/bush/userUpdateAutoBan.ts @@ -46,7 +46,7 @@ export default class UserUpdateAutoBanListener extends BushListener { color: client.consts.colors.red, author: { name: member.user.tag, - iconURL: member.displayAvatarURL() + icon_url: member.displayAvatarURL() } } ] diff --git a/src/listeners/commands/commandBlocked.ts b/src/listeners/commands/commandBlocked.ts index 2dfe4cd..c80b99a 100644 --- a/src/listeners/commands/commandBlocked.ts +++ b/src/listeners/commands/commandBlocked.ts @@ -116,7 +116,9 @@ export default class CommandBlockedListener extends BushListener { // some inhibitors do not have message.util yet function respond(content: string | MessagePayload | ReplyMessageOptions | InteractionReplyOptions) { - return message.util ? message.util.reply(content) : message.reply(content); + return message.util + ? message.util.reply(<string | MessagePayload | ReplyMessageOptions>content) + : message.reply(<string | MessagePayload | (ReplyMessageOptions & InteractionReplyOptions)>content); } } } diff --git a/src/listeners/commands/commandError.ts b/src/listeners/commands/commandError.ts index 44d20a4..bd1ae7d 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 { Formatters, GuildTextBasedChannel, MessageEmbed, type Message } from 'discord.js'; +import { Embed, Formatters, GuildTextBasedChannel, type Message } from 'discord.js'; import { BushListener } from '../../lib/extensions/discord-akairo/BushListener.js'; export default class CommandErrorListener extends BushListener { @@ -90,7 +90,7 @@ export default class CommandErrorListener extends BushListener { channel?: string; } | { error: Error | any; type: 'uncaughtException' | 'unhandledRejection'; context?: string } - ): Promise<MessageEmbed> { + ): Promise<Embed> { const _haste = CommandErrorListener.getErrorHaste(options.error); const _stack = CommandErrorListener.getErrorStack(options.error); const [haste, stack] = await Promise.all([_haste, _stack]); @@ -118,8 +118,8 @@ export default class CommandErrorListener extends BushListener { haste: string[]; stack: string; } - ): MessageEmbed { - const embed = new MessageEmbed().setColor(util.colors.error).setTimestamp(); + ): Embed { + const embed = new Embed().setColor(util.colors.error).setTimestamp(); if (options.type === 'command-user') { return embed .setTitle('An Error Occurred') @@ -143,7 +143,7 @@ export default class CommandErrorListener extends BushListener { description.push(...options.haste); - embed.addField('Stack Trace', options.stack).setDescription(description.join('\n')); + embed.addField({ name: 'Stack Trace', value: options.stack }).setDescription(description.join('\n')); if (options.type === 'command-dev' || options.type === 'command-log') embed.setTitle(`${options.isSlash ? 'Slash ' : ''}CommandError #\`${options.errorNum}\``); diff --git a/src/listeners/guild-custom/bushLockdown.ts b/src/listeners/guild-custom/bushLockdown.ts index d48ddf1..f3e72e7 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 { MessageEmbed } from 'discord.js'; +import { Embed } from 'discord.js'; export default class BushLockdownListener extends BushListener { public constructor() { @@ -14,19 +14,19 @@ export default class BushLockdownListener extends BushListener { const logChannel = await moderator.guild.getLogChannel('moderation'); if (!logChannel) return; - const logEmbed = new MessageEmbed() + const logEmbed = new Embed() .setColor(util.colors.discord.BLURPLE) .setTimestamp() - .addField('**Action**', `${'Lockdown'}`) - .addField('**Moderator**', `${moderator} (${moderator.user.tag})`) + .addField({ name: '**Action**', value: `${'Lockdown'}` }) + .addField({ name: '**Moderator**', value: `${moderator} (${moderator.user.tag})` }) // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing - .addField('**Reason**', `${reason || '[No Reason Provided]'}`) - .addField( - `**Channel${channelsSuccessMap.size > 1 ? 's' : ''}**`, - channelsSuccessMap + .addField({ name: '**Reason**', value: `${reason || '[No Reason Provided]'}` }) + .addField({ + name: `**Channel${channelsSuccessMap.size > 1 ? 's' : ''}**`, + value: channelsSuccessMap .map((success, channel) => `<#${channel}> ${success ? util.emojis.success : util.emojis.error}`) .join('\n') - ); + }); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/guild-custom/bushUnlockdown.ts b/src/listeners/guild-custom/bushUnlockdown.ts index cfddc2f..0ac2a13 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 { MessageEmbed } from 'discord.js'; +import { Embed } from 'discord.js'; export default class BushUnlockdownListener extends BushListener { public constructor() { @@ -14,19 +14,19 @@ export default class BushUnlockdownListener extends BushListener { const logChannel = await moderator.guild.getLogChannel('moderation'); if (!logChannel) return; - const logEmbed = new MessageEmbed() + const logEmbed = new Embed() .setColor(util.colors.discord.BLURPLE) .setTimestamp() - .addField('**Action**', `${'Unlockdown'}`) - .addField('**Moderator**', `${moderator} (${moderator.user.tag})`) + .addField({ name: '**Action**', value: `${'Unlockdown'}` }) + .addField({ name: '**Moderator**', value: `${moderator} (${moderator.user.tag})` }) // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing - .addField('**Reason**', `${reason || '[No Reason Provided]'}`) - .addField( - `**Channel${channelsSuccessMap.size > 1 ? 's' : ''}**`, - channelsSuccessMap + .addField({ name: '**Reason**', value: `${reason || '[No Reason Provided]'}` }) + .addField({ + name: `**Channel${channelsSuccessMap.size > 1 ? 's' : ''}**`, + value: channelsSuccessMap .map((success, channel) => `<#${channel}> ${success ? util.emojis.success : util.emojis.error}`) .join('\n') - ); + }); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/guild/guildCreate.ts b/src/listeners/guild/guildCreate.ts index b8c6d89..2df3268 100644 --- a/src/listeners/guild/guildCreate.ts +++ b/src/listeners/guild/guildCreate.ts @@ -23,8 +23,8 @@ export default class GuildCreateListener extends BushListener { description: `${util.emojis.join} Joined ${util.format.input( guild.name )} with **${guild.memberCount?.toLocaleString()}** members. I am now in **${client.guilds.cache.size}** guilds.`, - timestamp: new Date(), - footer: { text: `${guild.id}`, iconURL: guild.iconURL() ?? undefined } + timestamp: new Date().toISOString(), + footer: { text: `${guild.id}`, icon_url: guild.iconURL() ?? undefined } } ] }); diff --git a/src/listeners/guild/guildDelete.ts b/src/listeners/guild/guildDelete.ts index c9070df..8284c02 100644 --- a/src/listeners/guild/guildDelete.ts +++ b/src/listeners/guild/guildDelete.ts @@ -21,8 +21,8 @@ export default class GuildDeleteListener extends BushListener { description: `${util.emojis.leave} Left ${util.format.input( guild.name )} with **${guild.memberCount?.toLocaleString()}** members. I am now in **${client.guilds.cache.size}** guilds.`, - timestamp: new Date(), - footer: { text: `${guild.id}`, iconURL: guild.iconURL() ?? undefined } + timestamp: new Date().toISOString(), + footer: { text: `${guild.id}`, icon_url: guild.iconURL() ?? undefined } } ] }); diff --git a/src/listeners/guild/guildMemberAdd.ts b/src/listeners/guild/guildMemberAdd.ts index 22961e9..262cde3 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 { MessageEmbed } from 'discord.js'; +import { Embed } from 'discord.js'; export default class GuildMemberAddListener extends BushListener { public constructor() { @@ -21,7 +21,7 @@ export default class GuildMemberAddListener extends BushListener { const welcome = client.channels.cache.get(welcomeChannel) as BushTextChannel | undefined; if (!welcome) return; if (member.guild.id !== welcome?.guild.id) throw new Error('Welcome channel must be in the guild.'); - const embed = new MessageEmbed() + const embed = new Embed() .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 323bd24..ac162f6 100644 --- a/src/listeners/guild/guildMemberRemove.ts +++ b/src/listeners/guild/guildMemberRemove.ts @@ -6,7 +6,7 @@ import { type BushTextChannel, type PartialBushGuildMember } from '#lib'; -import { MessageEmbed } from 'discord.js'; +import { Embed } from 'discord.js'; export default class GuildMemberRemoveListener extends BushListener { public constructor() { @@ -31,7 +31,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: MessageEmbed = new MessageEmbed() + const embed: Embed = new Embed() .setDescription( `${util.emojis.leave} ${util.format.input(user.tag)} ${ isBan ? 'got banned from' : 'left' diff --git a/src/listeners/member-custom/bushBan.ts b/src/listeners/member-custom/bushBan.ts index dfa3292..90b7c27 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 { GuildMember, MessageEmbed } from 'discord.js'; +import { Embed, GuildMember } from 'discord.js'; export default class BushBanListener extends BushListener { public constructor() { @@ -15,17 +15,17 @@ export default class BushBanListener extends BushListener { if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; - const logEmbed = new MessageEmbed() + const logEmbed = new Embed() .setColor(util.colors.discord.RED) .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ format: 'png', size: 4096 }) ?? undefined }) - .addField('**Action**', `${duration ? 'Temp Ban' : 'Perm Ban'}`) - .addField('**User**', `${user} (${user.tag})`) - .addField('**Moderator**', `${moderator} (${moderator.tag})`) - .addField('**Reason**', `${reason ? reason : '[No Reason Provided]'}`); - if (duration) logEmbed.addField('**Duration**', util.humanizeDuration(duration)); - if (dmSuccess === false) logEmbed.addField('**Additional Info**', 'Could not dm user.'); + .addField({ name: '**Action**', value: `${duration ? 'Temp Ban' : 'Perm Ban'}` }) + .addField({ name: '**User**', value: `${user} (${user.tag})` }) + .addField({ name: '**Moderator**', value: `${moderator} (${moderator.tag})` }) + .addField({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }); + if (duration) logEmbed.addField({ name: '**Duration**', value: util.humanizeDuration(duration) }); + if (dmSuccess === false) logEmbed.addField({ name: '**Additional Info**', value: 'Could not dm user.' }); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/member-custom/bushBlock.ts b/src/listeners/member-custom/bushBlock.ts index 6151f9d..d29261b 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 { GuildMember, MessageEmbed } from 'discord.js'; +import { Embed, GuildMember } from 'discord.js'; export default class BushBlockListener extends BushListener { public constructor() { @@ -17,19 +17,19 @@ export default class BushBlockListener extends BushListener { if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; - const logEmbed = new MessageEmbed() + const logEmbed = new Embed() .setColor(util.colors.discord.PURPLE) .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ format: 'png', size: 4096 }) ?? undefined }) - .addField('**Action**', `${duration ? 'Temp Block' : 'Perm Block'}`) - .addField('**Channel**', `<#${channel.id}>`) - .addField('**User**', `${user} (${user.tag})`) - .addField('**Moderator**', `${moderator} (${moderator.tag})`) - .addField('**Reason**', `${reason ? reason : '[No Reason Provided]'}`); + .addField({ name: '**Action**', value: `${duration ? 'Temp Block' : 'Perm Block'}` }) + .addField({ name: '**Channel**', value: `<#${channel.id}>` }) + .addField({ name: '**User**', value: `${user} (${user.tag})` }) + .addField({ name: '**Moderator**', value: `${moderator} (${moderator.tag})` }) + .addField({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }); - if (duration) logEmbed.addField('**Duration**', `${util.humanizeDuration(duration) || duration}`); - if (dmSuccess === false) logEmbed.addField('**Additional Info**', 'Could not dm user.'); + if (duration) logEmbed.addField({ name: '**Duration**', value: `${util.humanizeDuration(duration) || duration}` }); + if (dmSuccess === false) logEmbed.addField({ name: '**Additional Info**', value: 'Could not dm user.' }); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/member-custom/bushKick.ts b/src/listeners/member-custom/bushKick.ts index 0e1d305..9d309ac 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 { GuildMember, MessageEmbed } from 'discord.js'; +import { Embed, GuildMember } from 'discord.js'; export default class BushKickListener extends BushListener { public constructor() { @@ -15,16 +15,16 @@ export default class BushKickListener extends BushListener { if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; - const logEmbed = new MessageEmbed() + const logEmbed = new Embed() .setColor(util.colors.discord.RED) .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ format: 'png', size: 4096 }) ?? undefined }) - .addField('**Action**', `${'Kick'}`) - .addField('**User**', `${user} (${user.tag})`) - .addField('**Moderator**', `${moderator} (${moderator.tag})`) - .addField('**Reason**', `${reason ? reason : '[No Reason Provided]'}`); - if (dmSuccess === false) logEmbed.addField('**Additional Info**', 'Could not dm user.'); + .addField({ name: '**Action**', value: `${'Kick'}` }) + .addField({ name: '**User**', value: `${user} (${user.tag})` }) + .addField({ name: '**Moderator**', value: `${moderator} (${moderator.tag})` }) + .addField({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }); + if (dmSuccess === false) logEmbed.addField({ name: '**Additional Info**', value: 'Could not dm user.' }); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/member-custom/bushMute.ts b/src/listeners/member-custom/bushMute.ts index 53542a5..25146a2 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 { GuildMember, MessageEmbed } from 'discord.js'; +import { Embed, GuildMember } from 'discord.js'; export default class BushMuteListener extends BushListener { public constructor() { @@ -15,17 +15,17 @@ export default class BushMuteListener extends BushListener { if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; - const logEmbed = new MessageEmbed() + const logEmbed = new Embed() .setColor(util.colors.discord.ORANGE) .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ format: 'png', size: 4096 }) ?? undefined }) - .addField('**Action**', `${duration ? 'Temp Mute' : 'Perm Mute'}`) - .addField('**User**', `${user} (${user.tag})`) - .addField('**Moderator**', `${moderator} (${moderator.tag})`) - .addField('**Reason**', `${reason ? reason : '[No Reason Provided]'}`); - if (duration) logEmbed.addField('**Duration**', `${util.humanizeDuration(duration) || duration}`); - if (dmSuccess === false) logEmbed.addField('**Additional Info**', 'Could not dm user.'); + .addField({ name: '**Action**', value: `${duration ? 'Temp Mute' : 'Perm Mute'}` }) + .addField({ name: '**User**', value: `${user} (${user.tag})` }) + .addField({ name: '**Moderator**', value: `${moderator} (${moderator.tag})` }) + .addField({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }); + if (duration) logEmbed.addField({ name: '**Duration**', value: `${util.humanizeDuration(duration) || duration}` }); + if (dmSuccess === false) logEmbed.addField({ name: '**Additional Info**', value: 'Could not dm user.' }); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/member-custom/bushPunishRole.ts b/src/listeners/member-custom/bushPunishRole.ts index 0a066d9..cbcc925 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 { GuildMember, MessageEmbed } from 'discord.js'; +import { Embed, GuildMember } from 'discord.js'; export default class BushPunishRoleListener extends BushListener { public constructor() { @@ -15,16 +15,16 @@ export default class BushPunishRoleListener extends BushListener { if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; - const logEmbed = new MessageEmbed() + const logEmbed = new Embed() .setColor(util.colors.discord.YELLOW) .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ format: 'png', size: 4096 }) ?? undefined }) - .addField('**Action**', `${duration ? 'Temp Punishment Role' : 'Perm Punishment Role'}`) - .addField('**User**', `${user} (${user.tag})`) - .addField('**Moderator**', `${moderator} (${moderator.tag})`) - .addField('**Reason**', `${reason ? reason : '[No Reason Provided]'}`); - if (duration) logEmbed.addField('**Duration**', util.humanizeDuration(duration)); + .addField({ name: '**Action**', value: `${duration ? 'Temp Punishment Role' : 'Perm Punishment Role'}` }) + .addField({ name: '**User**', value: `${user} (${user.tag})` }) + .addField({ name: '**Moderator**', value: `${moderator} (${moderator.tag})` }) + .addField({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }); + if (duration) logEmbed.addField({ name: '**Duration**', value: util.humanizeDuration(duration) }); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/member-custom/bushPunishRoleRemove.ts b/src/listeners/member-custom/bushPunishRoleRemove.ts index fe81d19..c68e8d5 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 { GuildMember, MessageEmbed } from 'discord.js'; +import { Embed, GuildMember } from 'discord.js'; export default class BushPunishRoleRemoveListener extends BushListener { public constructor() { @@ -15,16 +15,16 @@ export default class BushPunishRoleRemoveListener extends BushListener { if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; - const logEmbed = new MessageEmbed() + const logEmbed = new Embed() .setColor(util.colors.discord.GREEN) .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ format: 'png', size: 4096 }) ?? undefined }) - .addField('**Action**', `${'Remove Punishment Role'}`) - .addField('**Role**', `${role}`) - .addField('**User**', `${user} (${user.tag})`) - .addField('**Moderator**', `${moderator} (${moderator.tag})`) - .addField('**Reason**', `${reason ? reason : '[No Reason Provided]'}`); + .addField({ name: '**Action**', value: `${'Remove Punishment Role'}` }) + .addField({ name: '**Role**', value: `${role}` }) + .addField({ name: '**User**', value: `${user} (${user.tag})` }) + .addField({ name: '**Moderator**', value: `${moderator} (${moderator.tag})` }) + .addField({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }); return await logChannel.send({ embeds: [logEmbed] }); } diff --git a/src/listeners/member-custom/bushPurge.ts b/src/listeners/member-custom/bushPurge.ts index 355569b..e3a43af 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 { MessageEmbed } from 'discord.js'; +import { Embed } from 'discord.js'; export default class BushPurgeListener extends BushListener { public constructor() { @@ -23,18 +23,20 @@ export default class BushPurgeListener extends BushListener { })); const haste = await util.inspectCleanRedactHaste(mappedMessages); - const logEmbed = new MessageEmbed() + const logEmbed = new Embed() .setColor(util.colors.discord.DARK_PURPLE) .setTimestamp() .setFooter({ text: `${messages.size.toLocaleString()} Messages` }) .setAuthor({ name: moderator.tag, iconURL: moderator.avatarURL({ format: 'png', size: 4096 }) ?? undefined }) - .addField('**Action**', `${'Purge'}`) - .addField('**Moderator**', `${moderator} (${moderator.tag})`) - .addField('**Channel**', `<#${channel.id}> (${channel.name})`) - .addField( - '**Messages**', - `${haste.url ? `[haste](${haste.url})${haste.error ? `- ${haste.error}` : ''}` : `${util.emojis.error} ${haste.error}`}` - ); + .addField({ name: '**Action**', value: `${'Purge'}` }) + .addField({ name: '**Moderator**', value: `${moderator} (${moderator.tag})` }) + .addField({ name: '**Channel**', value: `<#${channel.id}> (${channel.name})` }) + .addField({ + name: '**Messages**', + value: `${ + haste.url ? `[haste](${haste.url})${haste.error ? `- ${haste.error}` : ''}` : `${util.emojis.error} ${haste.error}` + }` + }); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/member-custom/bushRemoveTimeout.ts b/src/listeners/member-custom/bushRemoveTimeout.ts index af56dac..820a3b7 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 { GuildMember, MessageEmbed } from 'discord.js'; +import { Embed, GuildMember } from 'discord.js'; export default class BushRemoveTimeoutListener extends BushListener { public constructor() { @@ -15,16 +15,16 @@ export default class BushRemoveTimeoutListener extends BushListener { if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; - const logEmbed = new MessageEmbed() + const logEmbed = new Embed() .setColor(util.colors.discord.GREEN) .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ format: 'png', size: 4096 }) ?? undefined }) - .addField('**Action**', `${'Remove Timeout'}`) - .addField('**User**', `${user} (${user.tag})`) - .addField('**Moderator**', `${moderator} (${moderator.tag})`) - .addField('**Reason**', `${reason ? reason : '[No Reason Provided]'}`); - if (dmSuccess === false) logEmbed.addField('**Additional Info**', 'Could not dm user.'); + .addField({ name: '**Action**', value: `${'Remove Timeout'}` }) + .addField({ name: '**User**', value: `${user} (${user.tag})` }) + .addField({ name: '**Moderator**', value: `${moderator} (${moderator.tag})` }) + .addField({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }); + if (dmSuccess === false) logEmbed.addField({ name: '**Additional Info**', value: 'Could not dm user.' }); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/member-custom/bushTimeout.ts b/src/listeners/member-custom/bushTimeout.ts index 0ec76bf..79fd739 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 { GuildMember, MessageEmbed } from 'discord.js'; +import { Embed, GuildMember } from 'discord.js'; export default class BushTimeoutListener extends BushListener { public constructor() { @@ -17,17 +17,17 @@ export default class BushTimeoutListener extends BushListener { if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; - const logEmbed = new MessageEmbed() + const logEmbed = new Embed() .setColor(util.colors.discord.ORANGE) .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ format: 'png', size: 4096 }) ?? undefined }) - .addField('**Action**', `${'Timeout'}`) - .addField('**User**', `${user} (${user.tag})`) - .addField('**Moderator**', `${moderator} (${moderator.tag})`) - .addField('**Reason**', `${reason ? reason : '[No Reason Provided]'}`) - .addField('**Duration**', `${util.humanizeDuration(duration) || duration}`); - if (dmSuccess === false) logEmbed.addField('**Additional Info**', 'Could not dm user.'); + .addField({ name: '**Action**', value: `${'Timeout'}` }) + .addField({ name: '**User**', value: `${user} (${user.tag})` }) + .addField({ name: '**Moderator**', value: `${moderator} (${moderator.tag})` }) + .addField({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }) + .addField({ name: '**Duration**', value: `${util.humanizeDuration(duration) || duration}` }); + if (dmSuccess === false) logEmbed.addField({ name: '**Additional Info**', value: 'Could not dm user.' }); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/member-custom/bushUnban.ts b/src/listeners/member-custom/bushUnban.ts index 7f3f812..b7f6346 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 { GuildMember, MessageEmbed } from 'discord.js'; +import { Embed, GuildMember } from 'discord.js'; export default class BushUnbanListener extends BushListener { public constructor() { @@ -15,16 +15,16 @@ export default class BushUnbanListener extends BushListener { if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; - const logEmbed = new MessageEmbed() + const logEmbed = new Embed() .setColor(util.colors.discord.GREEN) .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ format: 'png', size: 4096 }) ?? undefined }) - .addField('**Action**', `${'Unban'}`) - .addField('**User**', `${user} (${user.tag})`) - .addField('**Moderator**', `${moderator} (${moderator.tag})`) - .addField('**Reason**', `${reason ? reason : '[No Reason Provided]'}`); - if (dmSuccess === false) logEmbed.addField('**Additional Info**', 'Could not dm user.'); + .addField({ name: '**Action**', value: `${'Unban'}` }) + .addField({ name: '**User**', value: `${user} (${user.tag})` }) + .addField({ name: '**Moderator**', value: `${moderator} (${moderator.tag})` }) + .addField({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }); + if (dmSuccess === false) logEmbed.addField({ name: '**Additional Info**', value: 'Could not dm user.' }); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/member-custom/bushUnblock.ts b/src/listeners/member-custom/bushUnblock.ts index 6be1888..580a424 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 { GuildMember, MessageEmbed } from 'discord.js'; +import { Embed, GuildMember } from 'discord.js'; export default class BushUnblockListener extends BushListener { public constructor() { @@ -15,17 +15,17 @@ export default class BushUnblockListener extends BushListener { if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; - const logEmbed = new MessageEmbed() + const logEmbed = new Embed() .setColor(util.colors.discord.GREEN) .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ format: 'png', size: 4096 }) ?? undefined }) - .addField('**Action**', `${'Unblock'}`) - .addField('**Channel**', `<#${channel.id}>`) - .addField('**User**', `${user} (${user.tag})`) - .addField('**Moderator**', `${moderator} (${moderator.tag})`) - .addField('**Reason**', `${reason ? reason : '[No Reason Provided]'}`); - if (dmSuccess === false) logEmbed.addField('**Additional Info**', 'Could not dm user.'); + .addField({ name: '**Action**', value: `${'Unblock'}` }) + .addField({ name: '**Channel**', value: `<#${channel.id}>` }) + .addField({ name: '**User**', value: `${user} (${user.tag})` }) + .addField({ name: '**Moderator**', value: `${moderator} (${moderator.tag})` }) + .addField({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }); + if (dmSuccess === false) logEmbed.addField({ name: '**Additional Info**', value: 'Could not dm user.' }); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/member-custom/bushUnmute.ts b/src/listeners/member-custom/bushUnmute.ts index 2ed5104..19c9a74 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 { GuildMember, MessageEmbed } from 'discord.js'; +import { Embed, GuildMember } from 'discord.js'; export default class BushUnmuteListener extends BushListener { public constructor() { @@ -15,16 +15,16 @@ export default class BushUnmuteListener extends BushListener { if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; - const logEmbed = new MessageEmbed() + const logEmbed = new Embed() .setColor(util.colors.discord.GREEN) .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ format: 'png', size: 4096 }) ?? undefined }) - .addField('**Action**', `${'Unmute'}`) - .addField('**User**', `${user} (${user.tag})`) - .addField('**Moderator**', `${moderator} (${moderator.tag})`) - .addField('**Reason**', `${reason ? reason : '[No Reason Provided]'}`); - if (dmSuccess === false) logEmbed.addField('**Additional Info**', 'Could not dm user.'); + .addField({ name: '**Action**', value: `${'Unmute'}` }) + .addField({ name: '**User**', value: `${user} (${user.tag})` }) + .addField({ name: '**Moderator**', value: `${moderator} (${moderator.tag})` }) + .addField({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }); + if (dmSuccess === false) logEmbed.addField({ name: '**Additional Info**', value: 'Could not dm user.' }); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/member-custom/bushUpdateModlog.ts b/src/listeners/member-custom/bushUpdateModlog.ts index 065ec7e..86782f6 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 { MessageEmbed } from 'discord.js'; +import { Embed } from 'discord.js'; export default class BushUpdateModlogListener extends BushListener { public constructor() { @@ -14,19 +14,19 @@ export default class BushUpdateModlogListener extends BushListener { const logChannel = await moderator.guild.getLogChannel('moderation'); if (!logChannel) return; - const logEmbed = new MessageEmbed() + const logEmbed = new Embed() .setColor(util.colors.discord.BLURPLE) .setTimestamp() .setAuthor({ name: moderator.user.tag, iconURL: moderator.user.avatarURL({ format: 'png', size: 4096 }) ?? undefined }) - .addField('**Action**', `${'Update Modlog'}`) - .addField('**Moderator**', `${moderator} (${moderator.user.tag})`) - .addField('**ModLog Changed**', modlogID) - .addField('**Value Changed**', key) - .addField('**Old Value**', await util.inspectCleanRedactCodeblock(oldModlog, undefined, undefined, 1024)) - .addField('**New Value**', await util.inspectCleanRedactCodeblock(newModlog, undefined, undefined, 1024)); + .addField({ name: '**Action**', value: `${'Update Modlog'}` }) + .addField({ name: '**Moderator**', value: `${moderator} (${moderator.user.tag})` }) + .addField({ name: '**ModLog Changed**', value: modlogID }) + .addField({ name: '**Value Changed**', value: key }) + .addField({ name: '**Old Value**', value: await util.inspectCleanRedactCodeblock(oldModlog, undefined, undefined, 1024) }) + .addField({ name: '**New Value**', value: await util.inspectCleanRedactCodeblock(newModlog, undefined, undefined, 1024) }); return await logChannel.send({ embeds: [logEmbed] }); } diff --git a/src/listeners/member-custom/bushUpdateSettings.ts b/src/listeners/member-custom/bushUpdateSettings.ts index 49f0aec..518f7b6 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 { MessageEmbed } from 'discord.js'; +import { Embed } from 'discord.js'; export default class BushUpdateSettingsListener extends BushListener { public constructor() { @@ -14,19 +14,19 @@ export default class BushUpdateSettingsListener extends BushListener { const logChannel = await guild.getLogChannel('moderation'); if (!logChannel) return; - const logEmbed = new MessageEmbed().setColor(util.colors.discord.BLURPLE).setTimestamp(); + const logEmbed = new Embed().setColor(util.colors.discord.BLURPLE).setTimestamp(); if (moderator) logEmbed.setAuthor({ name: moderator.user.tag, iconURL: moderator.user.avatarURL({ format: 'png', size: 4096 }) ?? undefined }); - logEmbed.addField('**Action**', `${'Update Settings'}`); - if (moderator) logEmbed.addField('**Moderator**', `${moderator} (${moderator.user.tag})`); + logEmbed.addField({ name: '**Action**', value: `${'Update Settings'}` }); + if (moderator) logEmbed.addField({ name: '**Moderator**', value: `${moderator} (${moderator.user.tag})` }); logEmbed - .addField('**Setting Changed**', setting) - .addField('**Old Value**', await util.inspectCleanRedactCodeblock(oldSettings, 'js', undefined, 1024)) - .addField('**New Value**', await util.inspectCleanRedactCodeblock(newSettings, 'js', undefined, 1024)); + .addField({ name: '**Setting Changed**', value: setting }) + .addField({ name: '**Old Value**', value: await util.inspectCleanRedactCodeblock(oldSettings, 'js', undefined, 1024) }) + .addField({ name: '**New Value**', value: await util.inspectCleanRedactCodeblock(newSettings, 'js', undefined, 1024) }); return await logChannel.send({ embeds: [logEmbed] }); } diff --git a/src/listeners/member-custom/bushWarn.ts b/src/listeners/member-custom/bushWarn.ts index 61ab2e1..a4e71a8 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 { GuildMember, MessageEmbed } from 'discord.js'; +import { Embed, GuildMember } from 'discord.js'; export default class BushWarnListener extends BushListener { public constructor() { @@ -15,16 +15,16 @@ export default class BushWarnListener extends BushListener { if (!logChannel) return; const user = victim instanceof GuildMember ? victim.user : victim; - const logEmbed = new MessageEmbed() + const logEmbed = new Embed() .setColor(util.colors.discord.YELLOW) .setTimestamp() .setFooter({ text: `CaseID: ${caseID}` }) .setAuthor({ name: user.tag, iconURL: user.avatarURL({ format: 'png', size: 4096 }) ?? undefined }) - .addField('**Action**', `${'Warn'}`) - .addField('**User**', `${user} (${user.tag})`) - .addField('**Moderator**', `${moderator} (${moderator.tag})`) - .addField('**Reason**', `${reason ? reason : '[No Reason Provided]'}`); - if (dmSuccess === false) logEmbed.addField('**Additional Info**', 'Could not dm user.'); + .addField({ name: '**Action**', value: `${'Warn'}` }) + .addField({ name: '**User**', value: `${user} (${user.tag})` }) + .addField({ name: '**Moderator**', value: `${moderator} (${moderator.tag})` }) + .addField({ name: '**Reason**', value: `${reason ? reason : '[No Reason Provided]'}` }); + if (dmSuccess === false) logEmbed.addField({ name: '**Additional Info**', value: 'Could not dm user.' }); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/message/autoThread.ts b/src/listeners/message/autoThread.ts index 77ff33c..b753dc3 100644 --- a/src/listeners/message/autoThread.ts +++ b/src/listeners/message/autoThread.ts @@ -1,5 +1,5 @@ import { BushListener, type BushClientEvents, type BushTextChannel } from '#lib'; -import { GuildTextBasedChannel, MessageEmbed, MessageType, Permissions } from 'discord.js'; +import { Embed, GuildTextBasedChannel, MessageType, Permissions } from 'discord.js'; export default class autoThreadListener extends BushListener { public constructor() { @@ -45,12 +45,12 @@ export default class autoThreadListener extends BushListener { }) .catch(() => null); if (!thread) return; - const embed = new MessageEmbed() + const embed = new Embed() .setTitle('NotEnoughUpdates Support') .setDescription( `Welcome to Moulberry Bush Support:tm:\n\nPlease make sure you have the latest version found in <#693586404256645231>.\nAdditionally if you need help installing the mod be sure to read <#737444942724726915> for a guide on how to do so.` ) - .setColor('BLURPLE'); + .setColor(client.consts.colors.discord.BLURPLE); void thread .send({ embeds: [embed] }) .then(() => diff --git a/src/listeners/message/blacklistedFile.ts b/src/listeners/message/blacklistedFile.ts index 9d52ab0..38803f5 100644 --- a/src/listeners/message/blacklistedFile.ts +++ b/src/listeners/message/blacklistedFile.ts @@ -68,9 +68,9 @@ 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 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; + if (message.attachments.size + /* embedAttachments.length + */ foundEmojis.length < 1) return; const foundFiles = [] as { name: string; hash: string[]; @@ -90,7 +90,7 @@ export default class BlacklistedFileListener extends BushListener { continue; } } - for (const attachment of embedAttachments) { + /* for (const attachment of embedAttachments) { try { const req = await got.get(attachment.url!); const rawHash = crypto.createHash('md5'); @@ -103,7 +103,7 @@ export default class BlacklistedFileListener extends BushListener { } catch { continue; } - } + } */ for (const attachment of foundEmojis) { try { const req = await got.get( diff --git a/src/listeners/message/directMessage.ts b/src/listeners/message/directMessage.ts index dfc9222..c333e22 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, MessageEmbed } from 'discord.js'; +import { ChannelType, Embed } 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 MessageEmbed().setTimestamp().setFooter({ text: `User ID • ${message.channel.recipient.id}` }); + const dmLogEmbed = new Embed().setTimestamp().setFooter({ text: `User ID • ${message.channel.recipient.id}` }); if (message.author.id != client.user!.id) { dmLogEmbed @@ -37,7 +37,7 @@ export default class DirectMessageListener extends BushListener { if (message.attachments.filter((a) => typeof a.size == 'number').size == 1) { dmLogEmbed.setImage(message.attachments.filter((a) => typeof a.size == 'number').first()!.proxyURL); } else if (message.attachments.size > 0) { - dmLogEmbed.addField('Attachments', message.attachments.map((a) => a.proxyURL).join('\n')); + dmLogEmbed.addField({ name: 'Attachments', value: message.attachments.map((a) => a.proxyURL).join('\n') }); } const dmChannel = await util.getConfigChannel('dm'); await dmChannel.send({ embeds: [dmLogEmbed] }); diff --git a/src/listeners/other/consoleListener.ts b/src/listeners/other/consoleListener.ts index 5a3e4e4..46f869f 100644 --- a/src/listeners/other/consoleListener.ts +++ b/src/listeners/other/consoleListener.ts @@ -28,7 +28,7 @@ export default class ConsoleListener extends BushListener { ButtonComponent, MessageCollector, InteractionCollector, - MessageEmbed, + Embed, SelectMenuComponent, ReactionCollector, Util, diff --git a/src/listeners/track-manual-punishments/modlogSyncBan.ts b/src/listeners/track-manual-punishments/modlogSyncBan.ts index 03024d8..7625357 100644 --- a/src/listeners/track-manual-punishments/modlogSyncBan.ts +++ b/src/listeners/track-manual-punishments/modlogSyncBan.ts @@ -1,6 +1,6 @@ import { BushListener, BushUser, Moderation, ModLogType, type BushClientEvents } from '#lib'; import { AuditLogEvent } from 'discord-api-types'; -import { MessageEmbed, Permissions } from 'discord.js'; +import { Embed, Permissions } from 'discord.js'; export default class ModlogSyncBanListener extends BushListener { public constructor() { @@ -51,7 +51,7 @@ export default class ModlogSyncBanListener extends BushListener { const logChannel = await ban.guild.getLogChannel('moderation'); if (!logChannel) return; - const logEmbed = new MessageEmbed() + const logEmbed = new Embed() .setColor(util.colors.discord.RED) .setTimestamp() .setFooter({ text: `CaseID: ${log.id}` }) @@ -59,10 +59,10 @@ export default class ModlogSyncBanListener extends BushListener { name: ban.user.tag, iconURL: ban.user.avatarURL({ format: 'png', size: 4096 }) ?? undefined }) - .addField('**Action**', `${'Manual Ban'}`) - .addField('**User**', `${ban.user} (${ban.user.tag})`) - .addField('**Moderator**', `${first.executor} (${first.executor.tag})`) - .addField('**Reason**', `${first.reason ? first.reason : '[No Reason Provided]'}`); + .addField({ name: '**Action**', value: `${'Manual Ban'}` }) + .addField({ name: '**User**', value: `${ban.user} (${ban.user.tag})` }) + .addField({ name: '**Moderator**', value: `${first.executor} (${first.executor.tag})` }) + .addField({ name: '**Reason**', value: `${first.reason ? first.reason : '[No Reason Provided]'}` }); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/track-manual-punishments/modlogSyncKick.ts b/src/listeners/track-manual-punishments/modlogSyncKick.ts index 9ea6a9d..a369618 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, type BushClientEvents } from '#lib'; import { AuditLogEvent } from 'discord-api-types'; -import { MessageEmbed, Permissions } from 'discord.js'; +import { Embed, Permissions } 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 MessageEmbed() + const logEmbed = new Embed() .setColor(util.colors.discord.RED) .setTimestamp() .setFooter({ text: `CaseID: ${log.id}` }) @@ -59,10 +59,10 @@ export default class ModlogSyncKickListener extends BushListener { name: member.user.tag, iconURL: member.user.avatarURL({ format: 'png', size: 4096 }) ?? undefined }) - .addField('**Action**', `${'Manual Kick'}`) - .addField('**User**', `${member.user} (${member.user.tag})`) - .addField('**Moderator**', `${first.executor} (${first.executor.tag})`) - .addField('**Reason**', `${first.reason ? first.reason : '[No Reason Provided]'}`); + .addField({ name: '**Action**', value: `${'Manual Kick'}` }) + .addField({ name: '**User**', value: `${member.user} (${member.user.tag})` }) + .addField({ name: '**Moderator**', value: `${first.executor} (${first.executor.tag})` }) + .addField({ name: '**Reason**', value: `${first.reason ? first.reason : '[No Reason Provided]'}` }); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/track-manual-punishments/modlogSyncTimeout.ts b/src/listeners/track-manual-punishments/modlogSyncTimeout.ts index 9b67f43..dd9391a 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, type BushClientEvents } from '#lib'; import { AuditLogEvent } from 'discord-api-types'; -import { MessageEmbed, Permissions } from 'discord.js'; +import { Embed, Permissions } 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 MessageEmbed() + const logEmbed = new Embed() .setColor(util.colors.discord[newTime ? 'ORANGE' : 'GREEN']) .setTimestamp() .setFooter({ text: `CaseID: ${log.id}` }) @@ -64,10 +64,10 @@ export default class ModlogSyncTimeoutListener extends BushListener { name: newMember.user.tag, iconURL: newMember.user.avatarURL({ format: 'png', size: 4096 }) ?? undefined }) - .addField('**Action**', `${newTime ? 'Manual Timeout' : 'Manual Remove Timeout'}`) - .addField('**User**', `${newMember.user} (${newMember.user.tag})`) - .addField('**Moderator**', `${first.executor} (${first.executor.tag})`) - .addField('**Reason**', `${first.reason ? first.reason : '[No Reason Provided]'}`); + .addField({ name: '**Action**', value: `${newTime ? 'Manual Timeout' : 'Manual Remove Timeout'}` }) + .addField({ name: '**User**', value: `${newMember.user} (${newMember.user.tag})` }) + .addField({ name: '**Moderator**', value: `${first.executor} (${first.executor.tag})` }) + .addField({ name: '**Reason**', value: `${first.reason ? first.reason : '[No Reason Provided]'}` }); return await logChannel.send({ embeds: [logEmbed] }); } } diff --git a/src/listeners/track-manual-punishments/modlogSyncUnban.ts b/src/listeners/track-manual-punishments/modlogSyncUnban.ts index 7cdecb0..84887e3 100644 --- a/src/listeners/track-manual-punishments/modlogSyncUnban.ts +++ b/src/listeners/track-manual-punishments/modlogSyncUnban.ts @@ -1,6 +1,6 @@ import { BushListener, BushUser, Moderation, ModLogType, type BushClientEvents } from '#lib'; import { AuditLogEvent } from 'discord-api-types'; -import { MessageEmbed, Permissions } from 'discord.js'; +import { Embed, Permissions } from 'discord.js'; export default class ModlogSyncUnbanListener extends BushListener { public constructor() { @@ -50,7 +50,7 @@ export default class ModlogSyncUnbanListener extends BushListener { const logChannel = await ban.guild.getLogChannel('moderation'); if (!logChannel) return; - const logEmbed = new MessageEmbed() + const logEmbed = new Embed() .setColor(util.colors.discord.ORANGE) .setTimestamp() .setFooter({ text: `CaseID: ${log.id}` }) @@ -58,10 +58,10 @@ export default class ModlogSyncUnbanListener extends BushListener { name: ban.user.tag, iconURL: ban.user.avatarURL({ format: 'png', size: 4096 }) ?? undefined }) - .addField('**Action**', `${'Manual Unban'}`) - .addField('**User**', `${ban.user} (${ban.user.tag})`) - .addField('**Moderator**', `${first.executor} (${first.executor.tag})`) - .addField('**Reason**', `${first.reason ? first.reason : '[No Reason Provided]'}`); + .addField({ name: '**Action**', value: `${'Manual Unban'}` }) + .addField({ name: '**User**', value: `${ban.user} (${ban.user.tag})` }) + .addField({ name: '**Moderator**', value: `${first.executor} (${first.executor.tag})` }) + .addField({ name: '**Reason**', value: `${first.reason ? first.reason : '[No Reason Provided]'}` }); return await logChannel.send({ embeds: [logEmbed] }); } } |