-
-
Notifications
You must be signed in to change notification settings - Fork 216
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
Client can't say anything, results in error. #16
Comments
You cannot send a message before joining a channel. The correct
You're looking for
|
Still doesn't work, even with the changes.
Same error. |
If you put a timeout in the join for 1 millisecond, you do not get the error. client.addListener('join', function(channel, username) {
setTimeout(function() {
client.say(channel, 'Hello');
}, 1);
}); Essentially, Perhaps another function to handle this until something that needs fixing in the module is fixed? function sendChat(channel, message) {
if(client.userstate.hasOwnProperty(channel)) {
client.say(channel, message);
}
else {
setTimeout(sendChat, 10, channel, message); // Try again in 10ms
}
} |
The sendChat function you've provided works wonderfully. I wonder if tmi should have a timeout or something? Least the bug is known now. |
I didn't add any termination point that would account for the possibility of never joining the channel the message is intended for (including channel normalization), so be weary |
Okay, I gotta take it back. I made another barebones file, and all that ever happens is it constantly waits, with client.userstate only ever equalling edit: after calling client.join(), i manually added the userstate for the joined channel as an empty object and now it works?
|
This is something we can definitely improve. You cannot and should not alter the userstate object, it is something that we are doing automatically when joining and leaving a channel. We are adding #jtv in the userstate to prevent any bugs when sending whispers (whispers are sent via #jtv even if you are not on this channel) |
Yeah, I figured. I try only to use functions given to me via documentation but after finding this bug I had to go digging and find out why. It's preventing me from migrating to tmi.js from twitch-irc currently, so hopefully it'll be fixed soon. Thanks for looking at it. |
Does that commit mean this issue is resolved and can be closed? |
Issue is solved but I'm not gonna close it until I bump the beta version.. I still have some changes and new stuff to implement. Expect a version bump soon though 😄 |
Should be fixed now. Pushed update to NPM and CDN, please update to beta |
just so you know, it doesn't play well with node-mumble |
I have this same issue with the latest version 1.1.1 |
@TheHollidayInn, you get the same TypeError? "Cannot set property of 'message-type' of undefined" ? Did you join the channel before sending the message? |
@AlcaDesign Sorry, I was about to edit to clarify. After joining a channel, the I fixed some options to create a successful join. |
This is the error I get with the current latest codebase (d8c2e47) on Windows 8.1, running node 0.12.7 on npm 2.11.3
with this code
I've tried fixing the code myself, but I'm awful at fixing other people's code, especially when I don't know what it's doing or trying to do. Any suggestions would lovely. Any more information needed, let me know.
The text was updated successfully, but these errors were encountered: