Skip to content

Instantly share code, notes, and snippets.

@captDaylight
Last active May 15, 2016 00:19
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/ee4008f8df96930693321ebf81330a5c to your computer and use it in GitHub Desktop.
Save captDaylight/ee4008f8df96930693321ebf81330a5c to your computer and use it in GitHub Desktop.
hears(['play'], 'direct_message,direct_mention,mention', (bot, message) => {
const { user, channel, text } = message; // destructure message variable
const userData = text.match(/<@([A-Z0–9]{9})>/); // parse the text for user's 9 character id
if (userData) {
// if there is a user challenged, start the game
} else {
bot.reply(message, 'You didn\'t challenge anyone…');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment