summaryrefslogtreecommitdiff
path: root/responses.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 /responses.js
parenta0cb47ddcfcafc8a254de6b7574838d61a593bdd (diff)
downloaddiscordbot-65da4cba0053bc6ee6f5442a45022bf5b4198e70.tar.gz
discordbot-65da4cba0053bc6ee6f5442a45022bf5b4198e70.zip
rotate IGNs in playing status
Diffstat (limited to 'responses.js')
-rw-r--r--responses.js13
1 files changed, 13 insertions, 0 deletions
diff --git a/responses.js b/responses.js
index d1284e5..39369ed 100644
--- a/responses.js
+++ b/responses.js
@@ -12,6 +12,7 @@ const Commando = require("discord.js-commando"),
const PREVIEW = process.env.PREVIEW || true,
MATCH_HISTORY_LEN = parseInt(process.env.MATCH_HISTORY_LEN) || 3,
+ IGN_ROTATE_TIMEOUT = parseInt(process.env.IGN_ROTATE_TIMEOUT) || 300,
REACTION_TIMEOUT = parseInt(process.env.REACTION_TIMEOUT) || 60; // s
const reactionsPipe = new Channel();
@@ -108,6 +109,18 @@ ${picks}
`;
}
+module.exports.rotateGameStatus = (client) => {
+ (async function rotate() {
+ const gamers = await api.getGamers(),
+ idx = Math.floor(Math.random() * (gamers.length - 1)) + 1;
+ if (PREVIEW) await client.user.setGame(
+ `?v ${gamers[idx]} | preview.vainsocial.com`);
+ else await client.user.setGame(
+ `!v ${gamers[idx]} | vainsocial.com`);
+ setTimeout(rotate, IGN_ROTATE_TIMEOUT * 1000);
+ })();
+}
+
// reaction -> pipe ->>> consumers
// handle new reaction event
module.exports.onNewReaction = (reaction) => {