-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
can i write to a friend in a whisper directly without a bot? #2
Comments
|
Hey @rnyPlanet ! This is technically possible, but definitely more work than simply logging into Twitch and whispering him there, or adding him on another communication platform like Discord. But considering you asked, you shall receive: One way to go about this is to add a bot to your own Twitch channel, so that it can listen to whispers too. Then, every time we get a message from Twitch we'll check whether it's a WHISPER from our friend. If so, we'll print it. class MyBot:
def __init__(self):
self.host = "irc.chat.twitch.tv"
self.port = 6667
self.nick = "<user_name>"
self.chan = "#" + self.nick
self.auth = "oauth:<authentication>"
self.friend_nick = "<your_friends_nick>"
# Send along all required information, and the bot will start
# sending messages to your callback function. (self.message_handler in this case)
self.ws = TwitchWebsocket(host=self.host,
port=self.port,
chan=self.chan,
nick=self.nick,
auth=self.auth,
callback=self.message_handler,
capability=["membership", "tags", "commands"],
live=True)
self.ws.start_nonblocking()
# Infinitely loop so we can type what we want to send
while True:
# Allow us to type our message to send to the friend.
message = input("Send the following message to " + self.friend_nick + ":\n>")
self.send_whisper(self.friend_nick, message)
def message_handler(self, m):
# Check if we received a whisper from the friend
if m.type == "WHISPER" and m.user == self.friend_nick:
print(time.time(), m.user, ":", m.message)
if __name__ == "__main__":
MyBot()However, do note that I do not think it is not required to connect to a Twitch channel's chat to listen to WHISPER messages, but my TwitchWebsocket will automatically connect. That's just how it's implemented, because I use it for specifically connecting to Twitch chats. But again, my recommendation is for you two to get in touch via some other medium. |
thank you so much. I need this to work, receive whispers and send in telegrams (by notification type). I can not always go to twitch. I will try your code, thanks again) |
|
@cubiedev |
|
That is a shame. Whispers have given me troubles in the past too. |
|
I sympathize for the time spent and still I am grateful for the help)
|
Hello. I'm new, wondering if I can write to my friend whisper without a bot? so I have his nickname and I want to write to him through python and accept whisper from him, maybe so? looking all day, nothing ...
The text was updated successfully, but these errors were encountered: