'Discord bot not running with heroku
I'm in the process of moving my discord bot from locally hosting to heroku and i seem to have everything down except for actually running it.
When I enable the python worker, it doesn't seem to bring my bot online. I'm not sure why this would be the case. It's connected to my GitHub and the bot token is defined using the vars.
The build logs look normal but the app logs have some errors that I'm not sure how to fix, which I have to assume is the problem.
Application logs:
2022-04-15T05:10:52.792118+00:00 app[worker.1]: from .client import Client
2022-04-15T05:10:52.792127+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.10/site-packages/discord/client.py", line 53, in <module>
2022-04-15T05:10:52.792226+00:00 app[worker.1]: from .webhook import Webhook
2022-04-15T05:10:52.792234+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.10/site-packages/discord/webhook/__init__.py", line 12, in <module>
2022-04-15T05:10:52.792307+00:00 app[worker.1]: from .async_ import *
2022-04-15T05:10:52.792315+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.10/site-packages/discord/webhook/async_.py", line 52, in <module>
2022-04-15T05:10:52.792382+00:00 app[worker.1]: from ..channel import PartialMessageable
2022-04-15T05:10:52.792405+00:00 app[worker.1]: ImportError: cannot import name 'PartialMessageable' from 'discord.channel' (/app/.heroku/python/lib/python3.10/site-packages/discord/channel.py)
2022-04-15T05:10:52.949575+00:00 heroku[worker.1]: Process exited with status 1
2022-04-15T05:10:53.184475+00:00 heroku[worker.1]: State changed from up to crashed
2022-04-15T06:01:19.686916+00:00 heroku[worker.1]: State changed from crashed to starting
2022-04-15T06:01:23.574488+00:00 heroku[worker.1]: Starting process with command `python3 bot.py`
2022-04-15T06:01:24.141886+00:00 heroku[worker.1]: State changed from starting to up
2022-04-15T06:01:25.439092+00:00 heroku[worker.1]: State changed from up to crashed
2022-04-15T06:01:25.319879+00:00 heroku[worker.1]: Process exited with status 1
2022-04-15T06:01:25.157617+00:00 app[worker.1]: Traceback (most recent call last):
2022-04-15T06:01:25.157650+00:00 app[worker.1]: File "/app/bot.py", line 1, in <module>
2022-04-15T06:01:25.157743+00:00 app[worker.1]: import discord
2022-04-15T06:01:25.157748+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.10/site-packages/discord/__init__.py", line 25, in <module>
2022-04-15T06:01:25.157813+00:00 app[worker.1]: from .client import Client
2022-04-15T06:01:25.157822+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.10/site-packages/discord/client.py", line 53, in <module>
2022-04-15T06:01:25.157898+00:00 app[worker.1]: from .webhook import Webhook
2022-04-15T06:01:25.157900+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.10/site-packages/discord/webhook/__init__.py", line 12, in <module>
2022-04-15T06:01:25.157953+00:00 app[worker.1]: from .async_ import *
2022-04-15T06:01:25.157961+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.10/site-packages/discord/webhook/async_.py", line 52, in <module>
2022-04-15T06:01:25.158026+00:00 app[worker.1]: from ..channel import PartialMessageable
2022-04-15T06:01:25.158049+00:00 app[worker.1]: ImportError: cannot import name 'PartialMessageable' from 'discord.channel' (/app/.heroku/python/lib/python3.10/site-packages/discord/channel.py)
My code is too long to put here but when I run it locally it works anyway, but if any specific code is needed I can reply with it. Any help is appreciated, thanks!
Solution 1:[1]
Fixed by updating to discord.py v2.0.0a because for some reason when i installed it, i was on v1.7
if anyone needs the import code:
python3 -m pip install -U git+https://github.com/Rapptz/discord.py
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Rubix |
