Unable to Send Whispers via Bot?

I’ve been working on a Python bot that would send a whisper to my main Twitch account on a somewhat regular interval, generally about every 5 minutes. I’ve tried following the syntax provided on various other discussion topics (provided below), but I haven’t had any success receiving the whisper on my non-bot account. Recent discussions of issues with sending whispers seem to have shifted over to shadowbans/needing to be whitelisted, but given that I’m only sending these to myself (from bot->main account) and I’ve yet to successfully view any of the whispers a ban seems unlikely to me.

Any ideas as to what might be going wrong?

ws = socket.socket()
ws.send("USER {}\r\n".format(cfg.NICK).encode("utf-8"))
ws.send("PASS {}\r\n".format(cfg.PASS).encode("utf-8"))
ws.send("NICK {}\r\n".format(cfg.NICK).encode("utf-8"))
ws.send("CAP REQ :twitch.tv/commands\r\n".encode("utf-8"))
username = "stuker"
msg = "hmm"
sock.send('PRIVMSG #jtv :/w {} {}\r\n'.format(username, msg).encode(encoding='utf_8'))

Your ws changes to sock within the ...? ws is a bit misleading as irc.chat.twitch.tv is not a websocket endpoint.

Ah sorry, I probably should have been clearer what was going on during what I ellipses-ed out. The last 3 lines of code are actually occurring in a separate function that received the previously socket “ws” as a parameter (“sock”).

Additionally these are traditional socket objects rather than websockets, “ws” was shorthand for “whisper socket” when I was trying to use a separate socket connection to send the whispers. I can see how that would be misleading though!

Is your bot able to send normal chat messages? Also USER is not required; it’s ignored.

Yep, the bot hasn’t had any issue sending traditional chat messages via PRIVMSG, whispers just don’t seem to be working as expected.

I just created another topic on this because I did not see this one. I am having the same issue. It seems that if you do not follow the bot account it cannot whisper you. However, if you do the same thing on the main site it works fine.

So I assume a change was made. I’m guessing it’s to stop spam bots maybe?

My topic: Not able to send whispers from a bot

1 Like

That did the trick, thanks!

…So this seems to have randomly cropped up again this past week, in a slightly different flavor.

Ever since Monday/Tuesday this week, whispers are being registered on the Twitch website (i.e. if I am on a channel I receive the badge for a new whisper and can view it within the Conversations List button) but they are no longer being displayed in-line on the chat sidebar. I haven’t made any changes to my code and the whispers are still being delivered in some sense, so I’m assuming a change was made on Twitch’s side.

I’ve tried initiating the conversation from the user-side via a /w in the sidebar based on a couple of suggestions from here and it didn’t seem to make any difference. Has anyone encountered something similar this week?

My bot doesn’t appear to be able to send messages to a user unless the user has messaged me in the past. User doesn’t have the non-follower setting checked in settings, and is a follower/mod of the channel.

It’s a problem reported in another thread but so far we haven’t got an official response as if it’s a spam-preventing measure not going to be “fixed” or if it’s a real bug.

Hmm, I did see that thread but I’d missed your posts-- does seem like you’re encountering the same issues I am. Poking around the chat window in Chrome’s DevTools actually revealed something fairly interesting. Looking at the open websockets it seems like the chat window opens two connections to the IRC server: one for general chat traffic and one that specifically listens for inbound whispers. Any whispers sent to my account were still being received by both sockets, so I went ahead and threw together a quick extension to display the messages inline with chat manually.

Of course, after going through that exercise, today my whispers started working again same as they always have. Not sure exactly what changed; I noticed BTTV needed some new permissions as well so seems possible that there were some updates to the chat system?

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