Sending messages to Twitch chat with Python

Viewed 365

I have OAuth token of account and want to send messages from Python console. All the methods that I found were more related to bots, but I want to send messages myself. The only way to do it for now is with IRC:

import twitch_chat_irc


username = "username"
token = "oauth:token"
channel = "twitch-channel"


def send_message(message):
    connection = twitch_chat_irc.TwitchChatIRC(username, token)
    connection.send(username, channel, message)
    print('Done!')


def main():
    while True:
        print("Type message:")
        message = str(input())
        send_message(message)


if __name__ == "__main__":
    main()

Sometimes my messages do not reach the chat, but locally I see them in the twitch tab in my browser. Apparently some kind of protection is triggered or IP is temporarily blocked, I do not know for sure.

Is it possible to send messages from different proxies using this method? Or are there any other ways to send messages?

0 Answers
Related