0
votes

I have been trying to make a Discord bot that responds to the user when they ask for help. Sadly I can't seem to get the bot to work. I am using Discord.JS on Node.JS. Any help would be welcome.

const Discord = require('discord.js');

const bot = new Discord.Client();

const token = '[token removed]';

const PREFIX = '!';

bot.on('ready', () => {
   console.log('K08 Help Bot is online!');
})

bot.on('message', message=>{

let args = message.content.substring(PREFIX.lenght).split(" ");

switch(args[0]){
    case 'help':
        message.reply('HELLO');
    break;
}

})

bot.login(token);
1
Have you done some sort of debugging yet ? We cannot know, out of no where, what's wrong here. Please refine your question, by adding what you've already test and what part, exactly is not working. - Nicolas
I have debugged the code and there seems to be nothign werong woth ot - Mallagua
If there is nothing wrong with it, why are we here ? - Nicolas

1 Answers

2
votes

This might be the issue: let args = message.content.substring(PREFIX.lenght).split(" "); - length is mistyped as lenght

On a side note: I've submitted an edit to hide your token in this question. For security, you should never share your token; it would allow someone to take over your bot!