Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Widen specified type forallowed_updates Application/Updater parameter#4589

New issue

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Bibo-Joshi merged 2 commits intopython-telegram-bot:masterfromnemacysts:master
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletionstelegram/_webhookinfo.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -17,6 +17,7 @@
# You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""This module contains an object that represents a Telegram WebhookInfo."""

from collections.abc import Sequence
from datetime import datetime
from typing import TYPE_CHECKING, Optional
Expand DownExpand Up@@ -60,7 +61,7 @@ class WebhookInfo(TelegramObject):
most recent error that happened when trying to deliver an update via webhook.
max_connections (:obj:`int`, optional): Maximum allowed number of simultaneous HTTPS
connections to the webhook for update delivery.
allowed_updates (Sequence[:obj:`str`], optional): Alist of update types the bot is
allowed_updates (Sequence[:obj:`str`], optional): Asequence of update types the bot is
subscribed to. Defaults to all update types, except
:attr:`telegram.Update.chat_member`.

Expand DownExpand Up@@ -90,7 +91,7 @@ class WebhookInfo(TelegramObject):
most recent error that happened when trying to deliver an update via webhook.
max_connections (:obj:`int`): Optional. Maximum allowed number of simultaneous HTTPS
connections to the webhook for update delivery.
allowed_updates (tuple[:obj:`str`]): Optional. Alist of update types the bot is
allowed_updates (tuple[:obj:`str`]): Optional. Atuple of update types the bot is
subscribed to. Defaults to all update types, except
:attr:`telegram.Update.chat_member`.

Expand Down
14 changes: 10 additions & 4 deletionstelegram/ext/_application.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -746,7 +746,7 @@ def run_polling(
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
allowed_updates: Optional[list[str]] = None,
allowed_updates: Optional[Sequence[str]] = None,
drop_pending_updates: Optional[bool] = None,
close_loop: bool = True,
stop_signals: ODVInput[Sequence[int]] = DEFAULT_NONE,
Expand DownExpand Up@@ -823,8 +823,11 @@ def run_polling(
:meth:`telegram.ext.ApplicationBuilder.get_updates_pool_timeout`.
drop_pending_updates (:obj:`bool`, optional): Whether to clean any pending updates on
Telegram servers before actually starting to poll. Default is :obj:`False`.
allowed_updates (list[:obj:`str`], optional): Passed to
allowed_updates (Sequence[:obj:`str`], optional): Passed to
:meth:`telegram.Bot.get_updates`.

.. versionchanged:: NEXT.VERSION
Accepts any :class:`collections.abc.Sequence` as input instead of just a list
close_loop (:obj:`bool`, optional): If :obj:`True`, the current event loop will be
closed upon shutdown. Defaults to :obj:`True`.

Expand DownExpand Up@@ -888,7 +891,7 @@ def run_webhook(
key: Optional[Union[str, Path]] = None,
bootstrap_retries: int = 0,
webhook_url: Optional[str] = None,
allowed_updates: Optional[list[str]] = None,
allowed_updates: Optional[Sequence[str]] = None,
drop_pending_updates: Optional[bool] = None,
ip_address: Optional[str] = None,
max_connections: int = 40,
Expand DownExpand Up@@ -954,8 +957,11 @@ def run_webhook(
webhook_url (:obj:`str`, optional): Explicitly specify the webhook url. Useful behind
NAT, reverse proxy, etc. Default is derived from :paramref:`listen`,
:paramref:`port`, :paramref:`url_path`, :paramref:`cert`, and :paramref:`key`.
allowed_updates (list[:obj:`str`], optional): Passed to
allowed_updates (Sequence[:obj:`str`], optional): Passed to
:meth:`telegram.Bot.set_webhook`.

.. versionchanged:: NEXT.VERSION
Accepts any :class:`collections.abc.Sequence` as input instead of just a list
drop_pending_updates (:obj:`bool`, optional): Whether to clean any pending updates on
Telegram servers before actually starting to poll. Default is :obj:`False`.
ip_address (:obj:`str`, optional): Passed to :meth:`telegram.Bot.set_webhook`.
Expand Down
23 changes: 15 additions & 8 deletionstelegram/ext/_updater.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -17,10 +17,11 @@
# You should have received a copy of the GNU Lesser Public License
# along with this program. If not, see [http://www.gnu.org/licenses/].
"""This module contains the class Updater, which tries to make creating Telegram bots intuitive."""

import asyncio
import contextlib
import ssl
from collections.abc import Coroutine
from collections.abc import Coroutine, Sequence
from pathlib import Path
from types import TracebackType
from typing import TYPE_CHECKING, Any, Callable, Optional, TypeVar, Union
Expand DownExpand Up@@ -210,7 +211,7 @@ async def start_polling(
write_timeout: ODVInput[float] = DEFAULT_NONE,
connect_timeout: ODVInput[float] = DEFAULT_NONE,
pool_timeout: ODVInput[float] = DEFAULT_NONE,
allowed_updates: Optional[list[str]] = None,
allowed_updates: Optional[Sequence[str]] = None,
drop_pending_updates: Optional[bool] = None,
error_callback: Optional[Callable[[TelegramError], None]] = None,
) -> "asyncio.Queue[object]":
Expand DownExpand Up@@ -265,8 +266,11 @@ async def start_polling(
Deprecated in favor of setting the timeout via
:meth:`telegram.ext.ApplicationBuilder.get_updates_pool_timeout` or
:paramref:`telegram.Bot.get_updates_request`.
allowed_updates (list[:obj:`str`], optional): Passed to
allowed_updates (Sequence[:obj:`str`], optional): Passed to
:meth:`telegram.Bot.get_updates`.

.. versionchanged:: NEXT.VERSION
Accepts any :class:`collections.abc.Sequence` as input instead of just a list
drop_pending_updates (:obj:`bool`, optional): Whether to clean any pending updates on
Telegram servers before actually starting to poll. Default is :obj:`False`.

Expand DownExpand Up@@ -344,7 +348,7 @@ async def _start_polling(
pool_timeout: ODVInput[float],
bootstrap_retries: int,
drop_pending_updates: Optional[bool],
allowed_updates: Optional[list[str]],
allowed_updates: Optional[Sequence[str]],
ready: asyncio.Event,
error_callback: Optional[Callable[[TelegramError], None]],
) -> None:
Expand DownExpand Up@@ -457,7 +461,7 @@ async def start_webhook(
key: Optional[Union[str, Path]] = None,
bootstrap_retries: int = 0,
webhook_url: Optional[str] = None,
allowed_updates: Optional[list[str]] = None,
allowed_updates: Optional[Sequence[str]] = None,
drop_pending_updates: Optional[bool] = None,
ip_address: Optional[str] = None,
max_connections: int = 40,
Expand DownExpand Up@@ -516,8 +520,11 @@ async def start_webhook(
Defaults to :obj:`None`.

.. versionadded :: 13.4
allowed_updates (list[:obj:`str`], optional): Passed to
allowed_updates (Sequence[:obj:`str`], optional): Passed to
:meth:`telegram.Bot.set_webhook`. Defaults to :obj:`None`.

.. versionchanged:: NEXT.VERSION
Accepts any :class:`collections.abc.Sequence` as input instead of just a list
max_connections (:obj:`int`, optional): Passed to
:meth:`telegram.Bot.set_webhook`. Defaults to ``40``.

Expand DownExpand Up@@ -624,7 +631,7 @@ async def _start_webhook(
port: int,
url_path: str,
bootstrap_retries: int,
allowed_updates: Optional[list[str]],
allowed_updates: Optional[Sequence[str]],
cert: Optional[Union[str, Path]] = None,
key: Optional[Union[str, Path]] = None,
drop_pending_updates: Optional[bool] = None,
Expand DownExpand Up@@ -767,7 +774,7 @@ async def _bootstrap(
self,
max_retries: int,
webhook_url: Optional[str],
allowed_updates: Optional[list[str]],
allowed_updates: Optional[Sequence[str]],
drop_pending_updates: Optional[bool] = None,
cert: Optional[bytes] = None,
bootstrap_interval: float = 1,
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp