From 396a21741d06b819839f80f4b21eca7ddcf8630a Mon Sep 17 00:00:00 2001 From: Edgar Date: Thu, 4 Nov 2021 13:21:13 +0000 Subject: [PATCH] Add multiple events together --- bot.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/bot.js b/bot.js index cb73a3c..d38704d 100644 --- a/bot.js +++ b/bot.js @@ -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]; }