Discord.js: How to use awaitResponse function

Created on 3 Jul 2016  路  1Comment  路  Source: discordjs/discord.js

Hi, if this is not the place for it.

I don't know exactly how use the function awaitResponse, someone can send a practical example?

Thanks

question (please use Discord instead)

Most helpful comment

This should be a nice example:

if(msg.content === "quiz") {
    bot.awaitResponse(msg, "What color is the sky?")
    .then(nextMessage => {
        if(nextMessage.content.toLowerCase() === "blue") {
            bot.sendMessage(msg, "Correct :tada:");
        } else {
            bot.sendMessage(msg, "Wrong!!");
        }
    });
}

For smaller questions you'll get quick help on Discord API#node_discord.js

>All comments

This should be a nice example:

if(msg.content === "quiz") {
    bot.awaitResponse(msg, "What color is the sky?")
    .then(nextMessage => {
        if(nextMessage.content.toLowerCase() === "blue") {
            bot.sendMessage(msg, "Correct :tada:");
        } else {
            bot.sendMessage(msg, "Wrong!!");
        }
    });
}

For smaller questions you'll get quick help on Discord API#node_discord.js

Was this page helpful?
0 / 5 - 0 ratings

Related issues

PaulSenon picture PaulSenon  路  19Comments

ericnelson0 picture ericnelson0  路  62Comments

vladfrangu picture vladfrangu  路  23Comments

JMTK picture JMTK  路  20Comments

ChrisTalman picture ChrisTalman  路  20Comments