1
0
Fork 0

Delete tests.js

master
The Phonebook 6 years ago committed by GitHub
parent da2db69f20
commit a5637c26a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,43 +0,0 @@
const request = require("request");
function titleCase(title) {
if (title.length > 0) {
return title.charAt(0).toUpperCase() + title.slice(1);
}
return;
}
request.get(
`https://api.aprs.fi/api/get?name=WA5PMO-B&what=loc&apikey=118189.tA9HQbULuIDRghEx&format=json`,
function(error, res, body) {
if (error) {
console.log(error);
return;
}
let data = JSON.parse(body);
let embedFields = [];
for (var i = 0; i < data.entries.length; i++) {
Object.keys(data.entries[i]).forEach(key => {
let field = {
name: titleCase(key),
value: data.entries[i][key]
};
embedFields.push(field);
});
}
const locationEmbed = {
color: "config.embed_color",
author: {
name: "APRS Bot"
},
fields: embedFields,
image: {
url: "miniMapUrl"
},
timestamp: new Date(),
footer: {
text: "Data sourced from https://aprs.fi/"
}
};
console.log(locationEmbed);
}
);
Loading…
Cancel
Save