Skip to content

Instantly share code, notes, and snippets.

@Fyko
Last active May 17, 2019 23:16
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 Fyko/cfbe2b5943d72d409740f764c1854e3c to your computer and use it in GitHub Desktop.
Save Fyko/cfbe2b5943d72d409740f764c1854e3c to your computer and use it in GitHub Desktop.
An example of confirmation with Discord.js
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