Integrated Demon List!

This commit is contained in:
GDColon 2019-10-17 00:22:20 -04:00
parent de076fe990
commit 42a06409c4
2 changed files with 17 additions and 1 deletions

View file

@ -116,7 +116,9 @@ module.exports = async (app, req, res, api, ID, analyze) => {
level.data = levelInfo[4]
if (analyze) return app.modules.analyze(app, req, res, level)
else if (api) return res.send(level)
function sendLevel() {
if (api) return res.send(level)
else return fs.readFile('./html/level.html', 'utf8', function(err, data) {
let html = data;
@ -127,6 +129,19 @@ module.exports = async (app, req, res, api, ID, analyze) => {
})
return res.send(html)
})
}
//demon list stuff
if (level.difficulty == "Extreme Demon") {
request.get('https://www.pointercrate.com/api/v1/demons/', async function(err, resp, demonList) {
let demons = JSON.parse(demonList)
let foundDemon = demons.find(x => x.name.trim().toLowerCase() == level.name.trim().toLowerCase())
if (foundDemon) level.demonList = foundDemon.position
return sendLevel()
})
}
else return sendLevel()
})
})

View file

@ -114,6 +114,7 @@
<p>songAuthor: The name of the author of said song</p>
<p>songSize: The size of the song in megabytes, if a custom song was used</p>
<p>songID: The ID of the song (again). If a non-custom song was used, this will return a string with the level number of the song</p>
<p>demonList: The level's position on the Demon List (Pointercrate). Extreme demons only</p>
<p class="red">uploaded: Time since the level was uploaded (sent as "x days/weeks/months" ago, since it's all the API sends)</p>
<p class="red">updated: Time since the level was last updated</p>
<p class="red">password: The password to copy the level. 0 means the level isn't copyable and 1 means it's free to copy</p>