How do you get a twitch chatbot to read whispers in c#?

I’m pretty new to IRC coding, and I’d like my bot to have a functionality where it asks questions in chat and then receives answers via whisper, to avoid chat spam of everyone answering. Problem is for the life of me I can’t figure out how to get it to recognize it’s been whispered and read the message. I read somewhere that if it’s a whisper it will show up as WHISPER instead of PRIVMSG but that doesn’t seem to work.

Your library might be parsing for PRIVMSG’s and not be capable of parsing for WHISPER’s so if you log the RAW lines you get from Twitch you can see whats going on and if it’s a parser fault or not

I’m messing around with TwitchLib now but I wasn’t using any library at all other than System/.net.sockets/.IO

Parsing code is just manual if contains

if (message.Contains(“WHISPER”))
//Do Whisper Stuff
if (message.Contains("PRIVMSG"))
//Do Regular Chat stuff

The PRIVMSG works fine but it doesn’t recognize whispers. TwitchLib has what I need I think but I’d still like to find an answer for this for my own knowledge.

A received whisper looks like

@badges=;color=#2E8B57;display-name=BarryKitten;emotes=;message-id=818;thread-id=15185913_91429215;turbo=0;user-id=91429215;user-type= :barrykitten! WHISPER barrycarlyon :oi

And a PRIVMSG is the same, just swap WHISPER for PRIVMSG

You may need to have enabled the COMMANDS cap

The docs don’t mention specifically. But most people always enabled commands, for extra commands, and tags for extra data.

I predict the commands cap is required to receive whispers, and you didn’t request it

EDIT: Confirmed. the commands capability is required to receive Whispers

After sending PASS and NICK and before joining any channels, send


and if you want extra data



PASS oauth:whatever
NICK whatever
JOIN #someroom

And away you go (joining optional)

There is a uservoice open for a documentation fix here

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