mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-11 01:54:53 +00:00
Check bot instance on Dispatcher __init__
This commit is contained in:
parent
dd899c9ca0
commit
3a38125619
2 changed files with 39 additions and 1 deletions
|
|
@ -35,6 +35,9 @@ class Dispatcher(DataMixin, ContextInstanceMixin):
|
|||
throttling_rate_limit=DEFAULT_RATE_LIMIT, no_throttle_error=False,
|
||||
filters_factory=None):
|
||||
|
||||
if not isinstance(bot, Bot):
|
||||
raise TypeError(f"Argument 'bot' must be an instance of Bot, not '{type(bot).__name__}'")
|
||||
|
||||
if loop is None:
|
||||
loop = bot.loop
|
||||
if storage is None:
|
||||
|
|
@ -276,7 +279,7 @@ class Dispatcher(DataMixin, ContextInstanceMixin):
|
|||
|
||||
:return:
|
||||
"""
|
||||
if self._polling:
|
||||
if hasattr(self, '_polling') and self._polling:
|
||||
log.info('Stop polling...')
|
||||
self._polling = False
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue