tmijs / tmi.js

💬 Javascript library for the Twitch Messaging Interface. (Twitch.tv)
https://tmijs.com
MIT License
1.55k stars 215 forks source link

Hosted events not working. #339

Closed darektion closed 5 years ago

darektion commented 5 years ago

Code snippet: client.on('hosted', onHostedHandler); ... function onHostedHandler(target, username, viewers, autohost) { var type = (autohost) ? 'autohost' : 'host'; var trailing = (viewers >= 2) ? ', with ${viewers} viewers' : ''; console.log(${username} just ${type}ed the channel${trailing}!); }

Actual behaviour: Seeing that I am not getting a proper response from hosted events, I tried doing a console.log within the function. No logs generated for hosted events.

Expected behaviour: E.g. Incoming host from darektbot with 3 viewers, to my channel (darektion). onHostedHandler(#darektion, darektbot, 3, false); Log: darektbot just hosted the channel, with 3 viewers!

Additional comments: The other events like the handling of raids, chat messages and cheer events work as expected, except for host events - am I the only one with this problem right now? The parameters that I am using is based on version 1.4.2's documentation on "hosted" events: https://docs.tmijs.org/v1.4.2/Events.html#hosted

Server configuration

darektion commented 5 years ago

Note: I am unsure why the opening single quote (left single quotation mark) is not showing inside my console.log statement above. There is no formatting error in my console.log within the program.

AlcaDesign commented 5 years ago

I cannot definitively say that Twitch is still sending host events over IRC.

Is your client's identity the same as the channel being hosted? (As in the bot is logged in as the broadcaster)

darektion commented 5 years ago

No, my bot is a separate user. The bot has its own identity, and joins the broadcaster's channel.

AlcaDesign commented 5 years ago

It will not receive hosting events unless it's authorized as the broadcaster.

From the docs you linked: "This event is fired only if you are logged in as the broadcaster."