Add multiple events together
This commit is contained in:
parent
fa5cbc9e66
commit
396a21741d
17
bot.js
17
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://vps.anotherfoxguy.com/dl/fur-events.json")).data;
|
||||||
let data = (await axios("https://api.fynn.ai/events")).data;
|
let data = (await axios("https://api.fynn.ai/events")).data;
|
||||||
|
|
||||||
let min = moment().subtract(30, "minutes"); // minutes
|
let min = moment().add(1, "minutes"); // minutes
|
||||||
let max = moment().add(30, "minutes");
|
let max = moment().add(31, "minutes");
|
||||||
//let max = moment().add(1.5, "days");
|
//let max = moment().add(1.5, "days");
|
||||||
|
|
||||||
//console.log(dat.data)
|
//console.log(dat.data)
|
||||||
@ -23,6 +23,8 @@ async function main() {
|
|||||||
moment.unix(event.start).isBetween(min, max)
|
moment.unix(event.start).isBetween(min, max)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
evembeds = [];
|
||||||
|
|
||||||
events.forEach((event) => {
|
events.forEach((event) => {
|
||||||
console.log(event.name);
|
console.log(event.name);
|
||||||
|
|
||||||
@ -66,9 +68,14 @@ async function main() {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
evembeds.push(embed);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (evembeds.length > 0) {
|
||||||
|
|
||||||
axios
|
axios
|
||||||
.post(config.webhookurl, {
|
.post(config.webhookurl, {
|
||||||
embeds: [embed],
|
embeds: evembeds,
|
||||||
})
|
})
|
||||||
.catch(function (error) {
|
.catch(function (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
@ -76,10 +83,10 @@ async function main() {
|
|||||||
|
|
||||||
// console.log(
|
// console.log(
|
||||||
// JSON.stringify({
|
// JSON.stringify({
|
||||||
// embeds: [embed],
|
// embeds: evembeds,
|
||||||
// })
|
// })
|
||||||
// );
|
// );
|
||||||
});
|
}
|
||||||
|
|
||||||
//let event = data[1];
|
//let event = data[1];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user