Click here to Skip to main content
15,396,078 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have all the data I need in the mongoDB Database, I just dont know how I can send parts of the data in an Discord embed. for example the data:

new birthdaySchema({
  User: username.username,
  Birthday: birthdayString, 
  Month: showMonth,
  Day: showDay, 
  Year: showYear

Year, Month and Day are just there to sort the birthdays and birthdayString = Day of Month

I also use moment-timezone (UTC)

const dateTime = moment.utc().format(`DD MM YYYY, hh:mm:ss`);

My goal is with a slash commad like /next-birthdays the data in the embed should look like

${birthdayString} ${Year}\n${User} (and this 10 times, so the the upcoming birthdays of 10 users)

And if the birthday and the actual date and time from moment-timezones (UTC) is matching. Then the Bot should make a new embed with a title (Happy Birthday) and in the description (Today is ${User}'s Birthday, blah blah blah) and at last it should give that User the birthday role on this server.

Hope someone can help me :)

What I have tried:

const doc = birthdaySchema.find({});
             function (err, db) {
             if (err) console.log(err);
                let dbo = db.db("eco");
                  itemPage: page
                }).forEach(function (doc) {
                console.log(`${doc.Birthday} ${doc.Year}\n${doc.User}`)

        let showEmbed = new MessageEmbed()
        .setTitle(`**Upcoming Birthday's**`)
        .setDescription(`${doc.Birthday} ${doc.Year}\n${doc.User}`){ embeds: [showEmbed]});

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900