Ask coding questions

← Back to all posts
Mitsuki
Jhonascaliban (0)

Eu estou tentando colocar novos tipos de comandos no meu bot porem esta difícil já que procuro bastante na internet mais não acho poderiam me ajudar sou brasileiro

Text in english

I'm trying to put new types of commands in my bot, but this is difficult since I look a lot on the internet but I don't think they could help me, I'm Brazilian

Comments
hotnewtop
tussiez (1669)

Hello!
Here's a simple way to read commands:

let prefix = '!';
bot.on('message',function(message){
if(!message.content.startsWith(prefix)) return; // If not a bot command
if(message.author.bot) return; // Do not respond to itself.
let command = message.content.replace(prefix,'');
let args = command.split(' '); // Argument

if(command == 'test'){ // If command = !test
message.reply(' Hello'); // Send message
}
});