Friday, 21 April 2017

node.js cant read property of 'on' of undefined

I am getting an error from node js, but I don't know what the problem is. When I run the program I get TypeError: Cannot read property of 'on' of undefined.

Here is my code:

var Discordie = require('discordie');

const Events = Discordie.Events;
const client = new Discordie();

client.connect({
  token: 'MzA0NzE5NTYyMzQ2MzMyMTYx.C9wx5w.xTless6wW8nM7HfolN_Z01c3sAc'
});

client.Dispatcher.on(Events.GATEWAY_READY, e => {
 console.log('Connected as: ' + client.User.username);
});

client.Dispatcher.on(Events.MESSAGE_CREATE, e => {
 if(e.message.content == 'PING') {
    e.message.channel.sendMessage('PONG');
  }
});

It is for a discord bot, and I have already installed everything. (at least I'm 99% sure)



via Jake Porter

No comments:

Post a Comment