Answer the question
In order to leave comments, you need to log in
Bot aiogram on heroku?
Task: to make an admin bot that is in several groups and, depending on the I'd of the chat, sends a corresponding poll at a certain time. Is it possible to do this, using aiogram and aioschedule, it all works in the console. Not working via heroku, help?)
async def spam_start():
aioschedule.every(5).seconds.do(football_poll)
while True:
await aioschedule.run_pending()
await asyncio.sleep(1)
async def start_bot(_):
print('Bot is starting')
SqlLiteDb.sql_start()
asyncio.create_task(spam_start())
if __name__ == '__main__':
executor.start_polling(dp, skip_updates=True, on_startup=start_bot)
Answer the question
In order to leave comments, you need to log in
what do you mean it doesn't work?
Heroku hosts web applications that receive and send data via https requests by url. (This is if for free)
to save resources, Heroku disables such applications until there are no requests and turns them on when a request comes. since the bot does not receive such requests, heroku stops it. at least that's how it was for me with the bot on the node. I made a tricky feint that the bot sends a request to itself once every 5 minutes and does not let me fall asleep. but in this case, for a month of continuous work, there are not enough free hours that they give for heroku.
in general, it is advisable to buy a full-fledged vps or a heroku subscription
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question