moved to d.js 14.3.0, started fixing errors
Co-authored-by: PineappleFan <pineapplefanyt@gmail.com>
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;