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({});
birthdaySchema.find({}),
function (err, db) {
if (err) console.log(err);
let dbo = db.db("eco");
dbo.collection("items").find({
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}`)
interaction.channel.send({ embeds: [showEmbed]});