Skip to content

Instantly share code, notes, and snippets.

@captDaylight
Last active May 15, 2016 01:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save captDaylight/c026c51154d4f6f0020abccecf2ff005 to your computer and use it in GitHub Desktop.
Save captDaylight/c026c51154d4f6f0020abccecf2ff005 to your computer and use it in GitHub Desktop.
...
if (data && 'players' in data) {
const { user } = message;
const { players } = data;
if (user in players && !players[user].accepted) {
// player two accepted
bot.reply(message, 'GREAT, LET THE BATTLE BEGIN!!!');
} else {
const player = Object.keys(players).find((p) => !players[p].accepted);
bot.reply(message, `Not you <@${user}>, waiting for <@${player}>.`);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment