Compare commits

..

No commits in common. "1c82c1d5cad4e370be22fae8405f058ddf9e3d8d" and "a5e824d5f074ffeb6fa8735450e57f7ec4254049" have entirely different histories.

View file

@ -72,27 +72,23 @@ if (!config.token) {
.setDescription("API test")
.addFields(Object.values(results[year][0].candidates).map((candidate: any) => ({
name: `${candidate.winner ? ":white_check_mark:" : ""} ${CandidateEmojis[candidate.party] ?? ""} ${candidate.name} ${candidate.incumbent ? "(I)" : ""} (${candidate.party})`,
value: `${results[year][0].election_type === "electoral" ? `${candidate.electoral_votes} electoral votes\n` : ""} ${candidate.votes.toLocaleString()} votes (${candidate.percent}%)`,
value: `${candidate.votes.toLocaleString()} votes (${candidate.percent}%)`,
inline: true
})))
.setTimestamp();
if(results[year][0].has_map === true) {
const map = await fetch(`http://127.0.0.1:3000/api/v1/election/${country}/${election_type}/${year}/map`); // temp test url
if (map.ok) {
const arrayBuffer = await map.arrayBuffer();
const buffer = Buffer.from(arrayBuffer);
embed.setImage("attachment://map.png");
await i.editReply({embeds: [embed], files: [{attachment: buffer, name: "map.png"}]});
break;
} else {
await i.editReply({embeds: [embed]});
break;
}
const map = await fetch(`http://127.0.0.1:3000/api/v1/election/${country}/${election_type}/${year}/map`); // temp test url
if (map.ok) {
const arrayBuffer = await map.arrayBuffer();
const buffer = Buffer.from(arrayBuffer);
embed.setImage("attachment://map.png");
await i.editReply({embeds: [embed], files: [{attachment: buffer, name: "map.png"}]});
break;
} else {
await i.editReply({embeds: [embed]});
break;
}
break;
} else {
await i.editReply("Election not found");
break;