-
Notifications
You must be signed in to change notification settings - Fork 423
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot call method 'match' of undefined #326
Comments
the config includes the channel to join, do I need to also specify it in the say command? |
On Wed, Feb 11, 2015 at 10:23:49 -0800, ReidandKat wrote:
Hi ReidandKat, This is not enough information to debug with. Presumably you're Additionally, you have only included a snippet of your code. You Chris Nehren |
I too am getting this crash.
Creating the client as: this.client = new irc.Client(this.ircServer["server"], this.nick, {
debug: true,
userName: "CytubeBot",
autoConnect: false,
channels: [self.channel],
port: this.ircServer["port"]
}) sendMessage is just IRCClient.prototype.sendMessage = function(message) {
this.client.say(this.channel, message)
}; |
Hey, @nuclearace, did you ever figure out this crash? I'm getting this same error now, and I'm not sure what's causing it. cc. @ReidandKat |
Yeah this is odd |
@Jake0oo0 Resolution was as simple as catching the error and doing nothing with it. |
As far as I understand, this happens when you're trying to send a message when your Client instance is not fully initialized yet. var bot = new irc.Client('my.irc.server.com', 'botName', { autoConnect: false // with auto connect enabled we can't tell when the initialization projecc is complete }); /* but if we connect manually like here, we have a convenient callback function telling us that when we can start sending our messages */ bot.connect(5, function() { bot.say('mixaildudin', 'how's it going?'); }); |
I am getting error: Cannot call method 'match' of undefined
When I attempt to 'say' to a channel
Here is my code:
var bot = new irc.Client(config.server, config.nick, config);
bot.say('#imaqtpie', "test");
The bot successfully connects to the channel because I can see the chat messages in the log.
Full error:
TypeError: Cannot call method 'match' of undefined
at Client._splitLongLines (/var/www/node_modules/irc/lib/irc.js:931:11)
at /var/www/node_modules/irc/lib/irc.js:967:36
at Array.forEach (native)
at Client._speak (/var/www/node_modules/irc/lib/irc.js:966:12)
at Client.say (/var/www/node_modules/irc/lib/irc.js:953:10)
at Socket. (/var/www/server.js:39:13)
at Socket.emit (events.js:106:17)
at Socket.onevent (/var/www/node_modules/socket.io/lib/socket.js:330:8)
at Socket.onpacket (/var/www/node_modules/socket.io/lib/socket.js:290:12)
at Client.ondecoded (/var/www/node_modules/socket.io/lib/client.js:193:14)
The text was updated successfully, but these errors were encountered: