Python IRC bot and whispers

Lately, I’ve been working on a chat bot for a streamer. Since it has a lot of functions the spam becomes a bit too much. With this, I decided to make the bot direct responses to a user be sent by whispers. However, I haven’t been able to send them. I tried everything, from requesting all the CAPs to connecting to group servers’ IPs.

I’m using the following function:

def sendWhisper(s, user, message):
    messageTemp = "PRIVMSG #jtv :.w " + user + " " + message
    s.send(messageTemp + "\r\n")
    print("Sent whisper: " + messageTemp)

called by:

sendWhisper(s, "creaktive", "Hello")

Sometimes I get the “Unrecognized command /w” some other times I don’t. I tried with both “/w” and “.w” and none of them worked.
Was hoping some of you could enlighten me.
Thanks in advance!

Perhaps your bot is shadowbanned for spamming whispers:

Bot banned from Whispers?!

Get yours on the list to be sure. It takes 24h to take effect from the moment they see your post and white list your bot.

Thanks for your reply.
The only bans that this bot got were due to an endless While loop sending messages to channel, not by whispering, and that was when it was coded with mSL (~2 months ago).
I can log in to the bot account and manually send whispers, though.

The obligatory is-your-power-plug-connected-question… is the s in your call a socket connected to a group chat server?

@livewhiletrue yes, I tried with various IPs from the servers array of this link , still nothing worked

You also sent this in the correct order:

PASS oauth:twitch_oauth_token NICK twitch_username

and received this? 001 twitch_username :Welcome, GLHF! 002 twitch_username :Your host is 003 twitch_username :This server is rather new 004 twitch_username :- 375 twitch_username :- 372 twitch_username :You are in a maze of twisty passages, all alike. 376 twitch_username :>

are you able to connect to a regular channel to send and receive regular PRIVMSG?

Sorry for the delay, was out of town.
Yes, as I said the bot works fine with everything but just can’t seem to find a way to send whispers

you need to send CAP REQ to be able to recieve them, but I don’t think you need it for sending. Other than that I personally am coming up empty. The little code you posted seems to produce the correct format.

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