Host information

I am looking through the IRC chat doc and don’t see any information on reading in host information (this this for Raids)

> @badges=turbo/1;color=#9ACD32;display-name=TestChannel;emotes=;id=3d830f12-795c-447d-af3c-ea05e40fbddb;login=testchannel;mod=0;msg-id=raid;msg-param-displayName=TestChannel;msg-param-login=testchannel;msg-param-viewerCount=15;room-id=56379257;subscriber=0;system-msg=15\sraiders\sfrom\sTestChannel\shave\sjoined\n!;tmi-sent-ts=1507246572675;tmi-sent-ts=1507246572675;turbo=1;user-id=123456;user-type= :tmi.twitch.tv USERNOTICE #othertestchannel

. Am I just blind and missing or can someone provide me the console data that is sent when a host id done for a channel.

I think you’re looking for HOSTTARGET

oh, that is the information, ok, thanks. I saw this and didnt know if thats what i was supposed to use or if that was something different. I’m still new, thank you.

Host starts message:

> :tmi.twitch.tv HOSTTARGET #hosting_channel <channel> [<number-of-viewers>]

Host stops message:

> :tmi.twitch.tv HOSTTARGET #hosting_channel :- [<number-of-viewers>]

what does the start and stop message mean? also, #hosting_channel does that mean the target channel being hosted, or is that the channel initiating the host?

The channel initiating the host.

ok i am trying to work with this, and I cannot get it to work at all. Is :tmi.twitch.tv HOSTTARGET #hosting_channel <channel> [<number-of-viewers>] the entire message or do I need extra things like an oauth token?

I keep getting Uncaught SyntaxError: Unexpected identifier

Please post the code you are using to connect to chat and listen for commands.

this is the code i am using to listen for host calls

hostTrigger: function (data) {

  //  if (data.includes("PRIV")) {
        
        var parts  =  data.split(' ');
        var vars = {};


        if(parts[1] === "HOSTTARGET")
        {
            if(parts[3] === ":-")
            {
                return;
            }

            else{

                var name = parts[2];
                vars.hostName = name;
                
                var quantity = parts[4];
                vars.hostAmount = quantity;
    
                sendVariables(constants.inputNames.HOST_ALERT, vars, "alert");
            }
   
    }
},

I am confused on what message is coming in for me to listen for.

Is it: tmi.twitch.tv HOSTTARGET #lantheos :lilrex2015 0

or is it: @msg-id=host_on :tmi.twitch.tv NOTICE #lantheos :Now hosting Lilrex2015.

and how am I supposed to test it, whenever I put it in the console it returns Uncaught SyntaxError: Unexpected identifier

tmi.twitch.tv HOSTTARGET #lantheos :lilrex2015 0

is default

@msg-id=host_on :tmi.twitch.tv NOTICE #lantheos :Now hosting Lilrex2015.

is if you have requested the TAGS capability

But I’d have to dig thru my code/notes to check to be sure, and I don’t bother with the HOST’s too much as the chatter count is only in the broadcasters chat for incoming hosts… And I don’t login as broadcaster ever

Looking at the docs

Host Start

> :tmi.twitch.tv HOSTTARGET #hosting_channel <channel> [<number-of-viewers>]

Host End

> :tmi.twitch.tv HOSTTARGET #hosting_channel :- [<number-of-viewers>]

With TAGS capability the additional occurs: (or may replace not sure without testing to be sure which I can’t right now)

msg-id Tags for the NOTICE Commands Capability

msg-id Message
bad_host_hosting This channel is hosting <channel>
host_off Exited host mode.
host_on Now hosting .
hosts_remaining There are host commands remaining this half hour.

Hi Barry, I appreciate the response, but I am confused still, what message am I listening for?

When I try and use tmi.twitch.tv HOSTTARGET #lantheos :lilrex2015 0 I get no response and when I throw a sample line into the debug console all I get back is Uncaught SyntaxError: Unexpected identifier

You are trying to SEND a hosttarget to chat?

Twitch sends HOSTTARGETs as a specicial message (like how a regular message is of type PRIVMSG)

You cannot send a HOSTTARGET, twitch sends a HOSTTARGET

If you want to send a host to change the host on a given channel you just send .host TARGETCHANNEL to the channel you want to change the host of.

So if I want to use my bot to change hosts on my channel to cohhcarnage

BarryCarlyonBot would send a PRIVMSG of .host cohhcarnage to the channel barrycarlyon

so can you give me an example of what that will look like when i pass it to the console.

Im still really new to programming and JS, so a lot of this is hard for me to wrap my head around.

I don’t understand what you are actually trying to do…

I am trying to make an alert trigger when a channel gets a host from another channel.

I have set up subscribers, follows and all the others. But since hosts apparently do not come in the same way

@badges=turbo/1;color=#9ACD32;display-name=TestChannel;emotes=;id=3d830f12-795c-447d-af3c-ea05e40fbddb;login=testchannel;mod=0;msg-id=raid;msg-param-displayName=TestChannel;msg-param-login=testchannel;msg-param-viewerCount=15;room-id=56379257;subscriber=0;system-msg=15\sraiders\sfrom\sTestChannel\shave\sjoined\n!;tmi-sent-ts=1507246572675;tmi-sent-ts=1507246572675;turbo=1;user-id=123456;user-type= :tmi.twitch.tv USERNOTICE #othertestchannel


this way, I am having trouble understanding what message I am listening for, and bc of that, I am confused on how I can test to see if I am capturing the right message

You want inbound raids or inbound hosts or both?

You’ve asked about hosts and posted an example message about raids. Raids and hosts are two separate slightly connected things…

I want hosts, I was using raids to see if I could capture host data the same way. But from the responses I have been getting I guess not.

Ill break it down and hopefully I explain this right (please forgive me)

I want a host alert, I looked over the doc and I see HOSTTARTGET and a chat command , I have no idea which one is which, nor what either one does. I simply want to listen for when a channel hosts me and trigger an alert.

Inbound hosts are undocumented and I don’t have an example payload as I don’t login to chat as the broadcaster ever

For hosts I poke this API

http://tmi.twitch.tv/hosts?include_logins=1&target=USERID

or

https://api.twitch.tv/kraken/channels/USERID/hosts

why?

I’ve never had a broadcaster grant me a chat login scope for their account for security reasons…