How is BTTV adding emote names into text area?

I am working of something of my own and I am trying to get emote names from my emote menu into text area.

This is a small event listener I wrote in attempt to make it work.

emoteMenuWrap.addEventListener('click', function(e){
    if(e.target.nodeName !== 'IMG') return;
    chatInput.focus();
    chatInput.value += ' ' + e.target.alt + ' ' ;
});

Essentially, when an image is clicked, get it’s alt value and add it into the chatInput (textarea).

What happens is that the emote name gets added into textarea but:

  1. I can’t send it.
  2. It doesn’t appear in innerHTML unless I add at least one character of my own.
  3. It disappears on newly added message in the chat.

I very much appreciate any advice.
Even simply pointing me in a direction helps a lot.

Twitch uses the React framework and triggers a JavaScript function on input change which appends text to an internal string when someone types in chat or inserts from Twitch’s official emote menu. You would need to trigger that functionality in React.

Thanks for telling me, I haven’t used React yet so I am not very experienced with it.

Could You tell me which functionality do I need to trigger and can I trigger it without actually using React from my JavaScript file if inject it?

Also, I’d very much appreciate a resource or a sample of this functionality if You have the time.

We’re not equipped to assist with programming help here. You’re on your own.

If it’s not too much to ask. Could You at least point me to a specific file from BTTV’s github page so I can inspect it for myself?

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