So, I’m trying to send a regular message saying- “Click the rainbow pancakes to bake!” with a custom reaction attached. Then when the user clicks the rainbow pancake reaction I want it to send an embed saying alot, has a title, color, description, footer, thumbnail and etc. This is the code I am trying to use!—
const { Database } = require("quickmongo");
const db = new Database("mongodb+srv://Nixie:[email protected]/test");
const ms = require("parse-ms");
module.exports = {
name: "bake",
aliases: ["b"],
/**
*
* @param {Client} client
* @param {Message} message
* @param {String[]} args
*/
run: async (client, message, args) => {
let user = message.author;
db.on("ready", () => {
console.log(`Fetched wish Database from - userId: ${user.id}`);
});
// top-level awaits
await db.connect();
let amount = [3, 6, 9]
let amountOutcome = Math.floor(Math.random() * amount.length)
let reaction = ('<:rpck:954892806214791212>')
let timeout = 180000;//5 mins
let daily = await db.get(`bakeTime-${user.id}`);
if (daily !== null && timeout - (Date.now() - daily) > 0) {
let time = ms(timeout - (Date.now() - daily));
let timeEmbed = new MessageEmbed()
.setColor("0A0301")
.setDescription(`❌ You've already bakednnBake again in ${time.hours}h ${time.minutes}m ${time.seconds}s!!`);
message.channel.send({embeds: [timeEmbed]})
} else {
bot.on('bake', message => {
if(message.author.bot) return;
if(message.content.toLowerCase() === 'bake'){
const embed = new Discord.MessageEmbed();
embed.setTitle("<:tppc:953062342680252476>..**It's Time To Bake!!**..<:tppc:953062342680252476>")
embed.setColor("0A0301");
embed.setThumbnail('https://i.postimg.cc/7LGcsBHV/bake.jpg')
embed.setFooter("Tip! You can bake again in 15 minutes!","https://i.postimg.cc/139pM3Rd/nixiethumbnail.jpg")
embed.setDescription("Bake time! Earn some <:galaxp:952320002848092161> by clicking on the Rainbow Pancakes!n**Use your Galaxy Pop in the ~starcandyshop!!");
message.channel.send(embed).then(embedMsg => {
embedMsg.react('<:rpck:954892806214791212>')
.then(reaction => embedMsg.react('<:rpck:954892806214791212>'))
.catch(err => console.error);
const filter = (r, u) => r.emoji.id == '<:rpck:954892806214791212>';
const collector = message.createReactionCollector(filter, {time: 60000});
collector.on('collect', (r, u) => {
//Put your response to reactions here
message.channel.send("You baked some Rainbow Pancakes!! " + u.tag + " because you reacted with " + r.emoji.name + ` **and earned ${amountOutcome} <:galaxp:952320002848092161>**`);
});
message.channel.send({embeds: });
db.add(`galaxyPop-${user.id}`, amountOutcome)
db.set(`bakeTime-${user.id}`, Date.now())
})};
}
}```
ANY and ALL Help is much appreciated! TIA!