From 65da4cba0053bc6ee6f5442a45022bf5b4198e70 Mon Sep 17 00:00:00 2001 From: schneefux Date: Wed, 19 Apr 2017 12:02:21 +0200 Subject: rotate IGNs in playing status --- api.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'api.js') 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) { -- cgit v1.3.1