moved to d.js 14.3.0, started fixing errors
Co-authored-by: PineappleFan <pineapplefanyt@gmail.com>
diff --git a/src/commands/mod/ban.ts b/src/commands/mod/ban.ts
index 3aea8c8..9b24b0c 100644
--- a/src/commands/mod/ban.ts
+++ b/src/commands/mod/ban.ts
@@ -1,4 +1,4 @@
-import { CommandInteraction, GuildMember, MessageActionRow, MessageButton, User } from "discord.js";
+import { CommandInteraction, GuildMember, ActionRowBuilder, ButtonBuilder, User, ButtonStyle } from "discord.js";
import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import confirmationMessage from "../../utils/confirmationMessage.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
@@ -81,11 +81,11 @@
.setStatus("Danger")
],
components: [
- new MessageActionRow().addComponents(
+ new ActionRowBuilder().addComponents(
config.moderation.ban.text
? [
- new MessageButton()
- .setStyle("LINK")
+ new ButtonBuilder()
+ .setStyle(ButtonStyle.Link)
.setLabel(config.moderation.ban.text)
.setURL(config.moderation.ban.link)
]
diff --git a/src/commands/mod/info.ts b/src/commands/mod/info.ts
index bc5dd14..bed0f86 100644
--- a/src/commands/mod/info.ts
+++ b/src/commands/mod/info.ts
@@ -4,12 +4,13 @@
GuildMember,
Interaction,
Message,
- MessageActionRow,
- MessageButton,
+ ActionRowBuilder,
+ ButtonBuilder,
MessageComponentInteraction,
ModalSubmitInteraction,
SelectMenuInteraction,
- TextInputComponent
+ TextInputComponent,
+ ButtonStyle
} from "discord.js";
import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
@@ -148,8 +149,8 @@
const components = (
openFilterPane
? [
- new MessageActionRow().addComponents([
- new Discord.MessageSelectMenu()
+ new ActionRowBuilder().addComponents([
+ new Discord.SelectMenuBuilder()
.setOptions(
Object.entries(types).map(([key, value]) => ({
label: value.text,
@@ -166,36 +167,36 @@
]
: []
).concat([
- new MessageActionRow().addComponents([
- new MessageButton()
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder()
.setCustomId("prevYear")
.setLabel((currentYear - 1).toString())
.setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
- .setStyle("SECONDARY"),
- new MessageButton().setCustomId("prevPage").setLabel("Previous page").setStyle("PRIMARY"),
- new MessageButton().setCustomId("today").setLabel("Today").setStyle("PRIMARY"),
- new MessageButton()
+ .setStyle(ButtonStyle.Secondary),
+ new ButtonBuilder().setCustomId("prevPage").setLabel("Previous page").setStyle(ButtonStyle.Primary),
+ new ButtonBuilder().setCustomId("today").setLabel("Today").setStyle(ButtonStyle.Primary),
+ new ButtonBuilder()
.setCustomId("nextPage")
.setLabel("Next page")
- .setStyle("PRIMARY")
+ .setStyle(ButtonStyle.Primary)
.setDisabled(pageIndex >= groups.length - 1 && currentYear === new Date().getFullYear()),
- new MessageButton()
+ new ButtonBuilder()
.setCustomId("nextYear")
.setLabel((currentYear + 1).toString())
.setEmoji(getEmojiByName("CONTROL.RIGHT", "id"))
- .setStyle("SECONDARY")
+ .setStyle(ButtonStyle.Secondary)
.setDisabled(currentYear === new Date().getFullYear())
]),
- new MessageActionRow().addComponents([
- new MessageButton()
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder()
.setLabel("Mod notes")
.setCustomId("modNotes")
- .setStyle("PRIMARY")
+ .setStyle(ButtonStyle.Primary)
.setEmoji(getEmojiByName("ICONS.EDIT", "id")),
- new MessageButton()
+ new ButtonBuilder()
.setLabel("Filter")
.setCustomId("openFilter")
- .setStyle(openFilterPane ? "SUCCESS" : "PRIMARY")
+ .setStyle(openFilterPane ? ButtonStyle.Success : ButtonStyle.Primary)
.setEmoji(getEmojiByName("ICONS.FILTER", "id"))
])
]);
@@ -329,15 +330,15 @@
.setStatus("Success")
],
components: [
- new MessageActionRow().addComponents([
- new MessageButton()
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder()
.setLabel(`${note ? "Modify" : "Create"} note`)
- .setStyle("PRIMARY")
+ .setStyle(ButtonStyle.Primary)
.setCustomId("modify")
.setEmoji(getEmojiByName("ICONS.EDIT", "id")),
- new MessageButton()
+ new ButtonBuilder()
.setLabel("View moderation history")
- .setStyle("PRIMARY")
+ .setStyle(ButtonStyle.Primary)
.setCustomId("history")
.setEmoji(getEmojiByName("ICONS.HISTORY", "id"))
])
@@ -356,7 +357,7 @@
.setCustomId("modal")
.setTitle("Editing moderator note")
.addComponents(
- new MessageActionRow<TextInputComponent>().addComponents(
+ new ActionRowBuilder<TextInputComponent>().addComponents(
new TextInputComponent()
.setCustomId("note")
.setLabel("Note")
@@ -376,11 +377,11 @@
.setEmoji("GUILD.TICKET.OPEN")
],
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/commands/mod/kick.ts b/src/commands/mod/kick.ts
index 3ca56a6..f6052f8 100644
--- a/src/commands/mod/kick.ts
+++ b/src/commands/mod/kick.ts
@@ -1,4 +1,4 @@
-import { CommandInteraction, GuildMember, MessageActionRow, MessageButton } from "discord.js";
+import { CommandInteraction, GuildMember, ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js";
// @ts-expect-error
import humanizeDuration from "humanize-duration";
import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
@@ -61,11 +61,11 @@
.setStatus("Danger")
],
components: [
- new MessageActionRow().addComponents(
+ new ActionRowBuilder().addComponents(
config.moderation.kick.text
? [
- new MessageButton()
- .setStyle("LINK")
+ new ButtonBuilder()
+ .setStyle(ButtonStyle.Link)
.setLabel(config.moderation.kick.text)
.setURL(config.moderation.kick.link)
]
diff --git a/src/commands/mod/mute.ts b/src/commands/mod/mute.ts
index 2b01ffc..1f541c8 100644
--- a/src/commands/mod/mute.ts
+++ b/src/commands/mod/mute.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 type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import getEmojiByName from "../../utils/getEmojiByName.js";
@@ -74,23 +74,23 @@
.setStatus("Success")
],
components: [
- new MessageActionRow().addComponents([
- new Discord.MessageButton().setCustomId("1m").setLabel("1 Minute").setStyle("SECONDARY"),
- new Discord.MessageButton().setCustomId("10m").setLabel("10 Minutes").setStyle("SECONDARY"),
- new Discord.MessageButton().setCustomId("30m").setLabel("30 Minutes").setStyle("SECONDARY"),
- new Discord.MessageButton().setCustomId("1h").setLabel("1 Hour").setStyle("SECONDARY")
+ new ActionRowBuilder().addComponents([
+ new Discord.ButtonBuilder().setCustomId("1m").setLabel("1 Minute").setStyle(ButtonStyle.Secondary),
+ new Discord.ButtonBuilder().setCustomId("10m").setLabel("10 Minutes").setStyle(ButtonStyle.Secondary),
+ new Discord.ButtonBuilder().setCustomId("30m").setLabel("30 Minutes").setStyle(ButtonStyle.Secondary),
+ new Discord.ButtonBuilder().setCustomId("1h").setLabel("1 Hour").setStyle(ButtonStyle.Secondary)
]),
- new MessageActionRow().addComponents([
- new Discord.MessageButton().setCustomId("6h").setLabel("6 Hours").setStyle("SECONDARY"),
- new Discord.MessageButton().setCustomId("12h").setLabel("12 Hours").setStyle("SECONDARY"),
- new Discord.MessageButton().setCustomId("1d").setLabel("1 Day").setStyle("SECONDARY"),
- new Discord.MessageButton().setCustomId("1w").setLabel("1 Week").setStyle("SECONDARY")
+ new ActionRowBuilder().addComponents([
+ new Discord.ButtonBuilder().setCustomId("6h").setLabel("6 Hours").setStyle(ButtonStyle.Secondary),
+ new Discord.ButtonBuilder().setCustomId("12h").setLabel("12 Hours").setStyle(ButtonStyle.Secondary),
+ new Discord.ButtonBuilder().setCustomId("1d").setLabel("1 Day").setStyle(ButtonStyle.Secondary),
+ new Discord.ButtonBuilder().setCustomId("1w").setLabel("1 Week").setStyle(ButtonStyle.Secondary)
]),
- new MessageActionRow().addComponents([
- new Discord.MessageButton()
+ new ActionRowBuilder().addComponents([
+ new Discord.ButtonBuilder()
.setCustomId("cancel")
.setLabel("Cancel")
- .setStyle("DANGER")
+ .setStyle(ButtonStyle.Danger)
.setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
])
],
@@ -242,11 +242,11 @@
.setStatus("Danger")
],
components: [
- new MessageActionRow().addComponents(
+ new ActionRowBuilder().addComponents(
config.moderation.mute.text
? [
- new MessageButton()
- .setStyle("LINK")
+ new ButtonBuilder()
+ .setStyle(ButtonStyle.Link)
.setLabel(config.moderation.mute.text)
.setURL(config.moderation.mute.link)
]
diff --git a/src/commands/mod/purge.ts b/src/commands/mod/purge.ts
index 2978cc1..a19a627 100644
--- a/src/commands/mod/purge.ts
+++ b/src/commands/mod/purge.ts
@@ -1,4 +1,4 @@
-import Discord, { CommandInteraction, GuildChannel, GuildMember, TextChannel } from "discord.js";
+import Discord, { CommandInteraction, GuildChannel, GuildMember, TextChannel, ButtonStyle } from "discord.js";
import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import confirmationMessage from "../../utils/confirmationMessage.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
@@ -74,21 +74,21 @@
.setStatus("Danger")
],
components: [
- new Discord.MessageActionRow().addComponents([
- new Discord.MessageButton().setCustomId("1").setLabel("1").setStyle("SECONDARY"),
- new Discord.MessageButton().setCustomId("3").setLabel("3").setStyle("SECONDARY"),
- new Discord.MessageButton().setCustomId("5").setLabel("5").setStyle("SECONDARY")
+ new Discord.ActionRowBuilder().addComponents([
+ new Discord.ButtonBuilder().setCustomId("1").setLabel("1").setStyle(ButtonStyle.Secondary),
+ new Discord.ButtonBuilder().setCustomId("3").setLabel("3").setStyle(ButtonStyle.Secondary),
+ new Discord.ButtonBuilder().setCustomId("5").setLabel("5").setStyle(ButtonStyle.Secondary)
]),
- new Discord.MessageActionRow().addComponents([
- new Discord.MessageButton().setCustomId("10").setLabel("10").setStyle("SECONDARY"),
- new Discord.MessageButton().setCustomId("25").setLabel("25").setStyle("SECONDARY"),
- new Discord.MessageButton().setCustomId("50").setLabel("50").setStyle("SECONDARY")
+ new Discord.ActionRowBuilder().addComponents([
+ new Discord.ButtonBuilder().setCustomId("10").setLabel("10").setStyle(ButtonStyle.Secondary),
+ new Discord.ButtonBuilder().setCustomId("25").setLabel("25").setStyle(ButtonStyle.Secondary),
+ new Discord.ButtonBuilder().setCustomId("50").setLabel("50").setStyle(ButtonStyle.Secondary)
]),
- new Discord.MessageActionRow().addComponents([
- new Discord.MessageButton()
+ new Discord.ActionRowBuilder().addComponents([
+ new Discord.ButtonBuilder()
.setCustomId("done")
.setLabel("Done")
- .setStyle("SUCCESS")
+ .setStyle(ButtonStyle.Success)
.setEmoji(getEmojiByName("CONTROL.TICK", "id"))
])
]
@@ -103,12 +103,12 @@
timedOut = true;
continue;
}
- component.deferUpdate();
- if (component.customId === "done") {
+ (await component).deferUpdate();
+ if ((await component).customId === "done") {
amountSelected = true;
continue;
}
- const amount = parseInt(component.customId);
+ const amount = parseInt((await component).customId);
let messages;
await (interaction.channel as TextChannel).messages.fetch({ limit: amount }).then(async (ms) => {
@@ -189,11 +189,11 @@
.setStatus("Success")
],
components: [
- new Discord.MessageActionRow().addComponents([
- new Discord.MessageButton()
+ new Discord.ActionRowBuilder().addComponents([
+ new Discord.ButtonBuilder()
.setCustomId("download")
.setLabel("Download transcript")
- .setStyle("SUCCESS")
+ .setStyle(ButtonStyle.Success)
.setEmoji(getEmojiByName("CONTROL.DOWNLOAD", "id"))
])
]
@@ -337,11 +337,11 @@
.setStatus("Success")
],
components: [
- new Discord.MessageActionRow().addComponents([
- new Discord.MessageButton()
+ new Discord.ActionRowBuilder().addComponents([
+ new Discord.ButtonBuilder()
.setCustomId("download")
.setLabel("Download transcript")
- .setStyle("SUCCESS")
+ .setStyle(ButtonStyle.Success)
.setEmoji(getEmojiByName("CONTROL.DOWNLOAD", "id"))
])
]
diff --git a/src/commands/mod/softban.ts b/src/commands/mod/softban.ts
index ba6ed37..6c0396d 100644
--- a/src/commands/mod/softban.ts
+++ b/src/commands/mod/softban.ts
@@ -1,4 +1,4 @@
-import { CommandInteraction, GuildMember, MessageActionRow, MessageButton } from "discord.js";
+import { CommandInteraction, GuildMember, ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import confirmationMessage from "../../utils/confirmationMessage.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
@@ -82,11 +82,11 @@
.setStatus("Danger")
],
components: [
- new MessageActionRow().addComponents(
+ new ActionRowBuilder().addComponents(
config.moderation.ban.text
? [
- new MessageButton()
- .setStyle("LINK")
+ new ButtonBuilder()
+ .setStyle(ButtonStyle.Link)
.setLabel(config.moderation.ban.text)
.setURL(config.moderation.ban.link)
]
diff --git a/src/commands/mod/viewas.ts b/src/commands/mod/viewas.ts
index ba9bc1d..ca68a70 100644
--- a/src/commands/mod/viewas.ts
+++ b/src/commands/mod/viewas.ts
@@ -2,9 +2,10 @@
CategoryChannel,
CommandInteraction,
GuildMember,
- MessageActionRow,
- MessageButton,
- MessageSelectMenu
+ ActionRowBuilder,
+ ButtonBuilder,
+ SelectMenuBuilder,
+ ButtonStyle
} from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
@@ -99,8 +100,8 @@
)
],
components: [
- new MessageActionRow().addComponents([
- new MessageSelectMenu()
+ new ActionRowBuilder().addComponents([
+ new SelectMenuBuilder()
.setOptions(
channels.map((c, index) => ({
label: c[0].parent ? c[0].parent.name : "Uncategorised",
@@ -113,8 +114,8 @@
.setMinValues(1)
.setPlaceholder("Select a category")
]),
- new MessageActionRow().addComponents([
- new MessageButton()
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder()
.setLabel(
page === 0
? ""
@@ -124,9 +125,9 @@
)
.setDisabled(page === 0)
.setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
- .setStyle("PRIMARY")
+ .setStyle(ButtonStyle.Primary)
.setCustomId("previous"),
- new MessageButton()
+ new ButtonBuilder()
.setLabel(
page === channels.length - 1
? ""
@@ -136,7 +137,7 @@
)
.setDisabled(page === channels.length - 1)
.setEmoji(getEmojiByName("CONTROL.RIGHT", "id"))
- .setStyle("PRIMARY")
+ .setStyle(ButtonStyle.Primary)
.setCustomId("next")
])
]
diff --git a/src/commands/mod/warn.ts b/src/commands/mod/warn.ts
index 68c476b..2fc5a06 100644
--- a/src/commands/mod/warn.ts
+++ b/src/commands/mod/warn.ts
@@ -1,4 +1,4 @@
-import Discord, { CommandInteraction, GuildMember, MessageActionRow, MessageButton } from "discord.js";
+import Discord, { CommandInteraction, GuildMember, ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import confirmationMessage from "../../utils/confirmationMessage.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
@@ -94,9 +94,9 @@
],
components: config.moderation.warn.text
? [
- new MessageActionRow().addComponents([
- new MessageButton()
- .setStyle("LINK")
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder()
+ .setStyle(ButtonStyle.Link)
.setLabel(config.moderation.warn.text)
.setURL(config.moderation.warn.link)
])
@@ -167,17 +167,17 @@
.setStatus("Danger")
],
components: [
- new MessageActionRow().addComponents([
- new Discord.MessageButton().setCustomId("log").setLabel("Ignore and log").setStyle("SECONDARY"),
- new Discord.MessageButton()
+ new ActionRowBuilder().addComponents([
+ new Discord.ButtonBuilder().setCustomId("log").setLabel("Ignore and log").setStyle(ButtonStyle.Secondary),
+ new Discord.ButtonBuilder()
.setCustomId("here")
.setLabel("Warn here")
- .setStyle(canSeeChannel ? "PRIMARY" : "SECONDARY")
+ .setStyle(canSeeChannel ? ButtonStyle.Primary : ButtonStyle.Secondary)
.setDisabled(!canSeeChannel),
- new Discord.MessageButton()
+ new Discord.ButtonBuilder()
.setCustomId("ticket")
.setLabel("Create ticket")
- .setStyle(canSeeChannel ? "SECONDARY" : "PRIMARY")
+ .setStyle(canSeeChannel ? ButtonStyle.Primary : ButtonStyle.Secondary)
])
]
})) as Discord.Message;