Add multiple events together

This commit is contained in:
Edgar 2021-11-04 13:21:13 +00:00 committed by GitHub
parent fa5cbc9e66
commit 396a21741d

17
bot.js
View File

@ -12,8 +12,8 @@ async function main() {
// let data = (await axios("https://vps.anotherfoxguy.com/dl/fur-events.json")).data;
let data = (await axios("https://api.fynn.ai/events")).data;
let min = moment().subtract(30, "minutes"); // minutes
let max = moment().add(30, "minutes");
let min = moment().add(1, "minutes"); // minutes
let max = moment().add(31, "minutes");
//let max = moment().add(1.5, "days");
//console.log(dat.data)
@ -23,6 +23,8 @@ async function main() {
moment.unix(event.start).isBetween(min, max)
);
evembeds = [];
events.forEach((event) => {
console.log(event.name);
@ -66,9 +68,14 @@ async function main() {
};
}
evembeds.push(embed);
});
if (evembeds.length > 0) {
axios
.post(config.webhookurl, {
embeds: [embed],
embeds: evembeds,
})
.catch(function (error) {
console.error(error);
@ -76,10 +83,10 @@ async function main() {
// console.log(
// JSON.stringify({
// embeds: [embed],
// embeds: evembeds,
// })
// );
});
}
//let event = data[1];
}