Open frxstrem opened 7 years ago
moin! i want to say, i've been using this for a while, and never had issues (built a bot on top of it). However, this is a crippling bug that has completely rendered the irc head of the bot useless. Any word on a fix (or what the issue is?). #496 does not work for me (let me know if i should open second issue)
I did some tracing of the issue.
/Library/WebServer/Documents/_valaxypotato/node_modules/irc/lib/irc.js:849
throw err;
^
TypeError: Cannot read property 'trim' of undefined
at Client.<anonymous> (/Library/WebServer/Documents/_valaxypotato/node_modules/irc/lib/irc.js:372:44)
at emitOne (events.js:101:20)
i added some logs to lib/irc
and it revealed that wherever the message is coming from, the prob appears to be in parseMessage as there just isnt a 4th param
console.log( message )
to line 110{ prefix: server: 'irc.tinyspeck.com',
server: 'irc.tinyspeck.com',
command: 'rpl_namreply',
rawCommand: '353',
commandType: 'reply',
args: [ 'valaxypotato', '=', '#general' ] }
rpl_namreply
i checked the code. line 372 is trying to trim the undefined message.args[3]
here's my implementation, but i dont know what i would need to do on my side to fix this.
https://github.com/mousemke/_val/blob/dev/modules/core/irc.js
additionally, the console.logs before that suggest maybe it's duplicating the raw response, but only with a partial arguments object
* JOIN : #general
{ prefix: 'irc.tinyspeck.com',
server: 'irc.tinyspeck.com',
command: 'rpl_topic',
rawCommand: '332',
commandType: 'reply',
args: [ 'valaxypotato', '#general', 'WE R POTATERS' ] }
* rpl_topic : valaxypotato #general WE R POTATERS
{ prefix: 'irc.tinyspeck.com',
server: 'irc.tinyspeck.com',
command: 'rpl_namreply',
rawCommand: '353',
commandType: 'reply',
args:
[ 'valaxypotato',
'=',
'#general',
'mouse nico michele wahwynn gibbo dilkrom valaxypotato turkish jfalxa stefan conor jolene mixedpoo pierre remi andybloke joderilli serendi drey sleepywolf freen eve gar1606 supermooseaoj gavin hans aki ben josh alicia fedux ninja john hydra eva joeyquixote schoonertorrent altona dadinada dax luke dezipter mell roxy xcidium schnubor subism elias mitch ola ' ] }
* rpl_namreply : valaxypotato = #general mouse nico michele wahwynn gibbo dilkrom valaxypotato turkish jfalxa stefan conor jolene mixedpoo pierre remi andybloke joderilli serendi drey sleepywolf freen eve gar1606 supermooseaoj gavin hans aki ben josh alicia fedux ninja john hydra eva joeyquixote schoonertorrent altona dadinada dax luke dezipter mell roxy xcidium schnubor subism elias mitch ola
{ prefix: 'irc.tinyspeck.com',
server: 'irc.tinyspeck.com',
command: 'rpl_namreply',
rawCommand: '353',
commandType: 'reply',
args: [ 'valaxypotato', '=', '#general' ] }
/Library/WebServer/Documents/_valaxypotato/node_modules/irc/lib/irc.js:850
throw err;
^
TypeError: Cannot read property 'trim' of undefined
bot still down :(
no response..... any info? need some help?
use an older ver, not ideal but worked for me 🤷♂️ npm install irc@0.5.0
I still run into this issue,
In version 0.5.0
I get
TypeError: Cannot read property 'trim' of undefined
at Client.<anonymous> (.../node_modules/irc/lib/irc.js:368:44)
at emitOne (events.js:96:13)
at Client.emit (events.js:188:7)
at iterator (.../node_modules/irc/lib/irc.js:842:26)
at Array.forEach (native)
at TLSSocket.handleData (.../node_modules/irc/lib/irc.js:837:15)
at emitOne (events.js:96:13)
at TLSSocket.emit (events.js:188:7)
at readableAddChunk (_stream_readable.js:176:18)
at TLSSocket.Readable.push (_stream_readable.js:134:10)
at TLSWrap.onread (net.js:543:20)
I think its the same line as 0.5.2
at /node_modules/irc/lib/irc.js:372:44)
But the statement where it fails is at
case 'rpl_namreply':
channel = self.chanData(message.args[2]);
var users = message.args[3].trim().split(/ +/); // <-- right here line 368
if (channel) {
users.forEach(function(user) {
var match = user.match(/^(.)(.*)$/);
if (match) {
if (match[1] in self.modeForPrefix) {
I have no working fix for this, but it seems to happen if there is a higher populated slack channel you connect the bot to through IRC
Ok actually, i just threw an if statement around the whole thing, and it seemed to work... 😂 I would really like to see something about this, to shore it up more.
if(message.args[3]) {
channel = self.chanData(message.args[2]);
var users = message.args[3].trim().split(/ +/); // <-- right here line 368
if (channel) {
users.forEach(function(user) {
var match = user.match(/^(.)(.*)$/);
if (match) {
if (match[1] in self.modeForPrefix) {
...
I recommend using #489 branch to test a fix for this.
I'm trying to use node-irc 0.5.2 to connect to an IRC server (running ircd.js 0.0.17 with default configuration). This is the code I'm using:
However, I get this exception: