Compare commits

..

No commits in common. "6ed299cf2b7bd584cacd5a84f7bc4001f9fd1489" and "3d65e01a78d50dfa118fc1ef64bd440a38c80c37" have entirely different histories.

2 changed files with 6 additions and 19 deletions

View file

@ -17,25 +17,11 @@ 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 },
{ 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`,
title: `Hub Settings for ${hubResult[0].name}`,
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}||`,
color: 0x00AE86,
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: "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." },

View file

@ -31,9 +31,10 @@ const execute = async (interaction) => {
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 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) {
return interaction.reply({ content: `Hub successfully created with ID: \`${hub.id}\`. Get details via the /settings command!`, ephemeral: true });
return interaction.reply({ content: `Hub successfully created with ID: \`${result.insertId}\`. Get details via the /settings command!`, ephemeral: true });
} else {
return interaction.reply({ content: "An error occurred while creating the hub. Please try again later.", ephemeral: true });
}