Closed ghost closed 10 years ago
What error do you get ? (complete stack trace)
Important: use 'process.env.PORT' as the port and 'process.env.IP' as the host in your scripts! (node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit. Trace at Bot.EventEmitter.addListener (events.js:168:15) at Object. (/var/lib/stickshift/51d1c5aa5973cae5750000b5/app-root/data/544956/node_modules/chat_bot.js:2214:5) at Module._compile (module.js:449:26) at Object.Module._extensions..js (module.js:467:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.runMain (module.js:492:10) at process.startup.processNextTick.process._tickCallback (node.js:244:9) [ VeggieBot 3.6.0 is READY! on Tue Aug 06 2013 18:03:55 GMT-0400 (EDT) ] User not found, may be offline VeggieBot: VeggieBot, welcome to the room! We have free entertainment, lemonade, and crazy moderators.
/var/lib/stickshift/51d1c5aa5973cae5750000b5/app-root/data/544956/node_modules/chat_bot.js:2215 if (data.match(/fan/)) ^ TypeError: Object #
The problem you have is this:
Each time you register a listener (ie: bot.on('signal', callback);
) the callback is going to be called every time the signal is triggered.
So, if you do something like this:
bot.on('signal1', function() {
bot.on('signal2', function() {
// ...
});
});
Every time signal1
is triggered, you add a new listeners for signal2
. (and this, create a memory leak)
This is the problem you have.
If you want to fix this, make sure you don't have nested listeners.
ok
How can i make a proper Fan Command for my bot.
Fan Command: makes the bot automatically fan the person that did the command.
I tried coding a fan command with this code:
but it crashed the bot, and won't let the bot run.