From 33bdd2cbeabac5cca583dbcb5ad2ee78f5afbf40 Mon Sep 17 00:00:00 2001 From: Abheek Dhawan Date: Thu, 29 Apr 2021 23:19:02 -0500 Subject: [PATCH] Add astronauts as well as ISS location --- bot.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bot.js b/bot.js index b349143..bcd5a55 100644 --- a/bot.js +++ b/bot.js @@ -363,7 +363,7 @@ async function memberCountChannelUpdate(member) { async function locateISS(message) { await fetch("http://api.open-notify.org/iss-now.json") .then(request => request.json()) - .then(data => { + .then(async data => { const issEmbed = new Discord.MessageEmbed() .setTitle("The current location of the ISS!") .setURL('https://spotthestation.nasa.gov/tracking_map.cfm') @@ -371,7 +371,14 @@ async function locateISS(message) { .setColor("00c5ff") .setFooter(`Client ID: ${client.user.id}`) .setTimestamp(); - message.channel.send(issEmbed); + await fetch ("http://api.open-notify.org/astros.json") + .then(request => request.json()) + .then(data => { + data.people.forEach((astronaut, index) => { + issEmbed.addField(`Astronaut ${index + 1}`, astronaut.name, true); + }) + message.channel.send(issEmbed); + }); }); }