Hey there. Apologies if this has been answered - Tried to search but no luck.
I’ve deployed a Flask Application on cpanel, and when running my chat bot, I am receiving this error:
Traceback (most recent call last):
File “/opt/alt/python39/lib64/python3.9/threading.py”, line 973, in _bootstrap_inner
self.run()
File “/home/[redacted server name]/virtualenv/I_suck_at_code/3.9/lib/python3.9/site-packages/twitch/chat/irc.py”, line 24, in run
self.connect()
File “/home/[redacted server name]/virtualenv/I_suck_at_code/3.9/lib/python3.9/site-packages/twitch/chat/irc.py”, line 54, in connect
self.socket.connect((self.address, self.port))
ConnectionRefusedError: [Errno 111] Connection refused
This application works wonderfully on localhost - but when I try to deploy it to the internet, I come across this issue. I’ve ensured the app’s URL is under the Manage Application section in dev.twitch. I’ve ensured the webpage and all subpages / subdomains / everything has SSL attached to it. At this point I’m at a loss. I’ve throw at least 15+ hours at attempting to find a solution but this is the only stopping point.
Part of me thinks its the python-twitch library that I’m using, and I should rewrite everything using socket.
You got it! Okay. I was thinking twitch was refusing the connection on their side as the requests were coming from a server instead of my own pc. That does seem to make sense. Let me reach out to their customer service and see if this is blocked / if there is a way to unblock it.
Is there any specific port I should or shouldnt be using with these chat bots?
This doens’t matter if your hosting provider disallows running these sorts of services.
I rent services from three different providers. And one of them flat disallows IRC bots/services/eggdrop/etc. So they won’t unblock the port or appreciate bypassing that block.
You connect ot Twitch Chat on the IRC or websocket standard ports. So even if one of those ports work, you would be violating your providers TOS.
I reached out and they say their hosting allows for IRC services. I asked about ports 80 and 443, which they said are just fine to use. Kind of at a loss here.
Could I be using the wrong authentication method? The app doesnt utilize any user input - it just reads chat and updates the website (it’s a chart that intakes votes). I generated an oauth token using Twitch Chat Password Generator but I’m guessing that is not the correct way to do it. I just dont know how I can launch this flask app that requires no user input, listens for chat, and updates the page.
Turns out it was the port. The twitch-python library is set to 6667. I went into the lib and changed it to 80 and the messages are coming in now just fine. Now I need to figure out how to get my sockio to work T_T. Thanks for the help.