moved to d.js 14.3.0, started fixing errors
Co-authored-by: PineappleFan <pineapplefanyt@gmail.com>
diff --git a/src/utils/confirmationMessage.ts b/src/utils/confirmationMessage.ts
index c805395..18e6ea0 100644
--- a/src/utils/confirmationMessage.ts
+++ b/src/utils/confirmationMessage.ts
@@ -2,11 +2,12 @@
CommandInteraction,
Interaction,
Message,
- MessageActionRow,
- MessageButton,
+ ActionRowBuilder,
+ ButtonBuilder,
MessageComponentInteraction,
ModalSubmitInteraction,
- TextInputComponent
+ TextInputComponent,
+ ButtonStyle
} from "discord.js";
import { modalInteractionCollector } from "./dualCollector.js";
import EmojiEmbed from "./generateEmojiEmbed.js";
@@ -97,38 +98,38 @@
while (!cancelled && success === undefined && !returnComponents && !newReason) {
const fullComponents = [
- new Discord.MessageButton()
+ new Discord.ButtonBuilder()
.setCustomId("yes")
.setLabel("Confirm")
- .setStyle(this.inverted ? "SUCCESS" : "DANGER")
+ .setStyle(this.inverted ? ButtonStyle.Success : ButtonStyle.Danger)
.setEmoji(getEmojiByName("CONTROL.TICK", "id")),
- new Discord.MessageButton()
+ new Discord.ButtonBuilder()
.setCustomId("no")
.setLabel("Cancel")
- .setStyle("SECONDARY")
+ .setStyle(ButtonStyle.Secondary)
.setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
];
Object.entries(this.customButtons).forEach(([k, v]) => {
- const button = new Discord.MessageButton()
+ const button = new Discord.ButtonBuilder()
.setCustomId(k)
.setLabel(v.title)
- .setStyle(v.active ? "SUCCESS" : "PRIMARY")
+ .setStyle(v.active ? ButtonStyle.Success : ButtonStyle.Primary)
.setDisabled(v.disabled);
if (v.emoji !== undefined) button.setEmoji(getEmojiByName(v.emoji, "id"));
fullComponents.push(button);
});
if (this.reason !== null)
fullComponents.push(
- new Discord.MessageButton()
+ new Discord.ButtonBuilder()
.setCustomId("reason")
.setLabel("Edit Reason")
- .setStyle("PRIMARY")
+ .setStyle(ButtonStyle.Primary)
.setEmoji(getEmojiByName("ICONS.EDIT", "id"))
.setDisabled(false)
);
const components = [];
for (let i = 0; i < fullComponents.length; i += 5) {
- components.push(new MessageActionRow().addComponents(fullComponents.slice(i, i + 5)));
+ components.push(new ActionRowBuilder().addComponents(fullComponents.slice(i, i + 5)));
}
const object = {
embeds: [
@@ -197,7 +198,7 @@
.setCustomId("modal")
.setTitle("Editing reason")
.addComponents(
- new MessageActionRow<TextInputComponent>().addComponents(
+ new ActionRowBuilder<TextInputComponent>().addComponents(
new TextInputComponent()
.setCustomId("reason")
.setLabel("Reason")
@@ -218,11 +219,11 @@
.setEmoji(this.emoji)
],
components: [
- new MessageActionRow().addComponents([
- new MessageButton()
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder()
.setLabel("Back")
.setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
- .setStyle("PRIMARY")
+ .setStyle(ButtonStyle.Primary)
.setCustomId("back")
])
]
diff --git a/src/utils/generateEmojiEmbed.ts b/src/utils/generateEmojiEmbed.ts
index 69058ae..a7926df 100644
--- a/src/utils/generateEmojiEmbed.ts
+++ b/src/utils/generateEmojiEmbed.ts
@@ -1,4 +1,4 @@
-import { MessageEmbed } from "discord.js";
+import { EmbedBuilder } from "discord.js";
import getEmojiByName from "./getEmojiByName.js";
const colors = {
@@ -7,7 +7,7 @@
Success: 0x68d49e
};
-class EmojiEmbed extends MessageEmbed {
+class EmojiEmbed extends EmbedBuilder {
_title = "";
_emoji: string | null = null;
@@ -18,10 +18,6 @@
return `${getEmojiByName(this._emoji)} ${this._title}`;
}
- override set title(title: string) {
- this._title = title;
- }
-
override setTitle(title: string) {
this._title = title;
return this;
diff --git a/src/utils/log.ts b/src/utils/log.ts
index d831a4b..e4ac4cd 100644
--- a/src/utils/log.ts
+++ b/src/utils/log.ts
@@ -75,7 +75,7 @@
});
if (channel) {
log.separate = log.separate || {};
- const embed = new Discord.MessageEmbed()
+ const embed = new Discord.EmbedBuilder()
.setTitle(`${getEmojiByName(log.meta.emoji)} ${log.meta.displayName}`)
.setDescription(
(log.separate.start ? log.separate.start + "\n" : "") +