From 7eff1364be166e339996a7eec41742690580e040 Mon Sep 17 00:00:00 2001 From: ChrisChrome Date: Mon, 15 Sep 2025 10:38:33 -0600 Subject: [PATCH] Gwug --- commands/createproduct.js | 20 +++++++++- commands/settings.js | 84 ++++++++++++++++++++++++--------------- commands/update.js | 35 +++++++++++----- 3 files changed, 95 insertions(+), 44 deletions(-) diff --git a/commands/createproduct.js b/commands/createproduct.js index b130dcd..f5d95e6 100644 --- a/commands/createproduct.js +++ b/commands/createproduct.js @@ -30,8 +30,24 @@ const execute = async (interaction) => { // Proceed with creation await interaction.reply({ ephemeral: true, content: "Getting things ready..." }); await interaction.user.send({ content: `Creating product: \`${productName}\`` }); - await interaction.user.send({ content: "Please provide a description for the product. Say `cancel` to exit." }); - interaction.editReply({ephemeral: true, content: "Check your DMs!"}); + const finalMsg = await interaction.user.send({ content: "Please provide a description for the product. Say `cancel` to exit." }); + await interaction.editReply({ + ephemeral: true, + content: "Check your DMs!", + components: [ + { + type: 1, // ActionRow + components: [ + { + type: 2, // Button + style: 5, // Link button + label: "Go there!", + url: finalMsg.url + } + ] + } + ] + }); global.productCreationData[interaction.user.id] = { name: productName, step: 1, diff --git a/commands/settings.js b/commands/settings.js index aa75804..56bf512 100644 --- a/commands/settings.js +++ b/commands/settings.js @@ -16,40 +16,58 @@ const execute = async (interaction) => { } // Proceed with settings menu await interaction.reply({ ephemeral: true, content: "Getting things ready..." }); - await interaction.user.send({ embeds: [{ - title: 'Welcome to Hub Settings!', - description: 'Below are your current hub settings.', - color: 0x00AE86, - fields: [ - { name: "Hub ID", value: hubResult[0].id }, - { name: "Hub Name", value: hubResult[0].name }, - { name: "Owner Discord ID", value: hubResult[0].ownerId.toString() }, - { name: "Discord Guild ID", value: hubResult[0].discordGuild.toString() }, - { name: "Short Description", value: hubResult[0].shortDescription }, - { name: "Long Description", value: hubResult[0].longDescription }, - { name: "Allow Gift Purchase", value: hubResult[0].allowGiftPurchase ? "Yes" : "No" }, - { name: "Terms of Service", value: hubResult[0].tos }, - { name: "Background Music ID", value: hubResult[0].bgmId ? hubResult[0].bgmId.toString() : "None" }, - { name: "Log Channel ID", value: hubResult[0].logChannel ? hubResult[0].logChannel.toString() : "Not Set" }, - { name: "Secret Key", value: `||\`${hubResult[0].secretKey}\`||` } + await interaction.user.send({ + embeds: [{ + title: 'Welcome to Hub Settings!', + description: 'Below are your current hub settings.', + color: 0x00AE86, + fields: [ + { name: "Hub ID", value: hubResult[0].id }, + { name: "Hub Name", value: hubResult[0].name }, + { name: "Owner Discord ID", value: hubResult[0].ownerId.toString() }, + { name: "Discord Guild ID", value: hubResult[0].discordGuild.toString() }, + { name: "Short Description", value: hubResult[0].shortDescription }, + { name: "Long Description", value: hubResult[0].longDescription }, + { name: "Allow Gift Purchase", value: hubResult[0].allowGiftPurchase ? "Yes" : "No" }, + { name: "Terms of Service", value: hubResult[0].tos }, + { name: "Background Music ID", value: hubResult[0].bgmId ? hubResult[0].bgmId.toString() : "None" }, + { name: "Log Channel ID", value: hubResult[0].logChannel ? hubResult[0].logChannel.toString() : "Not Set" }, + { name: "Secret Key", value: `||\`${hubResult[0].secretKey}\`||` } + ] + }, { + description: `Options`, + color: 0x00AE86, + fields: [ + { name: "1. Edit Short Description", value: "Change the short description of the hub." }, + { name: "2. Edit Long Description", value: "Change the long description of the hub." }, + { name: "3. Toggle Allow Gift Purchase", value: "Enable or disable allowing users to buy gifts for others on this hub." }, + { name: "4. Edit Terms of Service", value: "Change the terms of service for this hub." }, + { name: "5. Regenerate Secret Key", value: "Generate a new secret key for this hub. (Old key will be invalidated)" }, + { name: "6. Parcel Auto-Import", value: "Set up automatic importing of Parcel purchases when linking." }, + { name: "7. Set Background Music", value: "Set or change the background music for this hub." }, + { name: "8. Set Log Channel", value: "Set or change the log channel for this hub." }, + { name: "99. Delete hub and all products", value: "***__WARNING: THIS IS DANGEROUS__***" } + ] + }] + }); + const finalMsg = await interaction.user.send({ content: "Say an option number, or `cancel` to exit!" }); + await interaction.editReply({ + ephemeral: true, + content: "Check your DMs!", + components: [ + { + type: 1, // ActionRow + components: [ + { + type: 2, // Button + style: 5, // Link button + label: "Go there!", + url: finalMsg.url + } + ] + } ] - },{ - description: `Options`, - color: 0x00AE86, - fields: [ - { name: "1. Edit Short Description", value: "Change the short description of the hub." }, - { name: "2. Edit Long Description", value: "Change the long description of the hub." }, - { name: "3. Toggle Allow Gift Purchase", value: "Enable or disable allowing users to buy gifts for others on this hub." }, - { name: "4. Edit Terms of Service", value: "Change the terms of service for this hub." }, - { name: "5. Regenerate Secret Key", value: "Generate a new secret key for this hub. (Old key will be invalidated)" }, - { name: "6. Parcel Auto-Import", value: "Set up automatic importing of Parcel purchases when linking." }, - { name: "7. Set Background Music", value: "Set or change the background music for this hub." }, - { name: "8. Set Log Channel", value: "Set or change the log channel for this hub." }, - { name: "99. Delete hub and all products", value: "***__WARNING: THIS IS DANGEROUS__***" } - ] - }] }); - await interaction.user.send({ content: "Say an option number, or `cancel` to exit!" }); - interaction.editReply({ephemeral: true, content: "Check your DMs!"}); + }); global.hubSettingsHandlers[interaction.user.id] = { step: 1, hub: hubResult[0].id diff --git a/commands/update.js b/commands/update.js index bc828b2..6fb8d1d 100644 --- a/commands/update.js +++ b/commands/update.js @@ -20,35 +20,52 @@ const execute = async (interaction) => { // Proceed with creation await interaction.reply({ ephemeral: true, content: "Getting things ready..." }); await interaction.user.send({ content: `Updating product: \`${product.name}\`` }); + let finalMsg; switch (interaction.options.getString("field")) { case "name": - await interaction.user.send({ content: "Please provide a new name for the product. Say `cancel` to exit." }); + finalMsg = await interaction.user.send({ content: "Please provide a new name for the product. Say `cancel` to exit." }); break; case "description": - await interaction.user.send({ content: "Please provide a new description for the product. Say `cancel` to exit." }); + finalMsg = await interaction.user.send({ content: "Please provide a new description for the product. Say `cancel` to exit." }); break; case "devProductId": - await interaction.user.send({ content: "Please provide a new developer product ID for the product. Say `cancel` to exit." }); + finalMsg = await interaction.user.send({ content: "Please provide a new developer product ID for the product. Say `cancel` to exit." }); break; case "imageId": - await interaction.user.send({ content: "Please provide a new image ID for the product. Say `cancel` to exit." }); + finalMsg = await interaction.user.send({ content: "Please provide a new image ID for the product. Say `cancel` to exit." }); break; case "file": - await interaction.user.send({ content: "Please provide a new file for the product. Say `cancel` to exit." }); + finalMsg = await interaction.user.send({ content: "Please provide a new file for the product. Say `cancel` to exit." }); break; case "stock": - await interaction.user.send({ content: "Please provide a new stock quantity for the product. Say `cancel` to exit. Set `-1` to disable." }); + finalMsg = await interaction.user.send({ content: "Please provide a new stock quantity for the product. Say `cancel` to exit. Set `-1` to disable." }); break; case "category": - await interaction.user.send({ content: "Please provide a new category for the product. Say `cancel` to exit. Set to `~none` to remove." }); + finalMsg = await interaction.user.send({ content: "Please provide a new category for the product. Say `cancel` to exit. Set to `~none` to remove." }); break; case "delete": - await interaction.user.send({ content: "Are you sure you want to delete this product? This action is irreversible, and all buyees will lose access to the file forever! Type `confirm` to delete, or `cancel` to exit." }); + finalMsg = await interaction.user.send({ content: "Are you sure you want to delete this product? This action is irreversible, and all buyees will lose access to the file forever! Type `confirm` to delete, or `cancel` to exit." }); break; default: return interaction.editReply({ content: "Invalid field provided.", ephemeral: true }); } - interaction.editReply({ ephemeral: true, content: "Check your DMs!" }); + await interaction.editReply({ + ephemeral: true, + content: "Check your DMs!", + components: [ + { + type: 1, // ActionRow + components: [ + { + type: 2, // Button + style: 5, // Link button + label: "Go there!", + url: finalMsg.url + } + ] + } + ] + }); global.productUpdateData[interaction.user.id] = { id: product.id, type: interaction.options.getString("field")