totallymike / ircnode

Extensible IRC bot written with node.js
https://github.com/totallymike/ircnode/wiki
MIT License
4 stars 2 forks source link

!PRIVMSG causes the bot to crash #16

Closed sigv closed 12 years ago

sigv commented 12 years ago

If someone writes !PRIVMSG in the chat, the bot will crash trying to parse the command. Bot output:

:foobar!~foobar@foo.bar.com PRIVMSG #channel :!PRIVMSG Bye.

{ nick: 'foobar',
  user: '~foobar',
  host: 'foo.bar.com',
  channel: '#channel',
  cmd: 'PRIVMSG',
  params: [ 'Bye.' ],
  data: 'foobar!~foobar@foo.bar.com PRIVMSG #channel :!PRIVMSG Bye.' }

/home/valterguy/ircnode/client.js:199
  if (data[data.indexOf(':') + 1] === irc.command_char) {
                ^
TypeError: Object #<Object> has no method 'indexOf'
    at EventEmitter.<anonymous> (/home/valterguy/ircnode/client.js:199:17)
    at EventEmitter.emit (events.js:88:20)
    at EventEmitter.<anonymous> (/home/valterguy/ircnode/client.js:202:17)
    at EventEmitter.emit (events.js:88:20)
    at Socket.<anonymous> (/home/valterguy/ircnode/client.js:186:17)
    at Socket.emit (events.js:67:17)
    at TCP.onread (net.js:347:14)
theVDude commented 12 years ago

!PING as well,

/home/robert/src/ircnode/client.js:309
  irc._socket.write('PONG ' + data.slice(data.indexOf(':')) + '\r\n');
                                              ^
TypeError: Object #<Object> has no method 'indexOf'
    at EventEmitter.<anonymous> (/home/robert/src/ircnode/client.js:309:47)
    at EventEmitter.emit (events.js:67:17)
    at EventEmitter.<anonymous> (/home/robert/src/ircnode/client.js:318:17)
    at EventEmitter.emit (events.js:88:20)
    at Socket.<anonymous> (/home/robert/src/ircnode/client.js:302:17)
    at Socket.emit (events.js:67:17)
    at TCP.onread (net.js:347:14)
sigv commented 12 years ago

I will look into this issue.

totallymike commented 12 years ago

Fixed. Closing the issue.