Open Exponefrv1 opened 3 months ago
This make your code much more confusing, it's just something you can implement without it being added in the fork source code.
It's always best to manually do task during start() as stop().
You should propose a clear use case and benefits of this pr.
This make your code much more confusing, it's just something you can implement without it being added in the fork source code.
It's always best to manually do task during start() as stop().
You should propose a clear use case and benefits of this pr.
Probably you're right, but it's just more convenient. Instead of 4 lines of code you write only 1. These args are optional so why not?
I was inspired by this enhancement: https://github.com/pyrogram/pyrogram/issues/1264
Note: You can use client methods in on_startup and on_shutdown functions only if you're not specifying a coroutine in run() since new functions run only before coroutine (it means before client is authorized) and after It's finished (after client is terminated).
Example with coroutine specified (you CAN'T use app (client) in new functions):
Example without coroutine (you CAN use app (client) in new functions bc app is already running):