Tuesday, 30 May 2017

discord.js node.js - bot reply

I've created my own discord bot for my server and i want to answer me if i say specific words who are in array tabHello :

var tabHello = ['Bonjour','Salut','Hello', 'Guten tag', 'Buenos Dias'];
    var tabAnsw= ['Bonjour votre majesté.','Salutations jeune Douzien !','Ouais, ouais. T\'es qui déjà ?', 'Bonjour ' + message.author + ', comment vas-tu aujourd\'hui ?'];

    if (message.content.indexOf('Hello') > 0  && message.isMentioned(client.user)){
        var row = Math.floor(Math.random() * tabAnsw.length);
        message.channel.sendMessage(tabAnsw[row]);
    } 

With this code, if i say "@bot Hello" he answers one value of tabAnsw array. But I want to answer me if i say one value of tabHello array. And, if say "Hello @bot", he doesn't answer me.

Someone can help me ?

Sorry for my english :s



via SalakissODV

No comments:

Post a Comment