Before you start throwing words of advice, here are the things i read on stackoverflow that I already have done :
- make a file of type
.file
(procfile or something) and putworker : python3.8.3 bot.py
- make a runtime.txt and put
python-3.8.3
- make a requirements.txt and put
async-timeout==3.0.1
discord.py==1.3.3
( I didnt make a venv so the modules i thought would be useful i only included those , its just a basic bot , code below)
- I am not using any
.env
files so i didnt have to configure the environment variable settings in Heroku
Lastly here is my bot that works when hosted locally but doesnt work ( not even get online even though build is succesful )
import discord
streak1=0
client = discord.Client()
@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))
@client.event
async def on_message(message):
if message.author == client.user:
return
if message.content.startswith('$hello'):
await message.channel.send('Hello! You are '+str(message.author) +' and I am '+str(client.user))
if "$t1" in message.content:
global streak1
streak1+=1
await message.channel.send('Current Streak is'+str(streak1))
client.run('Normally i put my token here but well..')
Here is a picture of the recent Activity on my Heroku account ( with auto deploy enabled)
----------Edit 1 ----------
I deleted the file of type .file
and isntead made an actual Procfile
with no extensions and added worker : python3.8.3 bot.py
and now the (successful) build log is :
-----> Python app detected
-----> No change in requirements detected, installing from cache
-----> Installing SQLite3
-----> Installing requirements with pip
-----> Discovering process types
Procfile declares types -> worker
-----> Compressing...
Done: 48.7M
-----> Launching...
Released v8
https://housekeeper0.herokuapp.com/ deployed to Heroku
----------Edit 2----------
Heroku logs after i turned maintenance mode off
2020-06-05T15:09:12.771374+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=housekeeper0.herokuapp.com request_id=192d5f69-baa2-45aa-87c2-e825b9b0a3e9 fwd="42.110.144.123" dyno= connect= service= status=503 bytes= protocol=https
2020-06-05T15:09:13.138611+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=housekeeper0.herokuapp.com request_id=2f9e9311-3a52-45c1-bd6d-e97029265ae7 fwd="42.110.128.196" dyno= connect= service= status=503 bytes= protocol=https
2020-06-05T15:09:51.000000+00:00 app[api]: Build started by user valusoutrik@gmail.com
2020-06-05T15:10:14.642049+00:00 app[api]: Release v9 created by user valusoutrik@gmail.com
2020-06-05T15:10:14.642049+00:00 app[api]: Deploy 44992c2a by user valusoutrik@gmail.com
2020-06-05T15:10:14.870453+00:00 heroku[worker.1]: State changed from crashed to starting
2020-06-05T15:10:19.063466+00:00 heroku[worker.1]: Starting process with command `: python3.8.3 bot.py`
2020-06-05T15:10:19.773065+00:00 heroku[worker.1]: State changed from starting to up
2020-06-05T15:10:22.236921+00:00 heroku[worker.1]: Process exited with status 0
2020-06-05T15:10:22.285159+00:00 heroku[worker.1]: State changed from up to crashed
2020-06-05T15:10:23.000000+00:00 app[api]: Build succeeded
2020-06-05T15:10:25.240729+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=housekeeper0.herokuapp.com request_id=08dfc489-44ce-4343-a086-6ca25655333a fwd="42.110.144.123" dyno= connect= service= status=503 bytes= protocol=https
2020-06-05T15:15:00.686869+00:00 heroku[worker.1]: State changed from crashed to starting
2020-06-05T15:15:04.221869+00:00 heroku[worker.1]: Starting process with command `: python3.8.3 bot.py`
2020-06-05T15:15:04.940175+00:00 heroku[worker.1]: State changed from starting to up
2020-06-05T15:15:07.084995+00:00 heroku[worker.1]: Process exited with status 0
2020-06-05T15:15:07.134788+00:00 heroku[worker.1]: State changed from up to crashed
---------Edit 3-------------
On using heroku local
I get
[OKAY] Loaded ENV .env File as KEY=VALUE Format
8:53:00 AM worker.1 | File "bot.py", line 7
8:53:00 AM worker.1 | async def on_ready():
8:53:00 AM worker.1 | ^
8:53:00 AM worker.1 | SyntaxError: invalid syntax
[DONE] Killing all processes with signal SIGINT
8:53:00 AM worker.1 Exited with exit code null
this works perfectly well on my computer without importing async but just having it installed , so i added it to my requirements
My current requirements.txt
git+https://github.com/Rapptz/discord.py
async-timeout==3.0.1
asyncio==3.4.3
i also imported asyncio into my bot.py