moved to d.js 14.3.0, started fixing errors
Co-authored-by: PineappleFan <pineapplefanyt@gmail.com>
diff --git a/src/commands/user/about.ts b/src/commands/user/about.ts
index 4701630..44e6d3b 100644
--- a/src/commands/user/about.ts
+++ b/src/commands/user/about.ts
@@ -3,12 +3,13 @@
CommandInteraction,
GuildMember,
Message,
- MessageActionRow,
- MessageActionRowComponent,
- MessageButton,
+ ActionRowBuilder,
+ Component,
+ ButtonBuilder,
MessageComponentInteraction,
MessageSelectOptionData,
- SelectMenuInteraction
+ SelectMenuInteraction,
+ ButtonStyle
} from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
@@ -26,11 +27,11 @@
);
class Embed {
- embed: Discord.MessageEmbed;
+ embed: Discord.EmbedBuilder;
title: string;
description = "";
pageId = 0;
- setEmbed(embed: Discord.MessageEmbed) {
+ setEmbed(embed: Discord.EmbedBuilder) {
this.embed = embed;
return this;
}
@@ -227,7 +228,7 @@
let page = 0;
let timedOut = false;
while (!timedOut) {
- const em = new Discord.MessageEmbed(embeds[page].embed);
+ const em = new Discord.EmbedBuilder(embeds[page].embed);
em.setDescription(em.description + "\n" + createPageIndicator(embeds.length, page));
let selectPane = [];
@@ -241,8 +242,8 @@
});
});
selectPane = [
- new MessageActionRow().addComponents([
- new Discord.MessageSelectMenu()
+ new ActionRowBuilder().addComponents([
+ new Discord.SelectMenuBuilder()
.addOptions(options)
.setCustomId("page")
.setMaxValues(1)
@@ -253,21 +254,21 @@
await interaction.editReply({
embeds: [em],
components: selectPane.concat([
- new MessageActionRow().addComponents([
- new MessageButton()
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder()
.setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
- .setStyle("SECONDARY")
+ .setStyle(ButtonStyle.Secondary)
.setCustomId("left")
.setDisabled(page === 0),
- new MessageButton()
+ new ButtonBuilder()
.setEmoji(getEmojiByName("CONTROL.MENU", "id"))
- .setStyle(selectPaneOpen ? "PRIMARY" : "SECONDARY")
+ .setStyle(selectPaneOpen ? ButtonStyle.Primary : ButtonStyle.Secondary)
.setCustomId("select")
.setDisabled(false),
- new MessageButton()
+ new ButtonBuilder()
.setEmoji(getEmojiByName("CONTROL.RIGHT", "id"))
.setCustomId("right")
- .setStyle("SECONDARY")
+ .setStyle(ButtonStyle.Secondary)
.setDisabled(page === embeds.length - 1)
])
])
@@ -280,20 +281,20 @@
continue;
}
i.deferUpdate();
- if ((i.component as MessageActionRowComponent).customId === "left") {
+ if ((i.component as Component).customId === "left") {
if (page > 0) page--;
selectPaneOpen = false;
- } else if ((i.component as MessageActionRowComponent).customId === "right") {
+ } else if ((i.component as Component).customId === "right") {
if (page < embeds.length - 1) page++;
selectPaneOpen = false;
- } else if ((i.component as MessageActionRowComponent).customId === "select") {
+ } else if ((i.component as Component).customId === "select") {
selectPaneOpen = !selectPaneOpen;
- } else if ((i.component as MessageActionRowComponent).customId === "page") {
+ } else if ((i.component as Component).customId === "page") {
page = parseInt((i as SelectMenuInteraction).values[0]);
selectPaneOpen = false;
}
}
- const em = new Discord.MessageEmbed(embeds[page].embed);
+ const em = new Discord.EmbedBuilder(embeds[page].embed);
em.setDescription(em.description + "\n" + createPageIndicator(embeds.length, page) + " | Message closed");
await interaction.editReply({
embeds: [em],
diff --git a/src/commands/user/track.ts b/src/commands/user/track.ts
index 8c991e3..a8a837b 100644
--- a/src/commands/user/track.ts
+++ b/src/commands/user/track.ts
@@ -1,5 +1,5 @@
import { LoadingEmbed } from "./../../utils/defaultEmbeds.js";
-import Discord, { CommandInteraction, GuildMember, Message, MessageActionRow, MessageButton } from "discord.js";
+import Discord, { CommandInteraction, GuildMember, Message, ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js";
import { SelectMenuOption, SlashCommandSubcommandBuilder } from "@discordjs/builders";
// @ts-expect-error
import { WrappedCheck } from "jshaiku";
@@ -43,7 +43,7 @@
return memberRoles.cache.has(element);
});
else managed = false;
- const dropdown = new Discord.MessageSelectMenu()
+ const dropdown = new Discord.SelectMenuBuilder()
.addOptions(
config.tracks.map((option, index) => {
const hasRoleInTrack = option.track.some((element: string) => {
@@ -114,7 +114,7 @@
);
});
conflictDropdown = [
- new Discord.MessageSelectMenu()
+ new Discord.SelectMenuBuilder()
.addOptions(conflictDropdown)
.setCustomId("conflict")
.setMaxValues(1)
@@ -135,27 +135,27 @@
.setDescription(`${generated}`)
.setStatus("Success")
],
- components: [new MessageActionRow().addComponents(dropdown)]
+ components: [new ActionRowBuilder().addComponents(dropdown)]
.concat(
- conflict && conflictDropdown.length ? [new MessageActionRow().addComponents(conflictDropdown)] : []
+ conflict && conflictDropdown.length ? [new ActionRowBuilder().addComponents(conflictDropdown)] : []
)
.concat([
- new MessageActionRow().addComponents([
- new MessageButton()
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder()
.setEmoji(getEmojiByName("CONTROL.UP", "id"))
.setLabel("Move up")
.setCustomId("promote")
- .setStyle("SUCCESS")
+ .setStyle(ButtonStyle.Success)
.setDisabled(
conflict ||
currentRoleIndex === 0 ||
(currentRoleIndex === -1 ? false : !allowed[currentRoleIndex - 1])
),
- new MessageButton()
+ new ButtonBuilder()
.setEmoji(getEmojiByName("CONTROL.DOWN", "id"))
.setLabel("Move down")
.setCustomId("demote")
- .setStyle("DANGER")
+ .setStyle(ButtonStyle.Danger)
.setDisabled(
conflict ||
(data.nullable