How to send whisper and how to listen all twich chanels? Python

Hello.
I create a bot for Twitch in Python using the V5 API. I can not deal with two issues:

  1. How to send a whisper to the user from the bot? I look to example of a bot at the link: https://github.com/twitchdev/chat-samples/blob/master/python/chatbot.py
    But there is sending a message to a channel: c.privmsg(self.channel, message)
    I tried to use the same method to send whisper, tried instead of self.channel to put the user id as int and as str, sent message, but received nothing.
  2. Is it possible to listen to all channels on twitch, such as in Reddit, when instead of specifying the subreddit one can specify ‘all’.
    I need this so that the channel administrator can use the command to enable the bot in his channel.
  1. (For whatever reason) The chat interface of Twitch has a WHISPER command that’s used to send whisper, instead of just PRIVMSGing to a user instead a channel.

  2. No, you can’t listen globally, usually for activation like this the streamer goes into the bots channel/chat and issues a !command there to make it join their own chat.

  1. Where I can see the documentation on this command. I look to https://dev.twitch.tv/docs/v5/reference/chat/ and don’t found any mention of this command
  2. Ok. It’s not good for my task.

Could you then say how many channels I can pass through the V5 API in the list of channels the bot to listen to?

I tried to send c.privmsg(’#jtv’, ‘/w sjavao The help command’) as I found in Programmicly send whisper C++
and c.privmsg(self.channel, ‘/w sjavao The help command’) and c.privmsg(self.channel, ‘.w sjavao The help command’). But received nothing. :frowning:

The only (at least known to me) way to get at the messages in a channel’s chat is to actually JOIN the channel - but be advised, most streamers really dislike random bots sitting in their channels, look at the discussions about faegwent and electricalskateboard, streamers really dislike them and would love to have them banned completely from the platform altogether.

About the whisper: check if your library maybe has a dedicated function for it, what works for my bot is (in raw IRC protocol):

WHISPER username :Text

Or at least it used to work the last time I tried (it’s been a while since then).

The bot that I am writing will only connect to the channel if requested by the administrator and disabled as soon as the administrator gives him such a command. Bot will send whisper only in response to commands from users. It is made that his messages did not litter the channel.

I use python irc library, it get available commands from server and it don’t get this command from irc.chat.twitch.tv

OK, I just tested it a bit and the WHISPER thing is actually something my bot does and “converts” into the PRIVMSG like stated in the post you linked above.

My bad, sorry for the confusion.

This just worked to send a whisper from my bot to myself:

PRIVMSG jtv :/w TheRealHellcat Testing.... 1, 2, 3

Note that there’s no “#” in front of the “jtv”.

//EDIT

Aaand I figured again where the “WHISPER” came from. When the bot receives a whisper, it’s sent to it like that…

Thank you!

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