How do I get the username of the message sender? (JavaScript) (node.js)


I’ve been trying use this tutorial by twitch to have a chatbot on my stream. Now I’m trying to answer a sender by targetting a message at them, but I don’t know how to get the senders name.

Is there a variable that contains the sender name?

You will need to write or use an IRC parser

Here is an example

Line 178 extracts the username
And payload.tags['display-name'] will containt the display name.

This Tutorial uses tmi.js so you’d have to refer to their documentation, if you wish to use this library