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

kvn1351 picture kvn1351  路  3Comments

ghost picture ghost  路  3Comments

Dmitry221060 picture Dmitry221060  路  3Comments

PassTheMayo picture PassTheMayo  路  3Comments

Acaretia picture Acaretia  路  3Comments