Last active
May 17, 2019 23:16
-
-
Save Fyko/cfbe2b5943d72d409740f764c1854e3c to your computer and use it in GitHub Desktop.
An example of confirmation with Discord.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const responses = await message.channel.awaitMessages(msg => msg.author.id === message.author.id, { | |
max: 1, | |
time: 10000 | |
}); | |
if (!responses || responses.size !== 1) { | |
// timed out | |
} | |
const response = responses.first(); | |
if (/^y(?:e(?:a|s)?)?$/i.test(response!.content)) { | |
// recieved "yes" | |
} else { | |
// didn't recieve "yes" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment