Custom chat with javascript

i am trying to make my own custom chat display on my site but i dont want to use external sources and code to get the chat info… is there any way i can simply get the embedded chats html info to display in my custom one ? or some how get what ever is sending it the info to send it to my one

You can open a websocket to chat as documented and construct the html elements yourself. Doing the emote parsing properly can be difficult to handle.

i have no clue what i am looking at here lol
i thnk i just worked out how to get the oauth key but now i am lost as to how i use it?

i dont get this at all lol… i was assuming it would be something simple like you do a url thing and it would return the last like 20 messages or something in a raw format lol

You could iframe embed:

https://www.twitch.tv/twitch/chat

as described here:

It’s the simpliest way but it doesn’t give you any power to do anything with it.

So you’d have to take 3v’s solution and basically reimplement Twitch Chat

but then how do i get the chat info? i get a origin error if i try to get the html info from with in it
and i dont understand whats to do with whats on his link

You cannot fetch and use the HTML from the link, how you are trying.

Either use a HTML iFrame as documented on my link.

Or connect to TwitchIRC as documented by 3v and reimplement Twitch Chat.

3v’s lets you do what you want, will full customisation.
Mine lets you embed twitch chat exactly how it looks like on Twitch, with no customisation

but how do i do the “3v” thing? i am as far as getting the OAuth token but now what do i do with it?

ok so i got it working using this guys code here and fixing the “ws.on” functions and changing server to the one in this page
i got things like knowing when some one joins and leaves and sends a message working so it tells you who and what and i will post my code when i get it all cleaned up to tomorrow :smiley: is it just me or dose the api suck

but i seem to have a large amount of lag between when some one joins and leaves and when it says thy did… like up to a few minutes sometimes ? i am about to go to bed so i have not googled it yet lol

o also is there any way i can “request” the current list of people in the stream or something? and how would i go about sending a message?

The JOIN event often is delayed, by, from what I have seen in the bot I develop on from 1-5 minutes (usually closer to 1-2 minutes though, sometimes longer). The LEAVE event can be similar as well, so that sounds normal to me. There is an unsupported API that you can use to get a list of chatters, assuming it is still available, I haven’t tested it in ages:

https://tmi.twitch.tv/group/user/usernamehere/chatters

Do keep in mind that is cached and even that API will never be a real-time representation of who is in chat, more than likely.

I do not think the API sucks as it mostly follows the IRC RFC standard and is pretty spiffy in the way that it maintains compatibility with a great number of IRC clients and is fairly easy to interface with.

well here my code so far… bit messy it works… worked out how to post in chat but still nothing on getting a list of people in it
http://pasteall.org/373718

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.