moved to d.js 14.3.0, started fixing errors
Co-authored-by: PineappleFan <pineapplefanyt@gmail.com>
diff --git a/package.json b/package.json
index b211473..6784d59 100644
--- a/package.json
+++ b/package.json
@@ -6,7 +6,8 @@
"@ungap/structured-clone": "^1.0.1",
"agenda": "^4.3.0",
"body-parser": "^1.20.0",
- "discord.js": "13.8.1",
+ "discord-api-types": "^0.37.9",
+ "discord.js": "^14.3.0",
"eslint": "^8.21.0",
"express": "^4.18.1",
"form-data": "^4.0.0",
diff --git a/src/Unfinished/all.ts b/src/Unfinished/all.ts
index cf2c9e4..141d061 100644
--- a/src/Unfinished/all.ts
+++ b/src/Unfinished/all.ts
@@ -2,9 +2,10 @@
import Discord, {
CommandInteraction,
GuildMember,
- MessageActionRow,
- MessageButton,
- MessageSelectMenu
+ ActionRowBuilder,
+ ButtonBuilder,
+ SelectMenuBuilder,
+ ButtonStyle
} from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import { WrappedCheck } from "jshaiku";
@@ -224,8 +225,8 @@
.setStatus("Success")
],
components: [
- new MessageActionRow().addComponents([
- new MessageSelectMenu()
+ new ActionRowBuilder().addComponents([
+ new SelectMenuBuilder()
.setOptions(
filters.map((f, index) => ({
label: (f.inverted ? "(Not) " : "") + f.name,
@@ -237,16 +238,16 @@
.setCustomId("select")
.setPlaceholder("Remove a filter")
]),
- new MessageActionRow().addComponents([
- new MessageButton()
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder()
.setLabel("Apply")
- .setStyle("PRIMARY")
+ .setStyle(ButtonStyle.Primary)
.setCustomId("apply")
.setEmoji(client.emojis.cache.get(getEmojiByName("CONTROL.TICK", "id")))
.setDisabled(affected.length === 0),
- new MessageButton()
+ new ButtonBuilder()
.setLabel("Add filter")
- .setStyle("PRIMARY")
+ .setStyle(ButtonStyle.Primary)
.setCustomId("add")
.setEmoji(client.emojis.cache.get(getEmojiByName("ICONS.FILTER", "id")))
.setDisabled(filters.length >= 25)
diff --git a/src/Unfinished/categorisationTest.ts b/src/Unfinished/categorisationTest.ts
index 2da2be3..79cd402 100644
--- a/src/Unfinished/categorisationTest.ts
+++ b/src/Unfinished/categorisationTest.ts
@@ -1,5 +1,5 @@
import { LoadingEmbed } from "../utils/defaultEmbeds.js";
-import { CommandInteraction, GuildChannel, MessageActionRow, MessageButton, MessageSelectMenu } from "discord.js";
+import { CommandInteraction, GuildChannel, ActionRowBuilder, ButtonBuilder, SelectMenuBuilder, ButtonStyle } from "discord.js";
import { SlashCommandBuilder } from "@discordjs/builders";
// @ts-expect-error
import type { WrappedCheck } from "jshaiku";
@@ -56,8 +56,8 @@
.setStatus("Success")
],
components: [
- new MessageActionRow().addComponents([
- new MessageSelectMenu()
+ new ActionRowBuilder().addComponents([
+ new SelectMenuBuilder()
.setCustomId("selected")
.setMaxValues(Object.keys(types).length)
.setMinValues(1)
@@ -69,17 +69,17 @@
}))
)
]),
- new MessageActionRow().addComponents([
- new MessageButton()
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder()
.setLabel("Accept Suggestion")
.setCustomId("accept")
- .setStyle("SUCCESS")
+ .setStyle(ButtonStyle.Success)
.setDisabled(predicted[channel].length === 0)
.setEmoji(client.emojis.cache.get(getEmojiByName("ICONS.TICK", "id"))),
- new MessageButton()
+ new ButtonBuilder()
.setLabel('Use "Other"')
.setCustomId("reject")
- .setStyle("SECONDARY")
+ .setStyle(ButtonStyle.Secondary)
.setEmoji(client.emojis.cache.get(getEmojiByName("ICONS.CROSS", "id")))
])
]
diff --git a/src/actions/createModActionTicket.ts b/src/actions/createModActionTicket.ts
index 365c5e3..8a733cf 100644
--- a/src/actions/createModActionTicket.ts
+++ b/src/actions/createModActionTicket.ts
@@ -1,4 +1,4 @@
-import Discord, { MessageActionRow, MessageButton } from "discord.js";
+import Discord, { ActionRowBuilder, ButtonBuilder, OverwriteType, ChannelType, ButtonStyle } from "discord.js";
import EmojiEmbed from "../utils/generateEmojiEmbed.js";
import getEmojiByName from "../utils/getEmojiByName.js";
import client from "../utils/client.js";
@@ -12,30 +12,29 @@
) {
const config = await client.database.guilds.read(guild.id);
const { log, NucleusColors, entry, renderUser, renderChannel, renderDelta } = client.logger;
- const overwrites = [
- {
- id: member,
- allow: ["VIEW_CHANNEL", "SEND_MESSAGES", "ATTACH_FILES", "ADD_REACTIONS", "READ_MESSAGE_HISTORY"],
- type: "member"
- }
- ] as Discord.OverwriteResolvable[];
+ const overwrites = [{
+ id: member,
+ allow: ["ViewChannel", "SendMessages", "AttachFiles", "AddReactions", "ReadMessageHistory"],
+ type: OverwriteType.Member
+ }] as unknown as Discord.OverwriteResolvable[];
overwrites.push({
id: guild.roles.everyone,
- deny: ["VIEW_CHANNEL"],
- type: "role"
+ deny: ["ViewChannel"],
+ type: OverwriteType.Role
});
if (config.tickets.supportRole !== null) {
overwrites.push({
id: guild.roles.cache.get(config.tickets.supportRole)!,
- allow: ["VIEW_CHANNEL", "SEND_MESSAGES", "ATTACH_FILES", "ADD_REACTIONS", "READ_MESSAGE_HISTORY"],
- type: "role"
+ allow: ["ViewChannel", "SendMessages", "AttachFiles", "AddReactions", "ReadMessageHistory"],
+ type: OverwriteType.Role
});
}
let c;
try {
- c = await guild.channels.create(member.username, {
- type: "GUILD_TEXT",
+ c = await guild.channels.create({
+ name: member.username,
+ type: ChannelType.GuildText,
topic: `${member.id} Active`,
parent: config.tickets.category,
nsfw: false,
@@ -69,10 +68,10 @@
.setEmoji("GUILD.TICKET.OPEN")
],
components: [
- new MessageActionRow().addComponents([
- new MessageButton()
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder()
.setLabel("Close")
- .setStyle("DANGER")
+ .setStyle(ButtonStyle.Danger)
.setCustomId("closeticket")
.setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
])
diff --git a/src/actions/roleMenu.ts b/src/actions/roleMenu.ts
index e7f1874..48ca49c 100644
--- a/src/actions/roleMenu.ts
+++ b/src/actions/roleMenu.ts
@@ -1,10 +1,11 @@
-import { Interaction, MessageButton } from "discord.js";
+import { Interaction, ButtonBuilder, CommandInteraction, Role, ButtonStyle } from "discord.js";
import EmojiEmbed from "../utils/generateEmojiEmbed.js";
-import { MessageActionRow, MessageSelectMenu } from "discord.js";
+import { ActionRowBuilder, SelectMenuBuilder } from "discord.js";
import getEmojiByName from "../utils/getEmojiByName.js";
import client from "../utils/client.js";
import { LoadingEmbed } from "../utils/defaultEmbeds.js";
import type { GuildConfig } from "../utils/database.js";
+import type { ButtonComponent } from "@discordjs/builders";
export interface RoleMenuSchema {
guild: string;
@@ -16,7 +17,9 @@
interaction: Interaction;
}
-export async function callback(interaction: Interaction) {
+export async function callback(interaction: CommandInteraction) {
+ if(!interaction.guild) return interaction.reply({ content: "This command can only be used in a server.", ephemeral: true });
+ if(!interaction.member) return interaction.reply({ content: "You must be in a server to use this command.", ephemeral: true });
const config = await client.database.guilds.read(interaction.guild.id);
if (!config.roleMenu.enabled)
return await interaction.reply({
@@ -67,7 +70,7 @@
client.roleMenu[code] = {
guild: interaction.guild.id,
guildName: interaction.guild.name,
- guildIcon: interaction.guild.iconURL({ format: "png" }),
+ guildIcon: interaction.guild.iconURL({ extension: "png" }),
user: interaction.member.user.id,
username: interaction.member.user.username,
data: config.roleMenu.options,
@@ -90,25 +93,26 @@
.setEmoji("GUILD.GREEN")
],
components: [
- new MessageActionRow().addComponents([
- new MessageButton()
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder()
.setLabel("Online")
- .setStyle("LINK")
+ .setStyle(ButtonStyle.Link)
.setDisabled(!up)
.setURL(`${client.config.baseUrl}nucleus/rolemenu?code=${code}`),
- new MessageButton().setLabel("Manual").setStyle("PRIMARY").setCustomId("manual")
+ new ButtonBuilder().setLabel("Manual").setStyle(ButtonStyle.Primary).setCustomId("manual")
])
]
});
}
let component;
+ if (!m) return;
try {
component = await m.awaitMessageComponent({ time: 300000 });
} catch (e) {
return;
}
component.deferUpdate();
- let rolesToAdd = [];
+ let rolesToAdd: Role[] = [];
for (let i = 0; i < config.roleMenu.options.length; i++) {
const object = config.roleMenu.options[i];
const m = await interaction.editReply({
@@ -129,19 +133,19 @@
})
],
components: [
- new MessageActionRow().addComponents(
+ new ActionRowBuilder().addComponents(
[
- new MessageButton()
+ new ButtonBuilder()
.setLabel("Cancel")
- .setStyle("DANGER")
+ .setStyle(ButtonStyle.Danger)
.setCustomId("cancel")
.setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
].concat(
object.min === 0
? [
- new MessageButton()
+ new ButtonBuilder()
.setLabel("Skip")
- .setStyle("SECONDARY")
+ .setStyle(ButtonStyle.Secondary)
.setCustomId("skip")
.setEmoji(getEmojiByName("CONTROL.RIGHT", "id"))
]
@@ -149,8 +153,8 @@
)
)
].concat([
- new MessageActionRow().addComponents([
- new MessageSelectMenu()
+ new ActionRowBuilder().addComponents([
+ new SelectMenuBuilder()
.setPlaceholder(`${object.name}`)
.setCustomId("rolemenu")
.setMinValues(object.min)
diff --git a/src/actions/tickets/create.ts b/src/actions/tickets/create.ts
index d6bf822..66bbe42 100644
--- a/src/actions/tickets/create.ts
+++ b/src/actions/tickets/create.ts
@@ -1,4 +1,4 @@
-import Discord, { MessageActionRow, MessageButton } from "discord.js";
+import Discord, { ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js";
import { tickets, toHexArray } from "../../utils/calculate.js";
import client from "../../utils/client.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
@@ -67,17 +67,17 @@
let formattedTicketTypes = [];
formattedTicketTypes = ticketTypes.map((type) => {
if (custom) {
- return new MessageButton().setLabel(type).setStyle("PRIMARY").setCustomId(type);
+ return new ButtonBuilder().setLabel(type).setStyle(ButtonStyle.Primary).setCustomId(type);
} else {
- return new MessageButton()
+ return new ButtonBuilder()
.setLabel(capitalize(type))
- .setStyle("PRIMARY")
+ .setStyle(ButtonStyle.Primary)
.setCustomId(type)
.setEmoji(getEmojiByName("TICKETS." + type.toString().toUpperCase(), "id"));
}
});
for (let i = 0; i < formattedTicketTypes.length; i += 5) {
- splitFormattedTicketTypes.push(new MessageActionRow().addComponents(formattedTicketTypes.slice(i, i + 5)));
+ splitFormattedTicketTypes.push(new ActionRowBuilder().addComponents(formattedTicketTypes.slice(i, i + 5)));
}
const m = await interaction.reply({
embeds: [
@@ -102,22 +102,22 @@
formattedTicketTypes = [];
formattedTicketTypes = ticketTypes.map((type) => {
if (custom) {
- return new MessageButton()
+ return new ButtonBuilder()
.setLabel(type)
- .setStyle(chosenType === type ? "SUCCESS" : "SECONDARY")
+ .setStyle(chosenType === type ? ButtonStyle.Success : ButtonStyle.Secondary)
.setCustomId(type)
.setDisabled(true);
} else {
- return new MessageButton()
+ return new ButtonBuilder()
.setLabel(capitalize(type))
- .setStyle(chosenType === type ? "SUCCESS" : "SECONDARY")
+ .setStyle(chosenType === type ? ButtonStyle.Success : ButtonStyle.Secondary)
.setCustomId(type)
.setEmoji(getEmojiByName("TICKETS." + type.toString().toUpperCase(), "id"))
.setDisabled(true);
}
});
for (let i = 0; i < formattedTicketTypes.length; i += 5) {
- splitFormattedTicketTypes.push(new MessageActionRow().addComponents(formattedTicketTypes.slice(i, i + 5)));
+ splitFormattedTicketTypes.push(new ActionRowBuilder().addComponents(formattedTicketTypes.slice(i, i + 5)));
}
component.update({
embeds: [
@@ -207,10 +207,10 @@
.setEmoji("GUILD.TICKET.OPEN")
],
components: [
- new MessageActionRow().addComponents([
- new MessageButton()
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder()
.setLabel("Close")
- .setStyle("DANGER")
+ .setStyle(ButtonStyle.Danger)
.setCustomId("closeticket")
.setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
])
diff --git a/src/actions/tickets/delete.ts b/src/actions/tickets/delete.ts
index d692a1e..bd4c1db 100644
--- a/src/actions/tickets/delete.ts
+++ b/src/actions/tickets/delete.ts
@@ -1,4 +1,4 @@
-import Discord, { MessageButton, MessageActionRow } from "discord.js";
+import Discord, { ButtonBuilder, ActionRowBuilder, ButtonStyle } from "discord.js";
import client from "../../utils/client.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import getEmojiByName from "../../utils/getEmojiByName.js";
@@ -129,19 +129,19 @@
.setEmoji("GUILD.TICKET.ARCHIVED")
],
components: [
- new MessageActionRow().addComponents(
+ new ActionRowBuilder().addComponents(
[
- new MessageButton()
+ new ButtonBuilder()
.setLabel("Delete")
- .setStyle("DANGER")
+ .setStyle(ButtonStyle.Danger)
.setCustomId("closeticket")
.setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
].concat(
client.database.premium.hasPremium(interaction.guild.id)
? [
- new MessageButton()
+ new ButtonBuilder()
.setLabel("Create Transcript and Delete")
- .setStyle("PRIMARY")
+ .setStyle(ButtonStyle.Primary)
.setCustomId("createtranscript")
.setEmoji(getEmojiByName("CONTROL.DOWNLOAD", "id"))
]
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;
diff --git a/src/commands/nucleus/invite.ts b/src/commands/nucleus/invite.ts
index 341f7d2..7c36d62 100644
--- a/src/commands/nucleus/invite.ts
+++ b/src/commands/nucleus/invite.ts
@@ -1,4 +1,4 @@
-import { CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
+import { CommandInteraction, ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import client from "../../utils/client.js";
@@ -16,10 +16,10 @@
.setStatus("Danger")
],
components: [
- new MessageActionRow().addComponents([
- new MessageButton()
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder()
.setLabel("Invite")
- .setStyle("LINK")
+ .setStyle(ButtonStyle.Link)
.setURL(
`https://discord.com/api/oauth2/authorize?client_id=${client.user.id}&permissions=295157886134&scope=bot%20applications.commands`
)
diff --git a/src/commands/privacy.ts b/src/commands/privacy.ts
index 9f63602..8fce0b8 100644
--- a/src/commands/privacy.ts
+++ b/src/commands/privacy.ts
@@ -1,5 +1,5 @@
import { LoadingEmbed } from "./../utils/defaultEmbeds.js";
-import Discord, { CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
+import Discord, { CommandInteraction, ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js";
import { SelectMenuOption, SlashCommandBuilder } from "@discordjs/builders";
import { WrappedCheck } from "jshaiku";
import EmojiEmbed from "../utils/generateEmojiEmbed.js";
@@ -13,12 +13,12 @@
.setDescription("Information and options for you and your server's settings");
class Embed {
- embed: Discord.MessageEmbed;
+ embed: Discord.EmbedBuilder;
title: string;
description = "";
pageId = 0;
- components?: MessageActionRow[] = [];
- setEmbed(embed: Discord.MessageEmbed) {
+ components?: ActionRowBuilder[] = [];
+ setEmbed(embed: Discord.EmbedBuilder) {
this.embed = embed;
return this;
}
@@ -34,7 +34,7 @@
this.pageId = pageId;
return this;
}
- setComponents(components: MessageActionRow[]) {
+ setComponents(components: ActionRowBuilder[]) {
this.components = components;
return this;
}
@@ -102,11 +102,11 @@
.setDescription("Options")
.setPageId(3)
.setComponents([
- new MessageActionRow().addComponents([
- new MessageButton()
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder()
.setLabel("Clear all data")
.setCustomId("clear-all-data")
- .setStyle("DANGER")
+ .setStyle(ButtonStyle.Danger)
])
])
]
@@ -138,8 +138,8 @@
);
});
selectPane = [
- new MessageActionRow().addComponents([
- new Discord.MessageSelectMenu()
+ new ActionRowBuilder().addComponents([
+ new Discord.SelectMenuBuilder()
.addOptions(options)
.setCustomId("page")
.setMaxValues(1)
@@ -148,25 +148,25 @@
];
}
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)
])
]);
- 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: nextFooter ?? "" });
await interaction.editReply({
@@ -216,14 +216,14 @@
continue;
}
} 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));
em.setFooter({ text: "Message closed" });
interaction.editReply({ embeds: [em], components: [] });
return;
}
}
- 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 timed out" });
await interaction.editReply({
diff --git a/src/commands/role/user.ts b/src/commands/role/user.ts
index 1b91b71..bdadd9d 100644
--- a/src/commands/role/user.ts
+++ b/src/commands/role/user.ts
@@ -37,7 +37,7 @@
.setDescription(
keyValueList({
user: renderUser(interaction.options.getUser("user")),
- role: renderRole(interaction.options.getRole("role"))
+ role: renderRole(interaction.options.get("role"))
}) +
`\nAre you sure you want to ${
action === "give" ? "give the role to" : "remove the role from"
@@ -49,7 +49,7 @@
if (confirmation.success) {
try {
const member = interaction.options.getMember("user") as GuildMember;
- const role = interaction.options.getRole("role") as Role;
+ const role = interaction.options.get("role") as unknown as Role;
if (interaction.options.getString("action") === "give") {
member.roles.add(role);
} else {
diff --git a/src/commands/settings/commands.ts b/src/commands/settings/commands.ts
index 6345ec3..5260858 100644
--- a/src/commands/settings/commands.ts
+++ b/src/commands/settings/commands.ts
@@ -1,8 +1,8 @@
import { LoadingEmbed } from "./../../utils/defaultEmbeds.js";
-import Discord, { CommandInteraction, MessageActionRow, MessageButton, TextInputComponent } from "discord.js";
+import Discord, { CommandInteraction, ActionRowBuilder, ButtonBuilder, TextInputComponent, Role, ButtonStyle } from "discord.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import getEmojiByName from "../../utils/getEmojiByName.js";
-import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
+import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import { WrappedCheck } from "jshaiku";
import client from "../../utils/client.js";
import { modalInteractionCollector } from "../../utils/dualCollector.js";
@@ -23,27 +23,27 @@
});
let m;
let clicked = "";
- if (interaction.options.getRole("role")) {
+ if (interaction.options.get("role")) {
const confirmation = await new confirmationMessage(interaction)
.setEmoji("GUILD.ROLES.DELETE")
.setTitle("Moderation Commands")
.setDescription(
keyValueList({
- role: `<@&${interaction.options.getRole("role").id}>`
+ role: `<@&${(interaction.options.get("role") as unknown as Role).id}>`
})
)
.setColor("Danger")
.send(true);
if (confirmation.cancelled) return
if (confirmation.success) {
- await client.database.guilds.write(interaction.guild.id, {
- ["moderation.mute.role"]: interaction.options.getRole("role").id
+ await client.database.guilds.write(interaction!.guild.id, {
+ ["moderation.mute.role"]: (interaction.options.get("role") as unknown as Role).id
});
}
}
let timedOut = false;
while (!timedOut) {
- const config = await client.database.guilds.read(interaction.guild.id);
+ const config = await client.database.guilds.read(interaction!.guild.id);
const moderation = config.getKey("moderation");
m = await interaction.editReply({
embeds: [
@@ -58,51 +58,51 @@
)
],
components: [
- new MessageActionRow().addComponents([
- new MessageButton()
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder()
.setLabel("Warn")
.setEmoji(getEmojiByName("PUNISH.WARN.YELLOW", "id"))
.setCustomId("warn")
- .setStyle("SECONDARY"),
- new MessageButton()
+ .setStyle(ButtonStyle.Secondary),
+ new ButtonBuilder()
.setLabel("Mute")
.setEmoji(getEmojiByName("PUNISH.MUTE.YELLOW", "id"))
.setCustomId("mute")
- .setStyle("SECONDARY"),
- new MessageButton()
+ .setStyle(ButtonStyle.Secondary),
+ new ButtonBuilder()
.setLabel("Nickname")
.setEmoji(getEmojiByName("PUNISH.NICKNAME.GREEN", "id"))
.setCustomId("nickname")
- .setStyle("SECONDARY")
+ .setStyle(ButtonStyle.Secondary)
]),
- new MessageActionRow().addComponents([
- new MessageButton()
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder()
.setLabel("Kick")
.setEmoji(getEmojiByName("PUNISH.KICK.RED", "id"))
.setCustomId("kick")
- .setStyle("SECONDARY"),
- new MessageButton()
+ .setStyle(ButtonStyle.Secondary),
+ new ButtonBuilder()
.setLabel("Softban")
.setEmoji(getEmojiByName("PUNISH.BAN.YELLOW", "id"))
.setCustomId("softban")
- .setStyle("SECONDARY"),
- new MessageButton()
+ .setStyle(ButtonStyle.Secondary),
+ new ButtonBuilder()
.setLabel("Ban")
.setEmoji(getEmojiByName("PUNISH.BAN.RED", "id"))
.setCustomId("ban")
- .setStyle("SECONDARY")
+ .setStyle(ButtonStyle.Secondary)
]),
- new MessageActionRow().addComponents([
- new MessageButton()
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder()
.setLabel(clicked === "clearMuteRole" ? "Click again to confirm" : "Clear mute role")
.setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
.setCustomId("clearMuteRole")
- .setStyle("DANGER")
+ .setStyle(ButtonStyle.Danger)
.setDisabled(!moderation.mute.role),
- new MessageButton()
+ new ButtonBuilder()
.setCustomId("timeout")
.setLabel("Mute timeout " + (moderation.mute.timeout ? "Enabled" : "Disabled"))
- .setStyle(moderation.mute.timeout ? "SUCCESS" : "DANGER")
+ .setStyle(moderation.mute.timeout ? ButtonStyle.Success : ButtonStyle.Danger)
.setEmoji(getEmojiByName("CONTROL." + (moderation.mute.timeout ? "TICK" : "CROSS"), "id"))
])
]
@@ -140,7 +140,7 @@
.setCustomId("modal")
.setTitle(`Options for ${i.customId}`)
.addComponents(
- new MessageActionRow<TextInputComponent>().addComponents(
+ new ActionRowBuilder<TextInputComponent>().addComponents(
new TextInputComponent()
.setCustomId("name")
.setLabel("Button text")
@@ -149,7 +149,7 @@
.setStyle("SHORT")
.setValue(chosen.text ?? "")
),
- new MessageActionRow<TextInputComponent>().addComponents(
+ new ActionRowBuilder<TextInputComponent>().addComponents(
new TextInputComponent()
.setCustomId("url")
.setLabel("URL - Type {id} to insert the user's ID")
@@ -169,11 +169,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/settings/logs/attachment.ts b/src/commands/settings/logs/attachment.ts
index 9c9c02e..38f66fb 100644
--- a/src/commands/settings/logs/attachment.ts
+++ b/src/commands/settings/logs/attachment.ts
@@ -1,6 +1,6 @@
import { LoadingEmbed } from "./../../../utils/defaultEmbeds.js";
import { ChannelType } from "discord-api-types/v9";
-import Discord, { CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
+import Discord, { CommandInteraction, ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js";
import EmojiEmbed from "../../../utils/generateEmojiEmbed.js";
import confirmationMessage from "../../../utils/confirmationMessage.js";
import getEmojiByName from "../../../utils/getEmojiByName.js";
@@ -136,12 +136,12 @@
.setEmoji("CHANNEL.TEXT.CREATE")
],
components: [
- new MessageActionRow().addComponents([
- new MessageButton()
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder()
.setCustomId("clear")
.setLabel(clicks ? "Click again to confirm" : "Reset channel")
.setEmoji(getEmojiByName(clicks ? "TICKETS.ISSUE" : "CONTROL.CROSS", "id"))
- .setStyle("DANGER")
+ .setStyle(ButtonStyle.Danger)
.setDisabled(!channel)
])
]
@@ -177,12 +177,12 @@
.setFooter({ text: "Message closed" })
],
components: [
- new MessageActionRow().addComponents([
- new MessageButton()
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder()
.setCustomId("clear")
.setLabel("Clear")
.setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
- .setStyle("SECONDARY")
+ .setStyle(ButtonStyle.Secondary)
.setDisabled(true)
])
]
diff --git a/src/commands/settings/logs/channel.ts b/src/commands/settings/logs/channel.ts
index 49126d3..a06198d 100644
--- a/src/commands/settings/logs/channel.ts
+++ b/src/commands/settings/logs/channel.ts
@@ -1,6 +1,6 @@
import { LoadingEmbed } from "./../../../utils/defaultEmbeds.js";
import { ChannelType } from "discord-api-types/v9";
-import Discord, { CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
+import Discord, { CommandInteraction, ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js";
import EmojiEmbed from "../../../utils/generateEmojiEmbed.js";
import confirmationMessage from "../../../utils/confirmationMessage.js";
import getEmojiByName from "../../../utils/getEmojiByName.js";
@@ -129,12 +129,12 @@
.setEmoji("CHANNEL.TEXT.CREATE")
],
components: [
- new MessageActionRow().addComponents([
- new MessageButton()
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder()
.setCustomId("clear")
.setLabel(clicks ? "Click again to confirm" : "Reset channel")
.setEmoji(getEmojiByName(clicks ? "TICKETS.ISSUE" : "CONTROL.CROSS", "id"))
- .setStyle("DANGER")
+ .setStyle(ButtonStyle.Danger)
.setDisabled(!channel)
])
]
@@ -169,12 +169,12 @@
.setFooter({ text: "Message closed" })
],
components: [
- new MessageActionRow().addComponents([
- new MessageButton()
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder()
.setCustomId("clear")
.setLabel("Clear")
.setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
- .setStyle("SECONDARY")
+ .setStyle(ButtonStyle.Secondary)
.setDisabled(true)
])
]
diff --git a/src/commands/settings/logs/events.ts b/src/commands/settings/logs/events.ts
index d0db316..793d1fa 100644
--- a/src/commands/settings/logs/events.ts
+++ b/src/commands/settings/logs/events.ts
@@ -1,5 +1,5 @@
import { LoadingEmbed } from "./../../../utils/defaultEmbeds.js";
-import Discord, { CommandInteraction, Message, MessageActionRow, MessageButton, MessageSelectMenu } from "discord.js";
+import Discord, { CommandInteraction, Message, ActionRowBuilder, ButtonBuilder, SelectMenuBuilder, ButtonStyle } from "discord.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import { WrappedCheck } from "jshaiku";
import EmojiEmbed from "../../../utils/generateEmojiEmbed.js";
@@ -54,8 +54,8 @@
.setEmoji("CHANNEL.TEXT.CREATE")
],
components: [
- new MessageActionRow().addComponents([
- new MessageSelectMenu()
+ new ActionRowBuilder().addComponents([
+ new SelectMenuBuilder()
.setPlaceholder("Set events to log")
.setMaxValues(Object.keys(logs).length)
.setCustomId("logs")
@@ -68,9 +68,9 @@
}))
)
]),
- new MessageActionRow().addComponents([
- new MessageButton().setLabel("Select all").setStyle("PRIMARY").setCustomId("all"),
- new MessageButton().setLabel("Select none").setStyle("DANGER").setCustomId("none")
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder().setLabel("Select all").setStyle(ButtonStyle.Primary).setCustomId("all"),
+ new ButtonBuilder().setLabel("Select none").setStyle(ButtonStyle.Danger).setCustomId("none")
])
]
})) as Message;
diff --git a/src/commands/settings/logs/staff.ts b/src/commands/settings/logs/staff.ts
index 023a13e..44b8d69 100644
--- a/src/commands/settings/logs/staff.ts
+++ b/src/commands/settings/logs/staff.ts
@@ -1,6 +1,6 @@
import { LoadingEmbed } from "./../../../utils/defaultEmbeds.js";
import { ChannelType } from "discord-api-types/v9";
-import Discord, { CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
+import Discord, { CommandInteraction, ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js";
import EmojiEmbed from "../../../utils/generateEmojiEmbed.js";
import confirmationMessage from "../../../utils/confirmationMessage.js";
import getEmojiByName from "../../../utils/getEmojiByName.js";
@@ -134,12 +134,12 @@
.setEmoji("CHANNEL.TEXT.CREATE")
],
components: [
- new MessageActionRow().addComponents([
- new MessageButton()
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder()
.setCustomId("clear")
.setLabel(clicks ? "Click again to confirm" : "Reset channel")
.setEmoji(getEmojiByName(clicks ? "TICKETS.ISSUE" : "CONTROL.CROSS", "id"))
- .setStyle("DANGER")
+ .setStyle(ButtonStyle.Danger)
.setDisabled(!channel)
])
]
@@ -152,7 +152,7 @@
continue;
}
i.deferUpdate();
- if ((i.component as MessageButton).customId === "clear") {
+ if ((i.component as ButtonBuilder).customId === "clear") {
clicks += 1;
if (clicks === 2) {
clicks = 0;
@@ -175,12 +175,12 @@
.setFooter({ text: "Message closed" })
],
components: [
- new MessageActionRow().addComponents([
- new MessageButton()
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder()
.setCustomId("clear")
.setLabel("Clear")
.setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
- .setStyle("SECONDARY")
+ .setStyle(ButtonStyle.Secondary)
.setDisabled(true)
])
]
diff --git a/src/commands/settings/stats.ts b/src/commands/settings/stats.ts
index 932605c..1bcd49d 100644
--- a/src/commands/settings/stats.ts
+++ b/src/commands/settings/stats.ts
@@ -1,5 +1,5 @@
import { LoadingEmbed } from "./../../utils/defaultEmbeds.js";
-import Discord, { CommandInteraction, Message, MessageActionRow, MessageSelectMenu } from "discord.js";
+import Discord, { CommandInteraction, Message, ActionRowBuilder, SelectMenuBuilder } from "discord.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
@@ -152,7 +152,7 @@
while (!timedOut) {
config = await client.database.guilds.read(interaction.guild.id);
const stats = config.getKey("stats");
- const selectMenu = new MessageSelectMenu()
+ const selectMenu = new SelectMenuBuilder()
.setCustomId("remove")
.setMinValues(1)
.setMaxValues(Math.max(1, Object.keys(stats).length));
@@ -167,7 +167,7 @@
.setEmoji("CHANNEL.TEXT.CREATE")
],
components: [
- new MessageActionRow().addComponents(
+ new ActionRowBuilder().addComponents(
Object.keys(stats).length
? [
selectMenu
diff --git a/src/commands/settings/tickets.ts b/src/commands/settings/tickets.ts
index 863c659..d6dee70 100644
--- a/src/commands/settings/tickets.ts
+++ b/src/commands/settings/tickets.ts
@@ -6,14 +6,15 @@
CommandInteraction,
GuildChannel,
Message,
- MessageActionRow,
- MessageActionRowComponent,
- MessageButton,
+ ActionRowBuilder,
+ Component,
+ ButtonBuilder,
MessageComponentInteraction,
- MessageSelectMenu,
+ SelectMenuBuilder,
Role,
SelectMenuInteraction,
- TextInputComponent
+ TextInputComponent,
+ ButtonStyle
} from "discord.js";
import { SelectMenuOption, SlashCommandSubcommandBuilder } from "@discordjs/builders";
import { ChannelType } from "discord-api-types/v9";
@@ -233,41 +234,41 @@
m = (await interaction.editReply({
embeds: [embed],
components: [
- new MessageActionRow().addComponents([
- new MessageButton()
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder()
.setLabel("Tickets " + (data.enabled ? "enabled" : "disabled"))
.setEmoji(getEmojiByName("CONTROL." + (data.enabled ? "TICK" : "CROSS"), "id"))
- .setStyle(data.enabled ? "SUCCESS" : "DANGER")
+ .setStyle(data.enabled ? ButtonStyle.Success : ButtonStyle.Danger)
.setCustomId("enabled"),
- new MessageButton()
+ new ButtonBuilder()
.setLabel(lastClicked === "cat" ? "Click again to confirm" : "Clear category")
.setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
- .setStyle("DANGER")
+ .setStyle(ButtonStyle.Danger)
.setCustomId("clearCategory")
.setDisabled(data.category === null),
- new MessageButton()
+ new ButtonBuilder()
.setLabel(lastClicked === "max" ? "Click again to confirm" : "Reset max tickets")
.setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
- .setStyle("DANGER")
+ .setStyle(ButtonStyle.Danger)
.setCustomId("clearMaxTickets")
.setDisabled(data.maxTickets === 5),
- new MessageButton()
+ new ButtonBuilder()
.setLabel(lastClicked === "sup" ? "Click again to confirm" : "Clear support ping")
.setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
- .setStyle("DANGER")
+ .setStyle(ButtonStyle.Danger)
.setCustomId("clearSupportPing")
.setDisabled(data.supportRole === null)
]),
- new MessageActionRow().addComponents([
- new MessageButton()
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder()
.setLabel("Manage types")
.setEmoji(getEmojiByName("TICKETS.OTHER", "id"))
- .setStyle("SECONDARY")
+ .setStyle(ButtonStyle.Secondary)
.setCustomId("manageTypes"),
- new MessageButton()
+ new ButtonBuilder()
.setLabel("Add create ticket button")
.setEmoji(getEmojiByName("TICKETS.SUGGESTION", "id"))
- .setStyle("PRIMARY")
+ .setStyle(ButtonStyle.Primary)
.setCustomId("send")
])
]
@@ -280,25 +281,25 @@
continue;
}
i.deferUpdate();
- if ((i.component as MessageActionRowComponent).customId === "clearCategory") {
+ if ((i.component as Component).customId === "clearCategory") {
if (lastClicked === "cat") {
lastClicked = "";
await client.database.guilds.write(interaction.guild!.id, null, ["tickets.category"]);
data.category = undefined;
} else lastClicked = "cat";
- } else if ((i.component as MessageActionRowComponent).customId === "clearMaxTickets") {
+ } else if ((i.component as Component).customId === "clearMaxTickets") {
if (lastClicked === "max") {
lastClicked = "";
await client.database.guilds.write(interaction.guild!.id, null, ["tickets.maxTickets"]);
data.maxTickets = 5;
} else lastClicked = "max";
- } else if ((i.component as MessageActionRowComponent).customId === "clearSupportPing") {
+ } else if ((i.component as Component).customId === "clearSupportPing") {
if (lastClicked === "sup") {
lastClicked = "";
await client.database.guilds.write(interaction.guild!.id, null, ["tickets.supportRole"]);
data.supportRole = undefined;
} else lastClicked = "sup";
- } else if ((i.component as MessageActionRowComponent).customId === "send") {
+ } else if ((i.component as Component).customId === "send") {
const ticketMessages = [
{
label: "Create ticket",
@@ -331,8 +332,8 @@
.setEmoji("GUILD.ROLES.CREATE")
],
components: [
- new MessageActionRow().addComponents([
- new MessageSelectMenu()
+ new ActionRowBuilder().addComponents([
+ new SelectMenuBuilder()
.setOptions(
ticketMessages.map(
(
@@ -357,18 +358,18 @@
.setMinValues(1)
.setPlaceholder("Select a message template")
]),
- new MessageActionRow().addComponents([
- new MessageButton()
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder()
.setCustomId("back")
.setLabel("Back")
.setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
- .setStyle("DANGER"),
- new MessageButton().setCustomId("blank").setLabel("Empty").setStyle("SECONDARY"),
- new MessageButton()
+ .setStyle(ButtonStyle.Danger),
+ new ButtonBuilder().setCustomId("blank").setLabel("Empty").setStyle(ButtonStyle.Secondary),
+ new ButtonBuilder()
.setCustomId("custom")
.setLabel("Custom")
.setEmoji(getEmojiByName("TICKETS.OTHER", "id"))
- .setStyle("PRIMARY")
+ .setStyle(ButtonStyle.Primary)
])
]
});
@@ -379,7 +380,7 @@
innerTimedOut = true;
continue;
}
- if ((i.component as MessageActionRowComponent).customId === "template") {
+ if ((i.component as Component).customId === "template") {
i.deferUpdate();
await interaction.channel!.send({
embeds: [
@@ -392,39 +393,39 @@
.setEmoji("GUILD.TICKET.OPEN")
],
components: [
- new MessageActionRow().addComponents([
- new MessageButton()
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder()
.setLabel("Create Ticket")
.setEmoji(getEmojiByName("CONTROL.TICK", "id"))
- .setStyle("SUCCESS")
+ .setStyle(ButtonStyle.Success)
.setCustomId("createticket")
])
]
});
templateSelected = true;
continue;
- } else if ((i.component as MessageActionRowComponent).customId === "blank") {
+ } else if ((i.component as Component).customId === "blank") {
i.deferUpdate();
await interaction.channel!.send({
components: [
- new MessageActionRow().addComponents([
- new MessageButton()
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder()
.setLabel("Create Ticket")
.setEmoji(getEmojiByName("TICKETS.SUGGESTION", "id"))
- .setStyle("SUCCESS")
+ .setStyle(ButtonStyle.Success)
.setCustomId("createticket")
])
]
});
templateSelected = true;
continue;
- } else if ((i.component as MessageActionRowComponent).customId === "custom") {
+ } else if ((i.component as Component).customId === "custom") {
await i.showModal(
new Discord.Modal()
.setCustomId("modal")
.setTitle("Enter embed details")
.addComponents(
- new MessageActionRow<TextInputComponent>().addComponents(
+ new ActionRowBuilder<TextInputComponent>().addComponents(
new TextInputComponent()
.setCustomId("title")
.setLabel("Title")
@@ -432,7 +433,7 @@
.setRequired(true)
.setStyle("SHORT")
),
- new MessageActionRow<TextInputComponent>().addComponents(
+ new ActionRowBuilder<TextInputComponent>().addComponents(
new TextInputComponent()
.setCustomId("description")
.setLabel("Description")
@@ -451,11 +452,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")
])
]
@@ -483,11 +484,11 @@
.setEmoji("GUILD.TICKET.OPEN")
],
components: [
- new MessageActionRow().addComponents([
- new MessageButton()
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder()
.setLabel("Create Ticket")
.setEmoji(getEmojiByName("TICKETS.SUGGESTION", "id"))
- .setStyle("SUCCESS")
+ .setStyle(ButtonStyle.Success)
.setCustomId("createticket")
])
]
@@ -496,12 +497,12 @@
}
}
}
- } else if ((i.component as MessageActionRowComponent).customId === "enabled") {
+ } else if ((i.component as Component).customId === "enabled") {
await client.database.guilds.write(interaction.guild.id, {
"tickets.enabled": !data.enabled
});
data.enabled = !data.enabled;
- } else if ((i.component as MessageActionRowComponent).customId === "manageTypes") {
+ } else if ((i.component as Component).customId === "manageTypes") {
data = await manageTypes(interaction, data, m as Message);
}
}
@@ -537,8 +538,8 @@
],
components: (customTypes
? [
- new MessageActionRow().addComponents([
- new Discord.MessageSelectMenu()
+ new ActionRowBuilder().addComponents([
+ new Discord.SelectMenuBuilder()
.setCustomId("removeTypes")
.setPlaceholder("Select types to remove")
.setMaxValues(customTypes.length)
@@ -553,21 +554,21 @@
]
: []
).concat([
- new MessageActionRow().addComponents([
- new MessageButton()
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder()
.setLabel("Back")
.setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
- .setStyle("PRIMARY")
+ .setStyle(ButtonStyle.Primary)
.setCustomId("back"),
- new MessageButton()
+ new ButtonBuilder()
.setLabel("Add new type")
.setEmoji(getEmojiByName("TICKETS.SUGGESTION", "id"))
- .setStyle("PRIMARY")
+ .setStyle(ButtonStyle.Primary)
.setCustomId("addType")
.setDisabled(customTypes !== null && customTypes.length >= 25),
- new MessageButton()
+ new ButtonBuilder()
.setLabel("Switch to default types")
- .setStyle("SECONDARY")
+ .setStyle(ButtonStyle.Secondary)
.setCustomId("switchToDefault")
])
])
@@ -585,8 +586,8 @@
})
);
});
- const selectPane = new MessageActionRow().addComponents([
- new Discord.MessageSelectMenu()
+ const selectPane = new ActionRowBuilder().addComponents([
+ new Discord.SelectMenuBuilder()
.addOptions(options)
.setCustomId("types")
.setMaxValues(ticketTypes.length)
@@ -609,15 +610,15 @@
],
components: [
selectPane,
- new MessageActionRow().addComponents([
- new MessageButton()
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder()
.setLabel("Back")
.setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
- .setStyle("PRIMARY")
+ .setStyle(ButtonStyle.Primary)
.setCustomId("back"),
- new MessageButton()
+ new ButtonBuilder()
.setLabel("Switch to custom types")
- .setStyle("SECONDARY")
+ .setStyle(ButtonStyle.Secondary)
.setCustomId("switchToCustom")
])
]
@@ -655,7 +656,7 @@
.setCustomId("modal")
.setTitle("Enter a name for the new type")
.addComponents(
- new MessageActionRow<TextInputComponent>().addComponents(
+ new ActionRowBuilder<TextInputComponent>().addComponents(
new TextInputComponent()
.setCustomId("type")
.setLabel("Name")
@@ -676,11 +677,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/settings/verify.ts b/src/commands/settings/verify.ts
index 29beffe..b3eb11a 100644
--- a/src/commands/settings/verify.ts
+++ b/src/commands/settings/verify.ts
@@ -3,15 +3,16 @@
CommandInteraction,
Interaction,
Message,
- MessageActionRow,
- MessageActionRowComponent,
- MessageButton,
+ ActionRowBuilder,
+ Component,
+ ButtonBuilder,
MessageComponentInteraction,
- MessageSelectMenu,
+ SelectMenuBuilder,
ModalSubmitInteraction,
Role,
SelectMenuInteraction,
- TextInputComponent
+ TextInputComponent,
+ ButtonStyle
} from "discord.js";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
import confirmationMessage from "../../utils/confirmationMessage.js";
@@ -138,18 +139,18 @@
.setEmoji("GUILD.ROLES.CREATE")
],
components: [
- new MessageActionRow().addComponents([
- new MessageButton()
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder()
.setCustomId("clear")
.setLabel(clicks ? "Click again to confirm" : "Reset role")
.setEmoji(getEmojiByName(clicks ? "TICKETS.ISSUE" : "CONTROL.CROSS", "id"))
- .setStyle("DANGER")
+ .setStyle(ButtonStyle.Danger)
.setDisabled(!role),
- new MessageButton()
+ new ButtonBuilder()
.setCustomId("send")
.setLabel("Add verify button")
.setEmoji(getEmojiByName("TICKETS.SUGGESTION", "id"))
- .setStyle("PRIMARY")
+ .setStyle(ButtonStyle.Primary)
])
]
});
@@ -161,14 +162,14 @@
continue;
}
i.deferUpdate();
- if ((i.component as MessageActionRowComponent).customId === "clear") {
+ if ((i.component as Component).customId === "clear") {
clicks += 1;
if (clicks === 2) {
clicks = 0;
await client.database.guilds.write(interaction.guild!.id, null, ["verify.role", "verify.enabled"]);
role = undefined;
}
- } else if ((i.component as MessageActionRowComponent).customId === "send") {
+ } else if ((i.component as Component).customId === "send") {
const verifyMessages = [
{
label: "Verify",
@@ -198,8 +199,8 @@
.setEmoji("GUILD.ROLES.CREATE")
],
components: [
- new MessageActionRow().addComponents([
- new MessageSelectMenu()
+ new ActionRowBuilder().addComponents([
+ new SelectMenuBuilder()
.setOptions(
verifyMessages.map(
(
@@ -224,18 +225,18 @@
.setMinValues(1)
.setPlaceholder("Select a message template")
]),
- new MessageActionRow().addComponents([
- new MessageButton()
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder()
.setCustomId("back")
.setLabel("Back")
.setEmoji(getEmojiByName("CONTROL.LEFT", "id"))
- .setStyle("DANGER"),
- new MessageButton().setCustomId("blank").setLabel("Empty").setStyle("SECONDARY"),
- new MessageButton()
+ .setStyle(ButtonStyle.Danger),
+ new ButtonBuilder().setCustomId("blank").setLabel("Empty").setStyle(ButtonStyle.Secondary),
+ new ButtonBuilder()
.setCustomId("custom")
.setLabel("Custom")
.setEmoji(getEmojiByName("TICKETS.OTHER", "id"))
- .setStyle("PRIMARY")
+ .setStyle(ButtonStyle.Primary)
])
]
});
@@ -246,7 +247,7 @@
innerTimedOut = true;
continue;
}
- if ((i.component as MessageActionRowComponent).customId === "template") {
+ if ((i.component as Component).customId === "template") {
i.deferUpdate();
await interaction.channel!.send({
embeds: [
@@ -259,39 +260,39 @@
.setEmoji("CONTROL.BLOCKTICK")
],
components: [
- new MessageActionRow().addComponents([
- new MessageButton()
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder()
.setLabel("Verify")
.setEmoji(getEmojiByName("CONTROL.TICK", "id"))
- .setStyle("SUCCESS")
+ .setStyle(ButtonStyle.Success)
.setCustomId("verifybutton")
])
]
});
templateSelected = true;
continue;
- } else if ((i.component as MessageActionRowComponent).customId === "blank") {
+ } else if ((i.component as Component).customId === "blank") {
i.deferUpdate();
await interaction.channel!.send({
components: [
- new MessageActionRow().addComponents([
- new MessageButton()
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder()
.setLabel("Verify")
.setEmoji(getEmojiByName("CONTROL.TICK", "id"))
- .setStyle("SUCCESS")
+ .setStyle(ButtonStyle.Success)
.setCustomId("verifybutton")
])
]
});
templateSelected = true;
continue;
- } else if ((i.component as MessageActionRowComponent).customId === "custom") {
+ } else if ((i.component as Component).customId === "custom") {
await i.showModal(
new Discord.Modal()
.setCustomId("modal")
.setTitle("Enter embed details")
.addComponents(
- new MessageActionRow<TextInputComponent>().addComponents(
+ new ActionRowBuilder<TextInputComponent>().addComponents(
new TextInputComponent()
.setCustomId("title")
.setLabel("Title")
@@ -299,7 +300,7 @@
.setRequired(true)
.setStyle("SHORT")
),
- new MessageActionRow<TextInputComponent>().addComponents(
+ new ActionRowBuilder<TextInputComponent>().addComponents(
new TextInputComponent()
.setCustomId("description")
.setLabel("Description")
@@ -318,11 +319,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")
])
]
@@ -352,11 +353,11 @@
.setEmoji("CONTROL.BLOCKTICK")
],
components: [
- new MessageActionRow().addComponents([
- new MessageButton()
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder()
.setLabel("Verify")
.setEmoji(getEmojiByName("CONTROL.TICK", "id"))
- .setStyle("SUCCESS")
+ .setStyle(ButtonStyle.Success)
.setCustomId("verifybutton")
])
]
diff --git a/src/commands/settings/welcome.ts b/src/commands/settings/welcome.ts
index 16857ac..679a63d 100644
--- a/src/commands/settings/welcome.ts
+++ b/src/commands/settings/welcome.ts
@@ -3,10 +3,11 @@
Channel,
CommandInteraction,
Message,
- MessageActionRow,
- MessageButton,
+ ActionRowBuilder,
+ ButtonBuilder,
MessageComponentInteraction,
- Role
+ Role,
+ ButtonStyle
} from "discord.js";
import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
@@ -203,36 +204,36 @@
.setEmoji("CHANNEL.TEXT.CREATE")
],
components: [
- new MessageActionRow().addComponents([
- new MessageButton()
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder()
.setLabel(lastClicked == "clear-message" ? "Click again to confirm" : "Clear Message")
.setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
.setCustomId("clear-message")
.setDisabled(!config.welcome.message)
- .setStyle("DANGER"),
- new MessageButton()
+ .setStyle(ButtonStyle.Danger),
+ new ButtonBuilder()
.setLabel(lastClicked == "clear-role" ? "Click again to confirm" : "Clear Role")
.setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
.setCustomId("clear-role")
.setDisabled(!config.welcome.role)
- .setStyle("DANGER"),
- new MessageButton()
+ .setStyle(ButtonStyle.Danger),
+ new ButtonBuilder()
.setLabel(lastClicked == "clear-ping" ? "Click again to confirm" : "Clear Ping")
.setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
.setCustomId("clear-ping")
.setDisabled(!config.welcome.ping)
- .setStyle("DANGER"),
- new MessageButton()
+ .setStyle(ButtonStyle.Danger),
+ new ButtonBuilder()
.setLabel(lastClicked == "clear-channel" ? "Click again to confirm" : "Clear Channel")
.setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
.setCustomId("clear-channel")
.setDisabled(!config.welcome.channel)
- .setStyle("DANGER"),
- new MessageButton()
+ .setStyle(ButtonStyle.Danger),
+ new ButtonBuilder()
.setLabel("Set Channel to DM")
.setCustomId("set-channel-dm")
.setDisabled(config.welcome.channel == "dm")
- .setStyle("SECONDARY")
+ .setStyle(ButtonStyle.Secondary)
])
]
})) as Message;
diff --git a/src/commands/tag.ts b/src/commands/tag.ts
index d65109d..7a1e8fa 100644
--- a/src/commands/tag.ts
+++ b/src/commands/tag.ts
@@ -1,4 +1,4 @@
-import { AutocompleteInteraction, CommandInteraction, MessageActionRow, MessageButton } from "discord.js";
+import { AutocompleteInteraction, CommandInteraction, ActionRowBuilder, ButtonBuilder, ButtonStyle } from "discord.js";
import { SlashCommandBuilder } from "@discordjs/builders";
import client from "../utils/client.js";
import EmojiEmbed from "../utils/generateEmojiEmbed.js";
@@ -29,7 +29,7 @@
if (tag.match(/^(http|https):\/\/[^ "]+$/)) {
url = tag;
components = [
- new MessageActionRow().addComponents([new MessageButton().setLabel("Open").setURL(url).setStyle("LINK")])
+ new ActionRowBuilder().addComponents([new ButtonBuilder().setLabel("Open").setURL(url).setStyle(ButtonStyle.Link)])
];
}
return await interaction.reply({
diff --git a/src/commands/tags/list.ts b/src/commands/tags/list.ts
index e9e8b41..aee4c71 100644
--- a/src/commands/tags/list.ts
+++ b/src/commands/tags/list.ts
@@ -2,13 +2,14 @@
import Discord, {
CommandInteraction,
Message,
- MessageActionRow,
- MessageActionRowComponent,
- MessageButton,
+ ActionRowBuilder,
+ Component,
+ ButtonBuilder,
MessageComponentInteraction,
- MessageEmbed,
+ EmbedBuilder,
SelectMenuInteraction,
- MessageSelectOptionData
+ MessageSelectOptionData,
+ ButtonStyle
} from "discord.js";
import type { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import EmojiEmbed from "../../utils/generateEmojiEmbed.js";
@@ -17,11 +18,11 @@
import createPageIndicator from "../../utils/createPageIndicator.js";
class Embed {
- embed: Discord.MessageEmbed = new MessageEmbed();
+ embed: Discord.EmbedBuilder = new EmbedBuilder();
title: string = "";
description = "";
pageId = 0;
- setEmbed(embed: Discord.MessageEmbed) {
+ setEmbed(embed: Discord.EmbedBuilder) {
this.embed = embed;
return this;
}
@@ -85,7 +86,7 @@
let cancelled = false;
let timedOut = false;
while (!cancelled && !timedOut) {
- let selectPane: MessageActionRow[] = [];
+ let selectPane: ActionRowBuilder[] = [];
if (selectPaneOpen) {
const options: MessageSelectOptionData[] = [];
@@ -97,8 +98,8 @@
});
});
selectPane = [
- new MessageActionRow().addComponents([
- new Discord.MessageSelectMenu()
+ new ActionRowBuilder().addComponents([
+ new Discord.SelectMenuBuilder()
.addOptions(options)
.setCustomId("page")
.setMaxValues(1)
@@ -106,31 +107,31 @@
])
];
}
- 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: 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),
- new MessageButton()
+ new ButtonBuilder()
.setCustomId("close")
.setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
- .setStyle("DANGER")
+ .setStyle(ButtonStyle.Danger)
])
])
});
@@ -142,22 +143,22 @@
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 < pages.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;
} else {
cancelled = true;
}
}
- const em = new Discord.MessageEmbed(pages[page]!.embed);
+ const em = new Discord.EmbedBuilder(pages[page]!.embed);
if (timedOut) {
em.setDescription(em.description + "\n\n" + createPageIndicator(pages.length, page) + " | Message timed out");
} else {
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
diff --git a/src/premium/createTranscript.ts b/src/premium/createTranscript.ts
index 97d0d28..f2358d8 100644
--- a/src/premium/createTranscript.ts
+++ b/src/premium/createTranscript.ts
@@ -2,10 +2,11 @@
CommandInteraction,
GuildMember,
Message,
- MessageActionRow,
- MessageButton,
+ ActionRowBuilder,
+ ButtonBuilder,
MessageComponentInteraction,
- TextChannel
+ TextChannel,
+ ButtonStyle
} from "discord.js";
import EmojiEmbed from "../utils/generateEmojiEmbed.js";
import getEmojiByName from "../utils/getEmojiByName.js";
@@ -76,11 +77,11 @@
.setEmoji("CONTROL.DOWNLOAD")
],
components: [
- new MessageActionRow().addComponents([
- new MessageButton().setLabel("View").setStyle("LINK").setURL(url),
- new MessageButton()
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder().setLabel("View").setStyle(ButtonStyle.Link).setURL(url),
+ new ButtonBuilder()
.setLabel("Delete")
- .setStyle("DANGER")
+ .setStyle(ButtonStyle.Danger)
.setCustomId("close")
.setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
])
@@ -99,10 +100,10 @@
.setEmoji("CONTROL.DOWNLOAD")
],
components: [
- new MessageActionRow().addComponents([
- new MessageButton()
+ new ActionRowBuilder().addComponents([
+ new ButtonBuilder()
.setLabel("Delete")
- .setStyle("DANGER")
+ .setStyle(ButtonStyle.Danger)
.setCustomId("close")
.setEmoji(getEmojiByName("CONTROL.CROSS", "id"))
])
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}`)
])
]
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" : "") +