moved to d.js 14.3.0, started fixing errors
Co-authored-by: PineappleFan <pineapplefanyt@gmail.com>
diff --git a/src/reflex/guide.ts b/src/reflex/guide.ts
index 4e7703c..842951c 100644
--- a/src/reflex/guide.ts
+++ b/src/reflex/guide.ts
@@ -1,30 +1,31 @@
import { LoadingEmbed } from "./../utils/defaultEmbeds.js";
import Discord, {
- MessageActionRow,
- MessageButton,
+ ActionRowBuilder,
+ ButtonBuilder,
MessageComponentInteraction,
MessageSelectOptionData,
Guild,
CommandInteraction,
GuildTextBasedChannel,
Message,
- SelectMenuInteraction
+ SelectMenuInteraction,
+ ButtonStyle
} from "discord.js";
import EmojiEmbed from "../utils/generateEmojiEmbed.js";
import getEmojiByName from "../utils/getEmojiByName.js";
import createPageIndicator from "../utils/createPageIndicator.js";
class Embed {
- embed: Discord.MessageEmbed;
+ embed: Discord.EmbedBuilder;
title: string;
description = "";
pageId = 0;
constructor() {
- this.embed = new Discord.MessageEmbed();
+ this.embed = new Discord.EmbedBuilder();
this.title = "";
}
- setEmbed(embed: Discord.MessageEmbed) {
+ setEmbed(embed: Discord.EmbedBuilder) {
this.embed = embed;
return this;
}
@@ -233,7 +234,7 @@
let cancelled = false;
let timedOut = false;
while (!cancelled && !timedOut) {
- let selectPane: MessageActionRow[] = [];
+ let selectPane: ActionRowBuilder[] = [];
if (selectPaneOpen) {
const options: MessageSelectOptionData[] = [];
@@ -245,8 +246,8 @@
});
});
selectPane = [
- new MessageActionRow().addComponents([
- new Discord.MessageSelectMenu()
+ new ActionRowBuilder().addComponents([
+ new Discord.SelectMenuBuilder()
.addOptions(options)
.setCustomId("page")
.setMaxValues(1)
@@ -255,33 +256,33 @@
];
}
const components = selectPane.concat([
- new MessageActionRow().addComponents([
- new MessageButton()
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder()
.setCustomId("left")
.setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
- .setStyle("SECONDARY")
+ .setStyle(ButtonStyle.Secondary)
.setDisabled(page === 0),
- new MessageButton()
+ new ButtonBuilder()
.setCustomId("select")
.setEmoji(getEmojiByName("CONTROL.MENU", "id"))
- .setStyle(selectPaneOpen ? "PRIMARY" : "SECONDARY")
+ .setStyle(selectPaneOpen ? ButtonStyle.Primary : ButtonStyle.Secondary)
.setDisabled(false),
- new MessageButton()
+ new ButtonBuilder()
.setCustomId("right")
.setEmoji(getEmojiByName("CONTROL.RIGHT", "id"))
- .setStyle("SECONDARY")
+ .setStyle(ButtonStyle.Secondary)
.setDisabled(page === pages.length - 1)
])
]);
if (interaction) {
- const em = new Discord.MessageEmbed(pages[page]!.embed);
+ const em = new Discord.EmbedBuilder(pages[page]!.embed);
em.setDescription(em.description + "\n\n" + createPageIndicator(pages.length, page));
await interaction.editReply({
embeds: [em],
components: components
});
} else {
- const em = new Discord.MessageEmbed(pages[page]!.embed);
+ const em = new Discord.EmbedBuilder(pages[page]!.embed);
em.setDescription(em.description + "\n\n" + createPageIndicator(pages.length, page));
(await m.edit({
embeds: [em],
@@ -322,7 +323,7 @@
}
if (timedOut) {
if (interaction) {
- const em = new Discord.MessageEmbed(pages[page]!.embed);
+ const em = new Discord.EmbedBuilder(pages[page]!.embed);
em.setDescription(em.description + "\n\n" + createPageIndicator(pages.length, page)).setFooter({
text: "Message timed out"
});
@@ -331,7 +332,7 @@
components: []
});
} else {
- const em = new Discord.MessageEmbed(pages[page]!.embed);
+ const em = new Discord.EmbedBuilder(pages[page]!.embed);
em.setDescription(em.description + "\n\n" + createPageIndicator(pages.length, page)).setFooter({
text: "Message timed out"
});
@@ -342,7 +343,7 @@
}
} else {
if (interaction) {
- const em = new Discord.MessageEmbed(pages[page]!.embed);
+ const em = new Discord.EmbedBuilder(pages[page]!.embed);
em.setDescription(em.description + "\n\n" + createPageIndicator(pages.length, page));
em.setFooter({ text: "Message closed" });
interaction.editReply({
diff --git a/src/reflex/verify.ts b/src/reflex/verify.ts
index 8aba46d..bbb0992 100644
--- a/src/reflex/verify.ts
+++ b/src/reflex/verify.ts
@@ -5,7 +5,8 @@
Interaction,
MessageComponentInteraction,
Permissions,
- Role
+ Role,
+ ButtonStyle
} from "discord.js";
import EmojiEmbed from "../utils/generateEmojiEmbed.js";
import fetch from "node-fetch";
@@ -94,14 +95,14 @@
.setEmoji("CONTROL.BLOCKCROSS")
],
components: [
- new Discord.MessageActionRow().addComponents([
- new Discord.MessageButton()
+ new Discord.ActionRowBuilder().addComponents([
+ new Discord.ButtonBuilder()
.setLabel("Check webpage")
- .setStyle("LINK")
+ .setStyle(ButtonStyle.Link)
.setURL(client.config.baseUrl),
- new Discord.MessageButton()
+ new Discord.ButtonBuilder()
.setLabel("Support")
- .setStyle("LINK")
+ .setStyle(ButtonStyle.Link)
.setURL("https://discord.gg/bPaNnxe")
])
]
@@ -228,10 +229,10 @@
.setEmoji("MEMBER.JOIN")
],
components: [
- new Discord.MessageActionRow().addComponents([
- new Discord.MessageButton()
+ new Discord.ActionRowBuilder().addComponents([
+ new Discord.ButtonBuilder()
.setLabel("Verify")
- .setStyle("LINK")
+ .setStyle(ButtonStyle.Link)
.setURL(`${client.config.baseUrl}nucleus/verify?code=${code}`)
])
]