From 840cca672d681c36f980a06fb79a4e2c01bd69ac Mon Sep 17 00:00:00 2001 From: IRONM00N <64110067+IRONM00N@users.noreply.github.com> Date: Tue, 25 Jan 2022 23:47:40 -0500 Subject: I love breaking changes!!!! --- src/commands/moulberry-bush/capePermissions.ts | 4 ++-- src/commands/moulberry-bush/capes.ts | 9 +++++---- src/commands/moulberry-bush/moulHammer.ts | 4 ++-- src/commands/moulberry-bush/report.ts | 26 +++++++++++++------------- src/commands/moulberry-bush/rule.ts | 10 +++++----- src/commands/moulberry-bush/serverStatus.ts | 15 ++++++++------- 6 files changed, 35 insertions(+), 33 deletions(-) (limited to 'src/commands/moulberry-bush') 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) ] }); -- cgit