summaryrefslogtreecommitdiff
path: root/api.js
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2017-04-19 12:02:21 +0200
committerschneefux <schneefux+commit@schneefux.xyz>2017-04-19 12:02:21 +0200
commit65da4cba0053bc6ee6f5442a45022bf5b4198e70 (patch)
tree009923749461351b397cf26672b00b663bef0f63 /api.js
parenta0cb47ddcfcafc8a254de6b7574838d61a593bdd (diff)
downloaddiscordbot-65da4cba0053bc6ee6f5442a45022bf5b4198e70.tar.gz
discordbot-65da4cba0053bc6ee6f5442a45022bf5b4198e70.zip
rotate IGNs in playing status
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) {