fixed /user tracks & /settings tracks. Added presets to /server buttons
diff --git a/src/commands/server/buttons.ts b/src/commands/server/buttons.ts
index 74c255c..c89e481 100644
--- a/src/commands/server/buttons.ts
+++ b/src/commands/server/buttons.ts
@@ -20,6 +20,7 @@
import lodash from "lodash";
import getEmojiByName from "../../utils/getEmojiByName.js";
import { modalInteractionCollector } from "../../utils/dualCollector.js";
+import _ from "lodash";
export const command = new SlashCommandSubcommandBuilder()
.setName("buttons")
@@ -50,6 +51,27 @@
createticket: "Create Ticket"
};
+const presetButtons = [
+ {
+ title: "Verify",
+ description: "Click the button below to get verified in the server.",
+ buttons: ["verifybutton"],
+ color: "GREEN"
+ },
+ {
+ title: "Get Roles",
+ description: "Click the button to choose which roles you would like in the server",
+ buttons: ["rolemenu"],
+ color: "BLUE"
+ },
+ {
+ title: "Create Ticket",
+ description: "Click the button below to create a ticket",
+ buttons: ["createticket"],
+ color: "RED"
+ }
+]
+
export const callback = async (interaction: CommandInteraction): Promise<void> => {
const m = await interaction.reply({
embeds: LoadingEmbed,
@@ -58,7 +80,7 @@
});
let closed = false;
- const data: Data = {
+ let data: Data = {
buttons: [],
title: null,
description: null,
@@ -71,7 +93,7 @@
.setCustomId("edit")
.setLabel("Edit Embed")
.setStyle(ButtonStyle.Secondary)
- .setEmoji(getEmojiByName("ICONS.EDIT") as APIMessageComponentEmoji),
+ .setEmoji(getEmojiByName("ICONS.EDIT", "id") as APIMessageComponentEmoji),
new ButtonBuilder()
.setCustomId("send")
.setLabel("Send")
@@ -95,6 +117,22 @@
)
);
+ const presetSelect = new ActionRowBuilder<StringSelectMenuBuilder>().addComponents(
+ new StringSelectMenuBuilder()
+ .setCustomId("preset")
+ .setPlaceholder("Select a preset")
+ .setMaxValues(1)
+ .addOptions(
+ presetButtons.map((preset, i) => {
+ return new StringSelectMenuOptionBuilder()
+ .setLabel(preset.title)
+ .setValue(i.toString())
+ .setDescription(preset.description)
+ .setEmoji(getEmojiByName("COLORS." + preset.color, "id") as APIMessageComponentEmoji)
+ })
+ )
+ )
+
const buttonSelect = new ActionRowBuilder<StringSelectMenuBuilder>().addComponents(
new StringSelectMenuBuilder()
.setCustomId("button")
@@ -141,7 +179,7 @@
await interaction.editReply({
embeds: [embed],
- components: [colorSelect, buttonSelect, channelMenu, buttons]
+ components: [presetSelect, colorSelect, buttonSelect, channelMenu, buttons]
});
let i: Discord.ButtonInteraction | Discord.ChannelSelectMenuInteraction | Discord.StringSelectMenuInteraction;
@@ -257,6 +295,12 @@
console.log(err);
}
switch (i.customId) {
+ case "preset": {
+ const chosen = presetButtons[parseInt(i.values[0]!)]!;
+ const newColor = colors[chosen.color!]!
+ data = _.assign(data, chosen, { color: newColor });
+ break;
+ }
case "color": {
data.color = colors[i.values[0]!]!;
break;