summaryrefslogtreecommitdiff
path: root/api.js
diff options
context:
space:
mode:
Diffstat (limited to 'api.js')
-rw-r--r--api.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/api.js b/api.js
index 1672728..24c9a9a 100644
--- a/api.js
+++ b/api.js
@@ -74,13 +74,20 @@ async function getMappings() {
}
);
return mapping;
- });
+ }, { ttl: 60 * 30 });
}
module.exports.mapGameMode = async function(id) {
return (await getMappings())["gamemode"][id];
}
+// return a set of IGN of supporters
+module.exports.getGamers = async function() {
+ return await cache.wrap("gamers", async () => {
+ return (await getFE("/gamer")).map((gamer) => gamer.name);
+ }, { ttl: 60 * 30 });
+}
+
// be an async iterator
// next() returns promises that are awaited until there is an update
module.exports.subscribeUpdates = function(name, timeout=UPDATE_TIMEOUT) {