Browse Source

Add astronauts as well as ISS location

master
Abheek Dhawan 4 years ago
parent
commit
33bdd2cbea
  1. 9
      bot.js

9
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,8 +371,15 @@ async function locateISS(message) {
.setColor("00c5ff")
.setFooter(`Client ID: ${client.user.id}`)
.setTimestamp();
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);
});
});
}
async function ping(message) {

Loading…
Cancel
Save