Querijn/BottyMcBotface

Esports filters games, but doesnt prevent printing.

Closed this issue · 0 comments

As it is now, if there are games in the data, but they are no longer in the future, they will be filtered from the print. BUT, the league itself will still be printed. This can lead to botty printing an empty league.

Fixed by making sure that output has content before the embed gets pushed.

for (const [league, games] of data) {
let output = "";
for (const game of games) {
const moment = momentjs(game.time, "YYYY MM DD HH:mm");
if (moment.isBefore(new Date())) continue;
output += `${game.teamA} vs ${game.teamB}, ${moment.fromNow()}\n`;
}
embed.fields.push({
name: league,
value: output + `[More about ${league} here](${this.getUrlByLeague(games[0])})\n`,
});
}