From 0c639caa6e905d9972ebc2d2d6c14063a2f8ac3d Mon Sep 17 00:00:00 2001 From: nick <62725534+nicklvh@users.noreply.github.com> Date: Wed, 3 Apr 2024 01:05:30 +0100 Subject: [PATCH] feat: new starboard settings --- src/commands/settings/settings.ts | 43 ++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/src/commands/settings/settings.ts b/src/commands/settings/settings.ts index 77dbc7d..2f8cbc9 100644 --- a/src/commands/settings/settings.ts +++ b/src/commands/settings/settings.ts @@ -123,7 +123,41 @@ export class SettingsCommand extends Command { const id = componentInteraction.customId; if (componentInteraction.isButton()) { + if (id.startsWith("stars")) { + if (id.endsWith("Change")) { + const leftButton = new ButtonBuilder() + .setEmoji("⬅") + .setStyle(ButtonStyle.Secondary) + .setCustomId("starsLeft"); + + const rightButton = new ButtonBuilder() + .setEmoji("➡") + .setStyle(ButtonStyle.Secondary) + .setCustomId("starsRight"); + + await componentInteraction.update({ + embeds: [ + new EmbedBuilder() + .setAuthor({ + name: "Configuring the stars required", + iconURL: interaction.guild.iconURL() || "", + }) + .addFields([ + { + name: "Use the arrows below to increase or decrease the amount of stars needed to post in the starboard", + value: `**Current:** ${starboard!.starsRequired}`, + }, + ]) + .setColor("Yellow"), + ], + }); + } + } + if (id === "logging" || id === "starboard" || id === "fun") { + const { logging, starboard } = + await this.container.helpers.getGuild(interaction.guildId); + const toggleButton = new ButtonBuilder() .setCustomId( `${id}${guildInDB[id]!.enabled ? "Disable" : "Enable"}` @@ -177,6 +211,12 @@ export class SettingsCommand extends Command { } if (id === "starboard") { + const starsButton = new ButtonBuilder() + .setLabel("Stars") + .setCustomId("starsChange") + .setEmoji("⭐") + .setStyle(ButtonStyle.Primary); + await componentInteraction.update({ embeds: [ new EmbedBuilder() @@ -188,7 +228,7 @@ export class SettingsCommand extends Command { { name: `Use the buttons below to edit the settings for ${bold(`${interaction.guild.name}'s`)} starboard!`, value: [ - `**Stars Required:** ${bold(starboard?.starsRequired?.toString()!)}`, + `**Stars Required:** ${bold(starboard?.starsRequired?.toString()!)} ${starboard?.starsRequired === 5 ? "(Default)" : ""}`, ].join("\n"), }, ]) @@ -196,6 +236,7 @@ export class SettingsCommand extends Command { ], components: [ new ActionRowBuilder().addComponents( + starsButton, toggleButton ), goBackRow,