mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Merge branch 'Latand/dev-3.x' into dev-3.x
This commit is contained in:
commit
fcf9454e13
3 changed files with 11 additions and 4 deletions
1
CHANGES/1178.feature
Normal file
1
CHANGES/1178.feature
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
Made allowed_updates list to revolve automatically in start_polling method if not set explicitly.
|
||||||
|
|
@ -18,6 +18,7 @@ from ..fsm.strategy import FSMStrategy
|
||||||
from ..methods import GetUpdates, TelegramMethod
|
from ..methods import GetUpdates, TelegramMethod
|
||||||
from ..methods.base import TelegramType
|
from ..methods.base import TelegramType
|
||||||
from ..types import Update, User
|
from ..types import Update, User
|
||||||
|
from ..types.base import UNSET_TYPE, UNSET
|
||||||
from ..types.update import UpdateTypeLookupError
|
from ..types.update import UpdateTypeLookupError
|
||||||
from ..utils.backoff import Backoff, BackoffConfig
|
from ..utils.backoff import Backoff, BackoffConfig
|
||||||
from .event.bases import UNHANDLED, SkipHandler
|
from .event.bases import UNHANDLED, SkipHandler
|
||||||
|
|
@ -458,7 +459,7 @@ class Dispatcher(Router):
|
||||||
polling_timeout: int = 10,
|
polling_timeout: int = 10,
|
||||||
handle_as_tasks: bool = True,
|
handle_as_tasks: bool = True,
|
||||||
backoff_config: BackoffConfig = DEFAULT_BACKOFF_CONFIG,
|
backoff_config: BackoffConfig = DEFAULT_BACKOFF_CONFIG,
|
||||||
allowed_updates: Optional[List[str]] = None,
|
allowed_updates: Optional[Union[List[str], UNSET_TYPE]] = UNSET,
|
||||||
handle_signals: bool = True,
|
handle_signals: bool = True,
|
||||||
close_bot_session: bool = True,
|
close_bot_session: bool = True,
|
||||||
**kwargs: Any,
|
**kwargs: Any,
|
||||||
|
|
@ -471,6 +472,7 @@ class Dispatcher(Router):
|
||||||
:param handle_as_tasks: Run task for each event and no wait result
|
:param handle_as_tasks: Run task for each event and no wait result
|
||||||
:param backoff_config: backoff-retry config
|
:param backoff_config: backoff-retry config
|
||||||
:param allowed_updates: List of the update types you want your bot to receive
|
:param allowed_updates: List of the update types you want your bot to receive
|
||||||
|
By default, all used update types are enabled (resolved from handlers)
|
||||||
:param handle_signals: handle signals (SIGINT/SIGTERM)
|
:param handle_signals: handle signals (SIGINT/SIGTERM)
|
||||||
:param close_bot_session: close bot sessions on shutdown
|
:param close_bot_session: close bot sessions on shutdown
|
||||||
:param kwargs: contextual data
|
:param kwargs: contextual data
|
||||||
|
|
@ -490,6 +492,9 @@ class Dispatcher(Router):
|
||||||
if self._stopped_signal is None:
|
if self._stopped_signal is None:
|
||||||
self._stopped_signal = Event()
|
self._stopped_signal = Event()
|
||||||
|
|
||||||
|
if allowed_updates is UNSET:
|
||||||
|
allowed_updates = self.resolve_used_update_types()
|
||||||
|
|
||||||
self._stop_signal.clear()
|
self._stop_signal.clear()
|
||||||
self._stopped_signal.clear()
|
self._stopped_signal.clear()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,8 @@ class MutableTelegramObject(TelegramObject):
|
||||||
|
|
||||||
|
|
||||||
# special sentinel object which used in situation when None might be a useful value
|
# special sentinel object which used in situation when None might be a useful value
|
||||||
|
UNSET: Any = sentinel.UNSET
|
||||||
UNSET_PARSE_MODE: Any = sentinel.UNSET_PARSE_MODE
|
UNSET_PARSE_MODE: Any = sentinel.UNSET_PARSE_MODE
|
||||||
UNSET_DISABLE_WEB_PAGE_PREVIEW = sentinel.UNSET_DISABLE_WEB_PAGE_PREVIEW
|
UNSET_DISABLE_WEB_PAGE_PREVIEW: Any = sentinel.UNSET_DISABLE_WEB_PAGE_PREVIEW
|
||||||
UNSET_PROTECT_CONTENT = sentinel.UNSET_PROTECT_CONTENT
|
UNSET_PROTECT_CONTENT: Any = sentinel.UNSET_PROTECT_CONTENT
|
||||||
UNSET_TYPE = type(sentinel.DEFAULT)
|
UNSET_TYPE: Any = type(UNSET)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue