Compare commits

..

2 commits

2 changed files with 19 additions and 6 deletions

View file

@ -17,11 +17,25 @@ const execute = async (interaction) => {
// Proceed with settings menu // Proceed with settings menu
await interaction.reply({ ephemeral: true, content: "Getting things ready..." }); await interaction.reply({ ephemeral: true, content: "Getting things ready..." });
await interaction.user.send({ embeds: [{ await interaction.user.send({ embeds: [{
title: `Hub Settings for ${hubResult[0].name}`, title: 'Welcome to Hub Settings!',
description: `**Short Description:** ${hubResult[0].shortDescription}\n**Long Description:** ${hubResult[0].longDescription}\n**Allow Gift Purchase:** ${hubResult[0].allowGiftPurchase ? "Yes" : "No"}\n**Terms of Service:** ${hubResult[0].tos}\n\nHub Secret Key: ||${hubResult[0].secretKey}||`, 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 },
{ name: "Discord Guild ID", value: hubResult[0].discordGuild },
{ 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 : "None" },
{ name: "Secret Key", value: `||\`${hubResult[0].secretKey}\`||` }
]
},{
description: `Options`,
color: 0x00AE86, color: 0x00AE86,
fields: [ fields: [
{ name: "Main Menu", value: "Type an option number, or `cancel` to close." },
{ name: "1. Edit Short Description", value: "Change the short description of the hub." }, { 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: "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: "3. Toggle Allow Gift Purchase", value: "Enable or disable allowing users to buy gifts for others on this hub." },

View file

@ -31,10 +31,9 @@ const execute = async (interaction) => {
const shortDescription = "Our super cool product hub!"; const shortDescription = "Our super cool product hub!";
const longDescription = "Welcome to our super cool product hub! We offer a variety of awesome products for you to explore and purchase. Enjoy your stay!"; const longDescription = "Welcome to our super cool product hub! We offer a variety of awesome products for you to explore and purchase. Enjoy your stay!";
const result = await pool.query('INSERT INTO hubs (ownerId, discordGuild, name, shortDescription, longDescription, secretKey) VALUES (?, ?, ?, ?, ?, ?)', [ownerId, guildId, name, shortDescription, longDescription, await crypto.randomBytes(64).toString('hex')]); const result = await pool.query('INSERT INTO hubs (ownerId, discordGuild, name, shortDescription, longDescription, secretKey) VALUES (?, ?, ?, ?, ?, ?)', [ownerId, guildId, name, shortDescription, longDescription, await crypto.randomBytes(64).toString('hex')]);
const hub = await pool.query('SELECT * FROM hubs WHERE discordGuild = ?', [guildId]); const [hub] = await pool.query('SELECT * FROM hubs WHERE discordGuild = ?', [guildId]);
console.log(hub)
if (result.affectedRows === 1) { if (result.affectedRows === 1) {
return interaction.reply({ content: `Hub successfully created with ID: \`${result.insertId}\`. Get details via the /settings command!`, ephemeral: true }); return interaction.reply({ content: `Hub successfully created with ID: \`${hub.id}\`. Get details via the /settings command!`, ephemeral: true });
} else { } else {
return interaction.reply({ content: "An error occurred while creating the hub. Please try again later.", ephemeral: true }); return interaction.reply({ content: "An error occurred while creating the hub. Please try again later.", ephemeral: true });
} }