-
Notifications
You must be signed in to change notification settings - Fork 48
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
Update to Python 3.9.1 #2
base: main
Are you sure you want to change the base?
Conversation
Thank you @RikiRC for the changes. Now the bot runs with the latest version of Python. |
Hi @Coincident, I have tested it again and it works ok for me. Sometimes this bot can't connect first try, so sometimes you have to restart it few times. But if it is connected to irc channel then you see message: Also bot sends message to twitch chat when connected: |
Hello. Thanks for the reply. Yeah, I've double-checked. I do not have the "oauth:" prefix in the token string, I've removed it before. I tried starting & stopping the bot multiple times, it never works. Also, there seems to be an error on line 22: 853f956#diff-ce7c8a3a3f07f8572f7bb29f6313e8feb4a61d0082a8555fcee60ca6aca2cba6L22 Otherwise the bot will only work if channel == username; which means you're using your own Twitch account as the login for the bot. In my case I have made a separate account for the bot, so I had to change the line. Edit: Nevermind. This is incorrect. There is no error on line 22. |
Thanks work very well ! 👌 |
Sorry about the last message; that was a big confusion on my behalf. I reverted the changes to the code and somehow the bot connected this time. I had tried this before and it didn't work. No idea what I did different this time... But the bot never responds to any comments or messages, and I never see the "'Received command: ' + cmd" print. The "Connected!" message does not appear at first; it only appears if I use my actual browser to login with the bot's Twitch account and manually join the channel. But even like that, the bot does not respond to commands. |
Hello again, after several hours of experimenting and researching, I found the culprit of the problem: "channel" has to be entirely in lower-case! https://discuss.dev.twitch.tv/t/python-bot-irc-problem-just-asking-for-explanation/30123 Now the bot finally works! |
@RikiRC awesome. That last commit will prevent the next people who try this to run into the same lower-case problem. I would also recommend another change to prevent more problems:
|
print 'Connecting to ' + server + ' on port ' + str(port) + '...' | ||
irc.bot.SingleServerIRCBot.__init__(self, [(server, port, 'oauth:'+token)], username, username) | ||
print('Connecting to ' + server + ' on port ' + str(port) + '...') | ||
irc.bot.SingleServerIRCBot.__init__(self, [(server, port, 'oauth:'+self.token)], username, username) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use super()
. To make it more readable
I have made few changes to made it work with Python 3.9.1 and updated API request.