THEREVENGER
THEREVENGER

Reputation: 11

Bot issues with function bot.reply (Discord)

I'm trying to make a discord bot with the command !!flip. I tried this but got this error :

https://cdn.discordapp.com/attachments/362440755350077453/363233799104102401/unknown.png

So, I then tried bot.channel.sendmessage and got this message :

https://cdn.discordapp.com/attachments/362440755350077453/363191581521739776/unknown.png

Here is my code :

if (message.content === "!!flip") {
    var result = Math.floor((Math.random() * 2) + 1);
    if (result == 1) {
        bot.reply(message, "The coin landed on heads");
    } else if (result == 2) {
        bot.reply(message, "The coin landed on tails");
    }
}

Upvotes: 1

Views: 91

Answers (1)

LW001
LW001

Reputation: 2863

Okay. Firstly, do us all a favor and read the docs before trying to go anywhere with Discord.JS. For this case use message.reply("The coin landed on Tails") instead.

Upvotes: 1

Related Questions