We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Windows 11 Pro 22H2
Python 3.11.6
3.3.0
Shutdown Event in Dispatcher should be fired, so all the registered functions should be called.
Shutdown Event in Dispatcher is ignored. Registered functions aren't getting called on bot closing.
import asyncio import logging from aiogram import Dispatcher, Bot, Router, types, F from aiogram.filters.command import Command # constants BOT_TOKEN = "bla-bla" OWNER_ID = "bla-bla" # setup configs logging.basicConfig(level=logging.INFO) async def on_startup(bot: Bot): await bot.send_message(OWNER_ID, "Bot launched!") async def on_shutdown(bot: Bot): await bot.send_message(OWNER_ID, "Bot closed!") async def start(): dp = Dispatcher() dp.shutdown.register(on_shutdown) dp.startup.register(on_startup) bot = Bot(token=BOT_TOKEN) try: await dp.start_polling(bot) finally: await bot.session.close() if __name__ == "__main__": asyncio.run(start())
No response
There is no logs about closing. Event is just skipped.
The text was updated successfully, but these errors were encountered:
Signals are not supported by Windows, so you need to stop polling explicitly by await dp.stop_polling()
await dp.stop_polling()
For aiogram team: To close the issue we need to add information about this behaviour
Sorry, something went wrong.
So there is no way to fire .shutdown event when program stops working on Windows?
.shutdown
No branches or pull requests
Checklist
Operating system
Windows 11 Pro 22H2
Python version
Python 3.11.6
aiogram version
3.3.0
Expected behavior
Shutdown Event in Dispatcher should be fired, so all the registered functions should be called.
Current behavior
Shutdown Event in Dispatcher is ignored. Registered functions aren't getting called on bot closing.
Steps to reproduce
Code example
Logs
No response
Additional information
There is no logs about closing. Event is just skipped.
The text was updated successfully, but these errors were encountered: