mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2026-06-19 23:55:29 +00:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ade1529986 | |||
| e6d9f3d057 | |||
| 98bf378c6e | |||
| c4b413ef9e | |||
| a9dd2b1746 | |||
| cb95868c4a | |||
| 2f6c4075c8 | |||
| c53dc7dae4 | |||
| 8b3ea5ce56 |
@@ -7,6 +7,7 @@ Hey! You're PRing? Cool! Please have a look at the below checklist. It's here to
|
||||
- [ ] Added `.. versionadded:: version`, `.. versionchanged:: version` or `.. deprecated:: version` to the docstrings for user facing changes (for methods/class descriptions, arguments and attributes)
|
||||
- [ ] Created new or adapted existing unit tests
|
||||
- [ ] Added myself alphabetically to `AUTHORS.rst` (optional)
|
||||
- [ ] Added new classes & modules to the docs
|
||||
|
||||
|
||||
### If the PR contains API changes (otherwise, you can delete this passage)
|
||||
|
||||
@@ -12,7 +12,7 @@ jobs:
|
||||
- uses: dessant/lock-threads@v2.0.1
|
||||
with:
|
||||
github-token: ${{ github.token }}
|
||||
issue-lock-inactive-days: '1'
|
||||
issue-lock-inactive-days: '7'
|
||||
issue-lock-reason: ''
|
||||
pr-lock-inactive-days: '1'
|
||||
pr-lock-inactive-days: '7'
|
||||
pr-lock-reason: ''
|
||||
|
||||
+48
@@ -2,6 +2,54 @@
|
||||
Changelog
|
||||
=========
|
||||
|
||||
Version 13.10
|
||||
=============
|
||||
*Released 2022-01-03*
|
||||
|
||||
This is the technical changelog for version 13.10. More elaborate release notes can be found in the news channel `@pythontelegrambotchannel <https://t.me/pythontelegrambotchannel>`_.
|
||||
|
||||
**Major Changes:**
|
||||
|
||||
- Full Support for API 5.6 (`#2835`_)
|
||||
|
||||
**Minor Changes & Doc fixes:**
|
||||
|
||||
- Update Copyright to 2022 (`#2836`_)
|
||||
- Update Documentation of ``BotCommand`` (`#2820`_)
|
||||
|
||||
.. _`#2835`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2835
|
||||
.. _`#2836`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2836
|
||||
.. _`#2820`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2820
|
||||
|
||||
Version 13.9
|
||||
============
|
||||
*Released 2021-12-11*
|
||||
|
||||
This is the technical changelog for version 13.9. More elaborate release notes can be found in the news channel `@pythontelegrambotchannel <https://t.me/pythontelegrambotchannel>`_.
|
||||
|
||||
**Major Changes:**
|
||||
|
||||
- Full Support for Api 5.5 (`#2809`_)
|
||||
|
||||
**Minor Changes**
|
||||
|
||||
- Adjust Automated Locking of Inactive Issues (`#2775`_)
|
||||
|
||||
.. _`#2809`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2809
|
||||
.. _`#2775`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2775
|
||||
|
||||
Version 13.8.1
|
||||
==============
|
||||
*Released 2021-11-08*
|
||||
|
||||
This is the technical changelog for version 13.8.1. More elaborate release notes can be found in the news channel `@pythontelegrambotchannel <https://t.me/pythontelegrambotchannel>`_.
|
||||
|
||||
**Doc fixes:**
|
||||
|
||||
- Add ``ChatJoinRequest(Handler)`` to Docs (`#2771`_)
|
||||
|
||||
.. _`#2771`: https://github.com/python-telegram-bot/python-telegram-bot/pull/2771
|
||||
|
||||
Version 13.8
|
||||
============
|
||||
*Released 2021-11-08*
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
..
|
||||
Make user to apply any changes to this file to README_RAW.rst as well!
|
||||
Make sure to apply any changes to this file to README_RAW.rst as well!
|
||||
|
||||
.. image:: https://github.com/python-telegram-bot/logos/blob/master/logo-text/png/ptb-logo-text_768.png?raw=true
|
||||
:align: center
|
||||
@@ -20,7 +20,7 @@ We have a vibrant community of developers helping each other in our `Telegram gr
|
||||
:target: https://pypi.org/project/python-telegram-bot/
|
||||
:alt: Supported Python versions
|
||||
|
||||
.. image:: https://img.shields.io/badge/Bot%20API-5.4-blue?logo=telegram
|
||||
.. image:: https://img.shields.io/badge/Bot%20API-5.6-blue?logo=telegram
|
||||
:target: https://core.telegram.org/bots/api-changelog
|
||||
:alt: Supported Bot API versions
|
||||
|
||||
@@ -111,7 +111,7 @@ Installing both ``python-telegram-bot`` and ``python-telegram-bot-raw`` in conju
|
||||
Telegram API support
|
||||
====================
|
||||
|
||||
All types and methods of the Telegram Bot API **5.4** are supported.
|
||||
All types and methods of the Telegram Bot API **5.6** are supported.
|
||||
|
||||
==========
|
||||
Installing
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
..
|
||||
Make user to apply any changes to this file to README.rst as well!
|
||||
Make sure to apply any changes to this file to README.rst as well!
|
||||
|
||||
.. image:: https://github.com/python-telegram-bot/logos/blob/master/logo-text/png/ptb-raw-logo-text_768.png?raw=true
|
||||
:align: center
|
||||
@@ -20,7 +20,7 @@ We have a vibrant community of developers helping each other in our `Telegram gr
|
||||
:target: https://pypi.org/project/python-telegram-bot-raw/
|
||||
:alt: Supported Python versions
|
||||
|
||||
.. image:: https://img.shields.io/badge/Bot%20API-5.4-blue?logo=telegram
|
||||
.. image:: https://img.shields.io/badge/Bot%20API-5.6-blue?logo=telegram
|
||||
:target: https://core.telegram.org/bots/api-changelog
|
||||
:alt: Supported Bot API versions
|
||||
|
||||
@@ -105,7 +105,7 @@ Installing both ``python-telegram-bot`` and ``python-telegram-bot-raw`` in conju
|
||||
Telegram API support
|
||||
====================
|
||||
|
||||
All types and methods of the Telegram Bot API **5.4** are supported.
|
||||
All types and methods of the Telegram Bot API **5.6** are supported.
|
||||
|
||||
==========
|
||||
Installing
|
||||
|
||||
+2
-2
@@ -60,9 +60,9 @@ author = u'Leandro Toledo'
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '13.8' # telegram.__version__[:3]
|
||||
version = '13.10' # telegram.__version__[:3]
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '13.8' # telegram.__version__
|
||||
release = '13.10' # telegram.__version__
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
:github_url: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/telegram/chatjoinrequest.py
|
||||
|
||||
telegram.ChatJoinRequest
|
||||
========================
|
||||
|
||||
.. autoclass:: telegram.ChatJoinRequest
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -0,0 +1,8 @@
|
||||
:github_url: https://github.com/python-telegram-bot/python-telegram-bot/blob/master/telegram/ext/chatjoinrequesthandler.py
|
||||
|
||||
telegram.ext.ChatJoinRequestHandler
|
||||
===================================
|
||||
|
||||
.. autoclass:: telegram.ext.ChatJoinRequestHandler
|
||||
:members:
|
||||
:show-inheritance:
|
||||
@@ -22,8 +22,9 @@ Handlers
|
||||
|
||||
telegram.ext.handler
|
||||
telegram.ext.callbackqueryhandler
|
||||
telegram.ext.choseninlineresulthandler
|
||||
telegram.ext.chatjoinrequesthandler
|
||||
telegram.ext.chatmemberhandler
|
||||
telegram.ext.choseninlineresulthandler
|
||||
telegram.ext.commandhandler
|
||||
telegram.ext.conversationhandler
|
||||
telegram.ext.inlinequeryhandler
|
||||
|
||||
@@ -19,6 +19,7 @@ telegram package
|
||||
telegram.chat
|
||||
telegram.chataction
|
||||
telegram.chatinvitelink
|
||||
telegram.chatjoinrequest
|
||||
telegram.chatlocation
|
||||
telegram.chatmember
|
||||
telegram.chatmemberowner
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# !/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
+230
-6
@@ -2,7 +2,7 @@
|
||||
# pylint: disable=E0611,E0213,E1102,E1101,R0913,R0904
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -306,10 +306,14 @@ class Bot(TelegramObject):
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
api_kwargs: JSONDict = None,
|
||||
protect_content: bool = None,
|
||||
) -> Union[bool, Message]:
|
||||
if reply_to_message_id is not None:
|
||||
data['reply_to_message_id'] = reply_to_message_id
|
||||
|
||||
if protect_content:
|
||||
data['protect_content'] = protect_content
|
||||
|
||||
# We don't check if (DEFAULT_)None here, so that _put is able to insert the defaults
|
||||
# correctly, if necessary
|
||||
data['disable_notification'] = disable_notification
|
||||
@@ -463,6 +467,7 @@ class Bot(TelegramObject):
|
||||
api_kwargs: JSONDict = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
|
||||
protect_content: bool = None,
|
||||
) -> Message:
|
||||
"""Use this method to send text messages.
|
||||
|
||||
@@ -480,6 +485,10 @@ class Bot(TelegramObject):
|
||||
this message.
|
||||
disable_notification (:obj:`bool`, optional): Sends the message silently. Users will
|
||||
receive a notification with no sound.
|
||||
protect_content (:obj:`bool`, optional): Protects the contents of sent messages from
|
||||
forwarding and saving.
|
||||
|
||||
.. versionadded:: 13.10
|
||||
reply_to_message_id (:obj:`int`, optional): If the message is a reply, ID of the
|
||||
original message.
|
||||
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
||||
@@ -519,6 +528,7 @@ class Bot(TelegramObject):
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
timeout=timeout,
|
||||
api_kwargs=api_kwargs,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
@log
|
||||
@@ -576,9 +586,18 @@ class Bot(TelegramObject):
|
||||
disable_notification: DVInput[bool] = DEFAULT_NONE,
|
||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
api_kwargs: JSONDict = None,
|
||||
protect_content: bool = None,
|
||||
) -> Message:
|
||||
"""Use this method to forward messages of any kind. Service messages can't be forwarded.
|
||||
|
||||
Note:
|
||||
Since the release of Bot API 5.5 it can be impossible to forward messages from
|
||||
some chats. Use the attributes :attr:`telegram.Message.has_protected_content` and
|
||||
:attr:`telegram.Chat.has_protected_content` to check this.
|
||||
|
||||
As a workaround, it is still possible to use :meth:`copy_message`. However, this
|
||||
behaviour is undocumented and might be changed by Telegram.
|
||||
|
||||
Args:
|
||||
chat_id (:obj:`int` | :obj:`str`): Unique identifier for the target chat or username
|
||||
of the target channel (in the format ``@channelusername``).
|
||||
@@ -587,6 +606,11 @@ class Bot(TelegramObject):
|
||||
message_id (:obj:`int`): Message identifier in the chat specified in from_chat_id.
|
||||
disable_notification (:obj:`bool`, optional): Sends the message silently. Users will
|
||||
receive a notification with no sound.
|
||||
protect_content (:obj:`bool`, optional): Protects the contents of the sent message from
|
||||
forwarding and saving.
|
||||
|
||||
.. versionadded:: 13.10
|
||||
|
||||
timeout (:obj:`int` | :obj:`float`, optional): If this value is specified, use it as
|
||||
the read timeout from the server (instead of the one specified during creation of
|
||||
the connection pool).
|
||||
@@ -608,13 +632,13 @@ class Bot(TelegramObject):
|
||||
data['from_chat_id'] = from_chat_id
|
||||
if message_id:
|
||||
data['message_id'] = message_id
|
||||
|
||||
return self._message( # type: ignore[return-value]
|
||||
'forwardMessage',
|
||||
data,
|
||||
disable_notification=disable_notification,
|
||||
timeout=timeout,
|
||||
api_kwargs=api_kwargs,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
@log
|
||||
@@ -632,6 +656,7 @@ class Bot(TelegramObject):
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
|
||||
filename: str = None,
|
||||
protect_content: bool = None,
|
||||
) -> Message:
|
||||
"""Use this method to send photos.
|
||||
|
||||
@@ -666,6 +691,11 @@ class Bot(TelegramObject):
|
||||
:attr:`parse_mode`.
|
||||
disable_notification (:obj:`bool`, optional): Sends the message silently. Users will
|
||||
receive a notification with no sound.
|
||||
protect_content (:obj:`bool`, optional): Protects the contents of the sent message from
|
||||
forwarding and saving.
|
||||
|
||||
.. versionadded:: 13.10
|
||||
|
||||
reply_to_message_id (:obj:`int`, optional): If the message is a reply, ID of the
|
||||
original message.
|
||||
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
||||
@@ -705,6 +735,7 @@ class Bot(TelegramObject):
|
||||
reply_markup=reply_markup,
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
api_kwargs=api_kwargs,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
@log
|
||||
@@ -726,6 +757,7 @@ class Bot(TelegramObject):
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
|
||||
filename: str = None,
|
||||
protect_content: bool = None,
|
||||
) -> Message:
|
||||
"""
|
||||
Use this method to send audio files, if you want Telegram clients to display them in the
|
||||
@@ -770,6 +802,11 @@ class Bot(TelegramObject):
|
||||
title (:obj:`str`, optional): Track name.
|
||||
disable_notification (:obj:`bool`, optional): Sends the message silently. Users will
|
||||
receive a notification with no sound.
|
||||
protect_content (:obj:`bool`, optional): Protects the contents of the sent message from
|
||||
forwarding and saving.
|
||||
|
||||
.. versionadded:: 13.10
|
||||
|
||||
reply_to_message_id (:obj:`int`, optional): If the message is a reply, ID of the
|
||||
original message.
|
||||
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
||||
@@ -826,6 +863,7 @@ class Bot(TelegramObject):
|
||||
reply_markup=reply_markup,
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
api_kwargs=api_kwargs,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
@log
|
||||
@@ -845,6 +883,7 @@ class Bot(TelegramObject):
|
||||
disable_content_type_detection: bool = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
|
||||
protect_content: bool = None,
|
||||
) -> Message:
|
||||
"""
|
||||
Use this method to send general files.
|
||||
@@ -883,6 +922,11 @@ class Bot(TelegramObject):
|
||||
:attr:`parse_mode`.
|
||||
disable_notification (:obj:`bool`, optional): Sends the message silently. Users will
|
||||
receive a notification with no sound.
|
||||
protect_content (:obj:`bool`, optional): Protects the contents of the sent message from
|
||||
forwarding and saving.
|
||||
|
||||
.. versionadded:: 13.10
|
||||
|
||||
reply_to_message_id (:obj:`int`, optional): If the message is a reply, ID of the
|
||||
original message.
|
||||
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
||||
@@ -935,6 +979,7 @@ class Bot(TelegramObject):
|
||||
reply_markup=reply_markup,
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
api_kwargs=api_kwargs,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
@log
|
||||
@@ -948,6 +993,7 @@ class Bot(TelegramObject):
|
||||
timeout: DVInput[float] = DEFAULT_20,
|
||||
api_kwargs: JSONDict = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
protect_content: bool = None,
|
||||
) -> Message:
|
||||
"""
|
||||
Use this method to send static .WEBP or animated .TGS stickers.
|
||||
@@ -970,6 +1016,11 @@ class Bot(TelegramObject):
|
||||
Accept :obj:`bytes` as input.
|
||||
disable_notification (:obj:`bool`, optional): Sends the message silently. Users will
|
||||
receive a notification with no sound.
|
||||
protect_content (:obj:`bool`, optional): Protects the contents of the sent message from
|
||||
forwarding and saving.
|
||||
|
||||
.. versionadded:: 13.10
|
||||
|
||||
reply_to_message_id (:obj:`int`, optional): If the message is a reply, ID of the
|
||||
original message.
|
||||
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
||||
@@ -999,6 +1050,7 @@ class Bot(TelegramObject):
|
||||
reply_markup=reply_markup,
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
api_kwargs=api_kwargs,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
@log
|
||||
@@ -1021,6 +1073,7 @@ class Bot(TelegramObject):
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
|
||||
filename: str = None,
|
||||
protect_content: bool = None,
|
||||
) -> Message:
|
||||
"""
|
||||
Use this method to send video files, Telegram clients support mp4 videos
|
||||
@@ -1068,6 +1121,11 @@ class Bot(TelegramObject):
|
||||
suitable for streaming.
|
||||
disable_notification (:obj:`bool`, optional): Sends the message silently. Users will
|
||||
receive a notification with no sound.
|
||||
protect_content (:obj:`bool`, optional): Protects the contents of the sent message from
|
||||
forwarding and saving.
|
||||
|
||||
.. versionadded:: 13.10
|
||||
|
||||
reply_to_message_id (:obj:`int`, optional): If the message is a reply, ID of the
|
||||
original message.
|
||||
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
||||
@@ -1125,6 +1183,7 @@ class Bot(TelegramObject):
|
||||
reply_markup=reply_markup,
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
api_kwargs=api_kwargs,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
@log
|
||||
@@ -1142,6 +1201,7 @@ class Bot(TelegramObject):
|
||||
api_kwargs: JSONDict = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
filename: str = None,
|
||||
protect_content: bool = None,
|
||||
) -> Message:
|
||||
"""
|
||||
As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long.
|
||||
@@ -1176,6 +1236,11 @@ class Bot(TelegramObject):
|
||||
message.
|
||||
disable_notification (:obj:`bool`, optional): Sends the message silently. Users will
|
||||
receive a notification with no sound.
|
||||
protect_content (:obj:`bool`, optional): Protects the contents of the sent message from
|
||||
forwarding and saving.
|
||||
|
||||
.. versionadded:: 13.10
|
||||
|
||||
reply_to_message_id (:obj:`int`, optional): If the message is a reply, ID of the
|
||||
original message.
|
||||
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
||||
@@ -1224,6 +1289,7 @@ class Bot(TelegramObject):
|
||||
reply_markup=reply_markup,
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
api_kwargs=api_kwargs,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
@log
|
||||
@@ -1245,6 +1311,7 @@ class Bot(TelegramObject):
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
|
||||
filename: str = None,
|
||||
protect_content: bool = None,
|
||||
) -> Message:
|
||||
"""
|
||||
Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound).
|
||||
@@ -1295,6 +1362,11 @@ class Bot(TelegramObject):
|
||||
:attr:`parse_mode`.
|
||||
disable_notification (:obj:`bool`, optional): Sends the message silently. Users will
|
||||
receive a notification with no sound.
|
||||
protect_content (:obj:`bool`, optional): Protects the contents of the sent message from
|
||||
forwarding and saving.
|
||||
|
||||
.. versionadded:: 13.10
|
||||
|
||||
reply_to_message_id (:obj:`int`, optional): If the message is a reply, ID of the
|
||||
original message.
|
||||
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
||||
@@ -1341,6 +1413,7 @@ class Bot(TelegramObject):
|
||||
reply_markup=reply_markup,
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
api_kwargs=api_kwargs,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
@log
|
||||
@@ -1359,6 +1432,7 @@ class Bot(TelegramObject):
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
|
||||
filename: str = None,
|
||||
protect_content: bool = None,
|
||||
) -> Message:
|
||||
"""
|
||||
Use this method to send audio files, if you want Telegram clients to display the file
|
||||
@@ -1398,6 +1472,11 @@ class Bot(TelegramObject):
|
||||
duration (:obj:`int`, optional): Duration of the voice message in seconds.
|
||||
disable_notification (:obj:`bool`, optional): Sends the message silently. Users will
|
||||
receive a notification with no sound.
|
||||
protect_content (:obj:`bool`, optional): Protects the contents of the sent message from
|
||||
forwarding and saving.
|
||||
|
||||
.. versionadded:: 13.10
|
||||
|
||||
reply_to_message_id (:obj:`int`, optional): If the message is a reply, ID of the
|
||||
original message.
|
||||
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
||||
@@ -1439,6 +1518,7 @@ class Bot(TelegramObject):
|
||||
reply_markup=reply_markup,
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
api_kwargs=api_kwargs,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
@log
|
||||
@@ -1453,6 +1533,7 @@ class Bot(TelegramObject):
|
||||
timeout: DVInput[float] = DEFAULT_20,
|
||||
api_kwargs: JSONDict = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
protect_content: bool = None,
|
||||
) -> List[Message]:
|
||||
"""Use this method to send a group of photos or videos as an album.
|
||||
|
||||
@@ -1464,6 +1545,11 @@ class Bot(TelegramObject):
|
||||
describing messages to be sent, must include 2–10 items.
|
||||
disable_notification (:obj:`bool`, optional): Sends the message silently. Users will
|
||||
receive a notification with no sound.
|
||||
protect_content (:obj:`bool`, optional): Protects the contents of the sent message from
|
||||
forwarding and saving.
|
||||
|
||||
.. versionadded:: 13.10
|
||||
|
||||
reply_to_message_id (:obj:`int`, optional): If the message is a reply, ID of the
|
||||
original message.
|
||||
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
||||
@@ -1495,6 +1581,9 @@ class Bot(TelegramObject):
|
||||
if reply_to_message_id:
|
||||
data['reply_to_message_id'] = reply_to_message_id
|
||||
|
||||
if protect_content:
|
||||
data['protect_content'] = protect_content
|
||||
|
||||
result = self._post('sendMediaGroup', data, timeout=timeout, api_kwargs=api_kwargs)
|
||||
|
||||
return Message.de_list(result, self) # type: ignore
|
||||
@@ -1516,6 +1605,7 @@ class Bot(TelegramObject):
|
||||
heading: int = None,
|
||||
proximity_alert_radius: int = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
protect_content: bool = None,
|
||||
) -> Message:
|
||||
"""Use this method to send point on the map.
|
||||
|
||||
@@ -1539,6 +1629,11 @@ class Bot(TelegramObject):
|
||||
between 1 and 100000 if specified.
|
||||
disable_notification (:obj:`bool`, optional): Sends the message silently. Users will
|
||||
receive a notification with no sound.
|
||||
protect_content (:obj:`bool`, optional): Protects the contents of the sent message from
|
||||
forwarding and saving.
|
||||
|
||||
.. versionadded:: 13.10
|
||||
|
||||
reply_to_message_id (:obj:`int`, optional): If the message is a reply, ID of the
|
||||
original message.
|
||||
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
||||
@@ -1593,6 +1688,7 @@ class Bot(TelegramObject):
|
||||
reply_markup=reply_markup,
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
api_kwargs=api_kwargs,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
@log
|
||||
@@ -1753,6 +1849,7 @@ class Bot(TelegramObject):
|
||||
google_place_id: str = None,
|
||||
google_place_type: str = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
protect_content: bool = None,
|
||||
) -> Message:
|
||||
"""Use this method to send information about a venue.
|
||||
|
||||
@@ -1782,6 +1879,11 @@ class Bot(TelegramObject):
|
||||
venue (:class:`telegram.Venue`, optional): The venue to send.
|
||||
disable_notification (:obj:`bool`, optional): Sends the message silently. Users will
|
||||
receive a notification with no sound.
|
||||
protect_content (:obj:`bool`, optional): Protects the contents of the sent message from
|
||||
forwarding and saving.
|
||||
|
||||
.. versionadded:: 13.10
|
||||
|
||||
reply_to_message_id (:obj:`int`, optional): If the message is a reply, ID of the
|
||||
original message.
|
||||
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
||||
@@ -1844,6 +1946,7 @@ class Bot(TelegramObject):
|
||||
reply_markup=reply_markup,
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
api_kwargs=api_kwargs,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
@log
|
||||
@@ -1861,6 +1964,7 @@ class Bot(TelegramObject):
|
||||
vcard: str = None,
|
||||
api_kwargs: JSONDict = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
protect_content: bool = None,
|
||||
) -> Message:
|
||||
"""Use this method to send phone contacts.
|
||||
|
||||
@@ -1879,6 +1983,11 @@ class Bot(TelegramObject):
|
||||
contact (:class:`telegram.Contact`, optional): The contact to send.
|
||||
disable_notification (:obj:`bool`, optional): Sends the message silently. Users will
|
||||
receive a notification with no sound.
|
||||
protect_content (:obj:`bool`, optional): Protects the contents of the sent message from
|
||||
forwarding and saving.
|
||||
|
||||
.. versionadded:: 13.10
|
||||
|
||||
reply_to_message_id (:obj:`int`, optional): If the message is a reply, ID of the
|
||||
original message.
|
||||
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
||||
@@ -1930,6 +2039,7 @@ class Bot(TelegramObject):
|
||||
reply_markup=reply_markup,
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
api_kwargs=api_kwargs,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
@log
|
||||
@@ -1943,6 +2053,7 @@ class Bot(TelegramObject):
|
||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
api_kwargs: JSONDict = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
protect_content: bool = None,
|
||||
) -> Message:
|
||||
"""Use this method to send a game.
|
||||
|
||||
@@ -1952,6 +2063,11 @@ class Bot(TelegramObject):
|
||||
for the game. Set up your games via `@BotFather <https://t.me/BotFather>`_.
|
||||
disable_notification (:obj:`bool`, optional): Sends the message silently. Users will
|
||||
receive a notification with no sound.
|
||||
protect_content (:obj:`bool`, optional): Protects the contents of the sent message from
|
||||
forwarding and saving.
|
||||
|
||||
.. versionadded:: 13.10
|
||||
|
||||
reply_to_message_id (:obj:`int`, optional): If the message is a reply, ID of the
|
||||
original message.
|
||||
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
||||
@@ -1983,6 +2099,7 @@ class Bot(TelegramObject):
|
||||
reply_markup=reply_markup,
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
api_kwargs=api_kwargs,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
@log
|
||||
@@ -2408,6 +2525,45 @@ class Bot(TelegramObject):
|
||||
|
||||
return result # type: ignore[return-value]
|
||||
|
||||
@log
|
||||
def ban_chat_sender_chat(
|
||||
self,
|
||||
chat_id: Union[str, int],
|
||||
sender_chat_id: int,
|
||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
api_kwargs: JSONDict = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Use this method to ban a channel chat in a supergroup or a channel. Until the chat is
|
||||
unbanned, the owner of the banned chat won't be able to send messages on behalf of **any of
|
||||
their channels**. The bot must be an administrator in the supergroup or channel for this
|
||||
to work and must have the appropriate administrator rights.
|
||||
|
||||
.. versionadded:: 13.9
|
||||
|
||||
Args:
|
||||
chat_id (:obj:`int` | :obj:`str`): Unique identifier for the target group or username
|
||||
of the target supergroup or channel (in the format ``@channelusername``).
|
||||
sender_chat_id (:obj:`int`): Unique identifier of the target sender chat.
|
||||
timeout (:obj:`int` | :obj:`float`, optional): If this value is specified, use it as
|
||||
the read timeout from the server (instead of the one specified during creation of
|
||||
the connection pool).
|
||||
api_kwargs (:obj:`dict`, optional): Arbitrary keyword arguments to be passed to the
|
||||
Telegram API.
|
||||
|
||||
Returns:
|
||||
:obj:`bool`: On success, :obj:`True` is returned.
|
||||
|
||||
Raises:
|
||||
:class:`telegram.error.TelegramError`
|
||||
|
||||
"""
|
||||
data: JSONDict = {'chat_id': chat_id, 'sender_chat_id': sender_chat_id}
|
||||
|
||||
result = self._post('banChatSenderChat', data, timeout=timeout, api_kwargs=api_kwargs)
|
||||
|
||||
return result # type: ignore[return-value]
|
||||
|
||||
@log
|
||||
def unban_chat_member(
|
||||
self,
|
||||
@@ -2437,7 +2593,7 @@ class Bot(TelegramObject):
|
||||
Telegram API.
|
||||
|
||||
Returns:
|
||||
:obj:`bool` On success, :obj:`True` is returned.
|
||||
:obj:`bool`: On success, :obj:`True` is returned.
|
||||
|
||||
Raises:
|
||||
:class:`telegram.error.TelegramError`
|
||||
@@ -2452,6 +2608,43 @@ class Bot(TelegramObject):
|
||||
|
||||
return result # type: ignore[return-value]
|
||||
|
||||
@log
|
||||
def unban_chat_sender_chat(
|
||||
self,
|
||||
chat_id: Union[str, int],
|
||||
sender_chat_id: int,
|
||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
api_kwargs: JSONDict = None,
|
||||
) -> bool:
|
||||
"""Use this method to unban a previously banned channel in a supergroup or channel.
|
||||
The bot must be an administrator for this to work and must have the
|
||||
appropriate administrator rights.
|
||||
|
||||
.. versionadded:: 13.9
|
||||
|
||||
Args:
|
||||
chat_id (:obj:`int` | :obj:`str`): Unique identifier for the target chat or username
|
||||
of the target supergroup or channel (in the format ``@channelusername``).
|
||||
sender_chat_id (:obj:`int`): Unique identifier of the target sender chat.
|
||||
timeout (:obj:`int` | :obj:`float`, optional): If this value is specified, use it as
|
||||
the read timeout from the server (instead of the one specified during creation of
|
||||
the connection pool).
|
||||
api_kwargs (:obj:`dict`, optional): Arbitrary keyword arguments to be passed to the
|
||||
Telegram API.
|
||||
|
||||
Returns:
|
||||
:obj:`bool`: On success, :obj:`True` is returned.
|
||||
|
||||
Raises:
|
||||
:class:`telegram.error.TelegramError`
|
||||
|
||||
"""
|
||||
data: JSONDict = {'chat_id': chat_id, 'sender_chat_id': sender_chat_id}
|
||||
|
||||
result = self._post('unbanChatSenderChat', data, timeout=timeout, api_kwargs=api_kwargs)
|
||||
|
||||
return result # type: ignore[return-value]
|
||||
|
||||
@log
|
||||
def answer_callback_query(
|
||||
self,
|
||||
@@ -3421,6 +3614,7 @@ class Bot(TelegramObject):
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
max_tip_amount: int = None,
|
||||
suggested_tip_amounts: List[int] = None,
|
||||
protect_content: bool = None,
|
||||
) -> Message:
|
||||
"""Use this method to send invoices.
|
||||
|
||||
@@ -3495,6 +3689,11 @@ class Bot(TelegramObject):
|
||||
the shipping method.
|
||||
disable_notification (:obj:`bool`, optional): Sends the message silently. Users will
|
||||
receive a notification with no sound.
|
||||
protect_content (:obj:`bool`, optional): Protects the contents of the sent message from
|
||||
forwarding and saving.
|
||||
|
||||
.. versionadded:: 13.10
|
||||
|
||||
reply_to_message_id (:obj:`int`, optional): If the message is a reply, ID of the
|
||||
original message.
|
||||
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
||||
@@ -3567,6 +3766,7 @@ class Bot(TelegramObject):
|
||||
reply_markup=reply_markup,
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
api_kwargs=api_kwargs,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
@log
|
||||
@@ -4937,6 +5137,7 @@ class Bot(TelegramObject):
|
||||
api_kwargs: JSONDict = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
explanation_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
|
||||
protect_content: bool = None,
|
||||
) -> Message:
|
||||
"""
|
||||
Use this method to send a native poll.
|
||||
@@ -4975,6 +5176,11 @@ class Bot(TelegramObject):
|
||||
immediately closed. This can be useful for poll preview.
|
||||
disable_notification (:obj:`bool`, optional): Sends the message silently. Users will
|
||||
receive a notification with no sound.
|
||||
protect_content (:obj:`bool`, optional): Protects the contents of the sent message from
|
||||
forwarding and saving.
|
||||
|
||||
.. versionadded:: 13.10
|
||||
|
||||
reply_to_message_id (:obj:`int`, optional): If the message is a reply, ID of the
|
||||
original message.
|
||||
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
||||
@@ -5034,6 +5240,7 @@ class Bot(TelegramObject):
|
||||
reply_markup=reply_markup,
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
api_kwargs=api_kwargs,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
@log
|
||||
@@ -5093,6 +5300,7 @@ class Bot(TelegramObject):
|
||||
emoji: str = None,
|
||||
api_kwargs: JSONDict = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
protect_content: bool = None,
|
||||
) -> Message:
|
||||
"""
|
||||
Use this method to send an animated emoji that will display a random value.
|
||||
@@ -5109,6 +5317,11 @@ class Bot(TelegramObject):
|
||||
Added the "🎳" emoji.
|
||||
disable_notification (:obj:`bool`, optional): Sends the message silently. Users will
|
||||
receive a notification with no sound.
|
||||
protect_content (:obj:`bool`, optional): Protects the contents of the sent message from
|
||||
forwarding and saving.
|
||||
|
||||
.. versionadded:: 13.10
|
||||
|
||||
reply_to_message_id (:obj:`int`, optional): If the message is a reply, ID of the
|
||||
original message.
|
||||
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
||||
@@ -5129,9 +5342,7 @@ class Bot(TelegramObject):
|
||||
:class:`telegram.error.TelegramError`
|
||||
|
||||
"""
|
||||
data: JSONDict = {
|
||||
'chat_id': chat_id,
|
||||
}
|
||||
data: JSONDict = {'chat_id': chat_id}
|
||||
|
||||
if emoji:
|
||||
data['emoji'] = emoji
|
||||
@@ -5145,6 +5356,7 @@ class Bot(TelegramObject):
|
||||
reply_markup=reply_markup,
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
api_kwargs=api_kwargs,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
@log
|
||||
@@ -5370,6 +5582,7 @@ class Bot(TelegramObject):
|
||||
reply_markup: ReplyMarkup = None,
|
||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
api_kwargs: JSONDict = None,
|
||||
protect_content: bool = None,
|
||||
) -> MessageId:
|
||||
"""
|
||||
Use this method to copy messages of any kind. Service messages and invoice messages can't
|
||||
@@ -5391,6 +5604,11 @@ class Bot(TelegramObject):
|
||||
parse_mode
|
||||
disable_notification (:obj:`bool`, optional): Sends the message silently. Users will
|
||||
receive a notification with no sound.
|
||||
protect_content (:obj:`bool`, optional): Protects the contents of the sent message from
|
||||
forwarding and saving.
|
||||
|
||||
.. versionadded:: 13.10
|
||||
|
||||
reply_to_message_id (:obj:`int`, optional): If the message is a reply, ID of the
|
||||
original message.
|
||||
allow_sending_without_reply (:obj:`bool`, optional): Pass :obj:`True`, if the message
|
||||
@@ -5424,6 +5642,8 @@ class Bot(TelegramObject):
|
||||
data['caption_entities'] = caption_entities
|
||||
if reply_to_message_id:
|
||||
data['reply_to_message_id'] = reply_to_message_id
|
||||
if protect_content:
|
||||
data['protect_content'] = protect_content
|
||||
if reply_markup:
|
||||
if isinstance(reply_markup, ReplyMarkup):
|
||||
# We need to_json() instead of to_dict() here, because reply_markups may be
|
||||
@@ -5499,10 +5719,14 @@ class Bot(TelegramObject):
|
||||
"""Alias for :meth:`get_file`"""
|
||||
banChatMember = ban_chat_member
|
||||
"""Alias for :meth:`ban_chat_member`"""
|
||||
banChatSenderChat = ban_chat_sender_chat
|
||||
"""Alias for :meth:`ban_chat_sender_chat`"""
|
||||
kickChatMember = kick_chat_member
|
||||
"""Alias for :meth:`kick_chat_member`"""
|
||||
unbanChatMember = unban_chat_member
|
||||
"""Alias for :meth:`unban_chat_member`"""
|
||||
unbanChatSenderChat = unban_chat_sender_chat
|
||||
"""Alias for :meth:`unban_chat_sender_chat`"""
|
||||
answerCallbackQuery = answer_callback_query
|
||||
"""Alias for :meth:`answer_callback_query`"""
|
||||
editMessageText = edit_message_text
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# pylint: disable=R0903
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -33,7 +33,7 @@ class BotCommand(TelegramObject):
|
||||
Args:
|
||||
command (:obj:`str`): Text of the command, 1-32 characters. Can contain only lowercase
|
||||
English letters, digits and underscores.
|
||||
description (:obj:`str`): Description of the command, 3-256 characters.
|
||||
description (:obj:`str`): Description of the command, 1-256 characters.
|
||||
|
||||
Attributes:
|
||||
command (:obj:`str`): Text of the command.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -620,6 +620,7 @@ class CallbackQuery(TelegramObject):
|
||||
reply_markup: ReplyMarkup = None,
|
||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
api_kwargs: JSONDict = None,
|
||||
protect_content: bool = None,
|
||||
) -> 'MessageId':
|
||||
"""Shortcut for::
|
||||
|
||||
@@ -648,6 +649,7 @@ class CallbackQuery(TelegramObject):
|
||||
reply_markup=reply_markup,
|
||||
timeout=timeout,
|
||||
api_kwargs=api_kwargs,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
MAX_ANSWER_TEXT_LENGTH: ClassVar[int] = constants.MAX_ANSWER_CALLBACK_QUERY_TEXT_LENGTH
|
||||
|
||||
+155
-1
@@ -2,7 +2,7 @@
|
||||
# pylint: disable=W0622
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -81,6 +81,11 @@ class Chat(TelegramObject):
|
||||
Returned only in :meth:`telegram.Bot.get_chat`.
|
||||
bio (:obj:`str`, optional): Bio of the other party in a private chat. Returned only in
|
||||
:meth:`telegram.Bot.get_chat`.
|
||||
has_private_forwards (:obj:`bool`, optional): :obj:`True`, if privacy settings of the other
|
||||
party in the private chat allows to use ``tg://user?id=<user_id>`` links only in chats
|
||||
with the user. Returned only in :meth:`telegram.Bot.get_chat`.
|
||||
|
||||
.. versionadded:: 13.9
|
||||
description (:obj:`str`, optional): Description, for groups, supergroups and channel chats.
|
||||
Returned only in :meth:`telegram.Bot.get_chat`.
|
||||
invite_link (:obj:`str`, optional): Primary invite link, for groups, supergroups and
|
||||
@@ -97,6 +102,10 @@ class Chat(TelegramObject):
|
||||
:meth:`telegram.Bot.get_chat`.
|
||||
|
||||
.. versionadded:: 13.4
|
||||
has_protected_content (:obj:`bool`, optional): :obj:`True`, if messages from the chat can't
|
||||
be forwarded to other chats. Returned only in :meth:`telegram.Bot.get_chat`.
|
||||
|
||||
.. versionadded:: 13.9
|
||||
bot (:class:`telegram.Bot`, optional): The Bot to use for instance methods.
|
||||
sticker_set_name (:obj:`str`, optional): For supergroups, name of group sticker set.
|
||||
Returned only in :meth:`telegram.Bot.get_chat`.
|
||||
@@ -119,6 +128,11 @@ class Chat(TelegramObject):
|
||||
photo (:class:`telegram.ChatPhoto`): Optional. Chat photo.
|
||||
bio (:obj:`str`): Optional. Bio of the other party in a private chat. Returned only in
|
||||
:meth:`telegram.Bot.get_chat`.
|
||||
has_private_forwards (:obj:`bool`): Optional. :obj:`True`, if privacy settings of the other
|
||||
party in the private chat allows to use ``tg://user?id=<user_id>`` links only in chats
|
||||
with the user.
|
||||
|
||||
.. versionadded:: 13.9
|
||||
description (:obj:`str`): Optional. Description, for groups, supergroups and channel chats.
|
||||
invite_link (:obj:`str`): Optional. Primary invite link, for groups, supergroups and
|
||||
channel. Returned only in :meth:`telegram.Bot.get_chat`.
|
||||
@@ -134,6 +148,10 @@ class Chat(TelegramObject):
|
||||
:meth:`telegram.Bot.get_chat`.
|
||||
|
||||
.. versionadded:: 13.4
|
||||
has_protected_content (:obj:`bool`): Optional. :obj:`True`, if messages from the chat can't
|
||||
be forwarded to other chats.
|
||||
|
||||
.. versionadded:: 13.9
|
||||
sticker_set_name (:obj:`str`): Optional. For supergroups, name of Group sticker set.
|
||||
can_set_sticker_set (:obj:`bool`): Optional. :obj:`True`, if the bot can change group the
|
||||
sticker set.
|
||||
@@ -166,6 +184,8 @@ class Chat(TelegramObject):
|
||||
'linked_chat_id',
|
||||
'all_members_are_administrators',
|
||||
'message_auto_delete_time',
|
||||
'has_protected_content',
|
||||
'has_private_forwards',
|
||||
'_id_attrs',
|
||||
)
|
||||
|
||||
@@ -204,6 +224,8 @@ class Chat(TelegramObject):
|
||||
linked_chat_id: int = None,
|
||||
location: ChatLocation = None,
|
||||
message_auto_delete_time: int = None,
|
||||
has_private_forwards: bool = None,
|
||||
has_protected_content: bool = None,
|
||||
**_kwargs: Any,
|
||||
):
|
||||
# Required
|
||||
@@ -218,6 +240,7 @@ class Chat(TelegramObject):
|
||||
self.all_members_are_administrators = _kwargs.get('all_members_are_administrators')
|
||||
self.photo = photo
|
||||
self.bio = bio
|
||||
self.has_private_forwards = has_private_forwards
|
||||
self.description = description
|
||||
self.invite_link = invite_link
|
||||
self.pinned_message = pinned_message
|
||||
@@ -226,6 +249,7 @@ class Chat(TelegramObject):
|
||||
self.message_auto_delete_time = (
|
||||
int(message_auto_delete_time) if message_auto_delete_time is not None else None
|
||||
)
|
||||
self.has_protected_content = has_protected_content
|
||||
self.sticker_set_name = sticker_set_name
|
||||
self.can_set_sticker_set = can_set_sticker_set
|
||||
self.linked_chat_id = linked_chat_id
|
||||
@@ -433,6 +457,98 @@ class Chat(TelegramObject):
|
||||
revoke_messages=revoke_messages,
|
||||
)
|
||||
|
||||
def ban_sender_chat(
|
||||
self,
|
||||
sender_chat_id: int,
|
||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
api_kwargs: JSONDict = None,
|
||||
) -> bool:
|
||||
"""Shortcut for::
|
||||
|
||||
bot.ban_chat_sender_chat(chat_id=update.effective_chat.id, *args, **kwargs)
|
||||
|
||||
For the documentation of the arguments, please see
|
||||
:meth:`telegram.Bot.ban_chat_sender_chat`.
|
||||
|
||||
.. versionadded:: 13.9
|
||||
|
||||
Returns:
|
||||
:obj:`bool`: On success, :obj:`True` is returned.
|
||||
|
||||
"""
|
||||
return self.bot.ban_chat_sender_chat(
|
||||
chat_id=self.id, sender_chat_id=sender_chat_id, timeout=timeout, api_kwargs=api_kwargs
|
||||
)
|
||||
|
||||
def ban_chat(
|
||||
self,
|
||||
chat_id: Union[str, int],
|
||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
api_kwargs: JSONDict = None,
|
||||
) -> bool:
|
||||
"""Shortcut for::
|
||||
|
||||
bot.ban_chat_sender_chat(sender_chat_id=update.effective_chat.id, *args, **kwargs)
|
||||
|
||||
For the documentation of the arguments, please see
|
||||
:meth:`telegram.Bot.ban_chat_sender_chat`.
|
||||
|
||||
.. versionadded:: 13.9
|
||||
|
||||
Returns:
|
||||
:obj:`bool`: On success, :obj:`True` is returned.
|
||||
|
||||
"""
|
||||
return self.bot.ban_chat_sender_chat(
|
||||
chat_id=chat_id, sender_chat_id=self.id, timeout=timeout, api_kwargs=api_kwargs
|
||||
)
|
||||
|
||||
def unban_sender_chat(
|
||||
self,
|
||||
sender_chat_id: int,
|
||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
api_kwargs: JSONDict = None,
|
||||
) -> bool:
|
||||
"""Shortcut for::
|
||||
|
||||
bot.unban_chat_sender_chat(chat_id=update.effective_chat.id, *args, **kwargs)
|
||||
|
||||
For the documentation of the arguments, please see
|
||||
:meth:`telegram.Bot.unban_chat_sender_chat`.
|
||||
|
||||
.. versionadded:: 13.9
|
||||
|
||||
Returns:
|
||||
:obj:`bool`: On success, :obj:`True` is returned.
|
||||
|
||||
"""
|
||||
return self.bot.unban_chat_sender_chat(
|
||||
chat_id=self.id, sender_chat_id=sender_chat_id, timeout=timeout, api_kwargs=api_kwargs
|
||||
)
|
||||
|
||||
def unban_chat(
|
||||
self,
|
||||
chat_id: Union[str, int],
|
||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
api_kwargs: JSONDict = None,
|
||||
) -> bool:
|
||||
"""Shortcut for::
|
||||
|
||||
bot.unban_chat_sender_chat(sender_chat_id=update.effective_chat.id, *args, **kwargs)
|
||||
|
||||
For the documentation of the arguments, please see
|
||||
:meth:`telegram.Bot.unban_chat_sender_chat`.
|
||||
|
||||
.. versionadded:: 13.9
|
||||
|
||||
Returns:
|
||||
:obj:`bool`: On success, :obj:`True` is returned.
|
||||
|
||||
"""
|
||||
return self.bot.unban_chat_sender_chat(
|
||||
chat_id=chat_id, sender_chat_id=self.id, timeout=timeout, api_kwargs=api_kwargs
|
||||
)
|
||||
|
||||
def unban_member(
|
||||
self,
|
||||
user_id: Union[str, int],
|
||||
@@ -676,6 +792,7 @@ class Chat(TelegramObject):
|
||||
api_kwargs: JSONDict = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
|
||||
protect_content: bool = None,
|
||||
) -> 'Message':
|
||||
"""Shortcut for::
|
||||
|
||||
@@ -699,6 +816,7 @@ class Chat(TelegramObject):
|
||||
api_kwargs=api_kwargs,
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
entities=entities,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
def send_media_group(
|
||||
@@ -711,6 +829,7 @@ class Chat(TelegramObject):
|
||||
timeout: DVInput[float] = DEFAULT_20,
|
||||
api_kwargs: JSONDict = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
protect_content: bool = None,
|
||||
) -> List['Message']:
|
||||
"""Shortcut for::
|
||||
|
||||
@@ -730,6 +849,7 @@ class Chat(TelegramObject):
|
||||
timeout=timeout,
|
||||
api_kwargs=api_kwargs,
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
def send_chat_action(
|
||||
@@ -771,6 +891,7 @@ class Chat(TelegramObject):
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
|
||||
filename: str = None,
|
||||
protect_content: bool = None,
|
||||
) -> 'Message':
|
||||
"""Shortcut for::
|
||||
|
||||
@@ -795,6 +916,7 @@ class Chat(TelegramObject):
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
caption_entities=caption_entities,
|
||||
filename=filename,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
def send_contact(
|
||||
@@ -810,6 +932,7 @@ class Chat(TelegramObject):
|
||||
vcard: str = None,
|
||||
api_kwargs: JSONDict = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
protect_content: bool = None,
|
||||
) -> 'Message':
|
||||
"""Shortcut for::
|
||||
|
||||
@@ -834,6 +957,7 @@ class Chat(TelegramObject):
|
||||
vcard=vcard,
|
||||
api_kwargs=api_kwargs,
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
def send_audio(
|
||||
@@ -853,6 +977,7 @@ class Chat(TelegramObject):
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
|
||||
filename: str = None,
|
||||
protect_content: bool = None,
|
||||
) -> 'Message':
|
||||
"""Shortcut for::
|
||||
|
||||
@@ -881,6 +1006,7 @@ class Chat(TelegramObject):
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
caption_entities=caption_entities,
|
||||
filename=filename,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
def send_document(
|
||||
@@ -898,6 +1024,7 @@ class Chat(TelegramObject):
|
||||
disable_content_type_detection: bool = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
|
||||
protect_content: bool = None,
|
||||
) -> 'Message':
|
||||
"""Shortcut for::
|
||||
|
||||
@@ -924,6 +1051,7 @@ class Chat(TelegramObject):
|
||||
disable_content_type_detection=disable_content_type_detection,
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
caption_entities=caption_entities,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
def send_dice(
|
||||
@@ -935,6 +1063,7 @@ class Chat(TelegramObject):
|
||||
emoji: str = None,
|
||||
api_kwargs: JSONDict = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
protect_content: bool = None,
|
||||
) -> 'Message':
|
||||
"""Shortcut for::
|
||||
|
||||
@@ -955,6 +1084,7 @@ class Chat(TelegramObject):
|
||||
emoji=emoji,
|
||||
api_kwargs=api_kwargs,
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
def send_game(
|
||||
@@ -966,6 +1096,7 @@ class Chat(TelegramObject):
|
||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
api_kwargs: JSONDict = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
protect_content: bool = None,
|
||||
) -> 'Message':
|
||||
"""Shortcut for::
|
||||
|
||||
@@ -986,6 +1117,7 @@ class Chat(TelegramObject):
|
||||
timeout=timeout,
|
||||
api_kwargs=api_kwargs,
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
def send_invoice(
|
||||
@@ -1017,6 +1149,7 @@ class Chat(TelegramObject):
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
max_tip_amount: int = None,
|
||||
suggested_tip_amounts: List[int] = None,
|
||||
protect_content: bool = None,
|
||||
) -> 'Message':
|
||||
"""Shortcut for::
|
||||
|
||||
@@ -1065,6 +1198,7 @@ class Chat(TelegramObject):
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
max_tip_amount=max_tip_amount,
|
||||
suggested_tip_amounts=suggested_tip_amounts,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
def send_location(
|
||||
@@ -1082,6 +1216,7 @@ class Chat(TelegramObject):
|
||||
heading: int = None,
|
||||
proximity_alert_radius: int = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
protect_content: bool = None,
|
||||
) -> 'Message':
|
||||
"""Shortcut for::
|
||||
|
||||
@@ -1108,6 +1243,7 @@ class Chat(TelegramObject):
|
||||
heading=heading,
|
||||
proximity_alert_radius=proximity_alert_radius,
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
def send_animation(
|
||||
@@ -1127,6 +1263,7 @@ class Chat(TelegramObject):
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
|
||||
filename: str = None,
|
||||
protect_content: bool = None,
|
||||
) -> 'Message':
|
||||
"""Shortcut for::
|
||||
|
||||
@@ -1155,6 +1292,7 @@ class Chat(TelegramObject):
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
caption_entities=caption_entities,
|
||||
filename=filename,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
def send_sticker(
|
||||
@@ -1166,6 +1304,7 @@ class Chat(TelegramObject):
|
||||
timeout: DVInput[float] = DEFAULT_20,
|
||||
api_kwargs: JSONDict = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
protect_content: bool = None,
|
||||
) -> 'Message':
|
||||
"""Shortcut for::
|
||||
|
||||
@@ -1186,6 +1325,7 @@ class Chat(TelegramObject):
|
||||
timeout=timeout,
|
||||
api_kwargs=api_kwargs,
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
def send_venue(
|
||||
@@ -1205,6 +1345,7 @@ class Chat(TelegramObject):
|
||||
google_place_id: str = None,
|
||||
google_place_type: str = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
protect_content: bool = None,
|
||||
) -> 'Message':
|
||||
"""Shortcut for::
|
||||
|
||||
@@ -1233,6 +1374,7 @@ class Chat(TelegramObject):
|
||||
google_place_id=google_place_id,
|
||||
google_place_type=google_place_type,
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
def send_video(
|
||||
@@ -1253,6 +1395,7 @@ class Chat(TelegramObject):
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
|
||||
filename: str = None,
|
||||
protect_content: bool = None,
|
||||
) -> 'Message':
|
||||
"""Shortcut for::
|
||||
|
||||
@@ -1282,6 +1425,7 @@ class Chat(TelegramObject):
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
caption_entities=caption_entities,
|
||||
filename=filename,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
def send_video_note(
|
||||
@@ -1297,6 +1441,7 @@ class Chat(TelegramObject):
|
||||
api_kwargs: JSONDict = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
filename: str = None,
|
||||
protect_content: bool = None,
|
||||
) -> 'Message':
|
||||
"""Shortcut for::
|
||||
|
||||
@@ -1321,6 +1466,7 @@ class Chat(TelegramObject):
|
||||
api_kwargs=api_kwargs,
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
filename=filename,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
def send_voice(
|
||||
@@ -1337,6 +1483,7 @@ class Chat(TelegramObject):
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
caption_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
|
||||
filename: str = None,
|
||||
protect_content: bool = None,
|
||||
) -> 'Message':
|
||||
"""Shortcut for::
|
||||
|
||||
@@ -1362,6 +1509,7 @@ class Chat(TelegramObject):
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
caption_entities=caption_entities,
|
||||
filename=filename,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
def send_poll(
|
||||
@@ -1385,6 +1533,7 @@ class Chat(TelegramObject):
|
||||
api_kwargs: JSONDict = None,
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
explanation_entities: Union[List['MessageEntity'], Tuple['MessageEntity', ...]] = None,
|
||||
protect_content: bool = None,
|
||||
) -> 'Message':
|
||||
"""Shortcut for::
|
||||
|
||||
@@ -1416,6 +1565,7 @@ class Chat(TelegramObject):
|
||||
api_kwargs=api_kwargs,
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
explanation_entities=explanation_entities,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
def send_copy(
|
||||
@@ -1431,6 +1581,7 @@ class Chat(TelegramObject):
|
||||
reply_markup: 'ReplyMarkup' = None,
|
||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
api_kwargs: JSONDict = None,
|
||||
protect_content: bool = None,
|
||||
) -> 'MessageId':
|
||||
"""Shortcut for::
|
||||
|
||||
@@ -1455,6 +1606,7 @@ class Chat(TelegramObject):
|
||||
reply_markup=reply_markup,
|
||||
timeout=timeout,
|
||||
api_kwargs=api_kwargs,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
def copy_message(
|
||||
@@ -1470,6 +1622,7 @@ class Chat(TelegramObject):
|
||||
reply_markup: 'ReplyMarkup' = None,
|
||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
api_kwargs: JSONDict = None,
|
||||
protect_content: bool = None,
|
||||
) -> 'MessageId':
|
||||
"""Shortcut for::
|
||||
|
||||
@@ -1494,6 +1647,7 @@ class Chat(TelegramObject):
|
||||
reply_markup=reply_markup,
|
||||
timeout=timeout,
|
||||
api_kwargs=api_kwargs,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
def export_invite_link(
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# pylint: disable=R0903
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -34,6 +34,12 @@ class ChatJoinRequest(TelegramObject):
|
||||
Objects of this class are comparable in terms of equality. Two objects of this class are
|
||||
considered equal, if their :attr:`chat`, :attr:`from_user` and :attr:`date` are equal.
|
||||
|
||||
Note:
|
||||
Since Bot API 5.5, bots are allowed to contact users who sent a join request to a chat
|
||||
where the bot is an administrator with the
|
||||
:attr:`~telegram.ChatMemberAdministrator.can_invite_users` administrator right – even if
|
||||
the user never interacted with the bot before.
|
||||
|
||||
.. versionadded:: 13.8
|
||||
|
||||
Args:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# pylint: disable=R0902,R0913
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
+13
-3
@@ -1,5 +1,5 @@
|
||||
# python-telegram-bot - a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# by the python-telegram-bot contributors <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -21,7 +21,7 @@ The following constants were extracted from the
|
||||
`Telegram Bots API <https://core.telegram.org/bots/api>`_.
|
||||
|
||||
Attributes:
|
||||
BOT_API_VERSION (:obj:`str`): `5.3`. Telegram Bot API version supported by this
|
||||
BOT_API_VERSION (:obj:`str`): `5.6`. Telegram Bot API version supported by this
|
||||
version of `python-telegram-bot`. Also available as ``telegram.bot_api_version``.
|
||||
|
||||
.. versionadded:: 13.4
|
||||
@@ -48,6 +48,10 @@ Attributes:
|
||||
ANONYMOUS_ADMIN_ID (:obj:`int`): ``1087968824`` (User id in groups for anonymous admin)
|
||||
SERVICE_CHAT_ID (:obj:`int`): ``777000`` (Telegram service chat, that also acts as sender of
|
||||
channel posts forwarded to discussion groups)
|
||||
FAKE_CHANNEL_ID (:obj:`int`): ``136817688`` (User id in groups when message is sent on behalf
|
||||
of a channel).
|
||||
|
||||
.. versionadded:: 13.9
|
||||
|
||||
The following constants are related to specific classes and are also available
|
||||
as attributes of those classes:
|
||||
@@ -137,6 +141,9 @@ Attributes:
|
||||
MESSAGEENTITY_TEXT_MENTION (:obj:`str`): ``'text_mention'``
|
||||
MESSAGEENTITY_UNDERLINE (:obj:`str`): ``'underline'``
|
||||
MESSAGEENTITY_STRIKETHROUGH (:obj:`str`): ``'strikethrough'``
|
||||
MESSAGEENTITY_SPOILER (:obj:`str`): ``'spoiler'``
|
||||
|
||||
.. versionadded:: 13.10
|
||||
MESSAGEENTITY_ALL_TYPES (List[:obj:`str`]): List of all the types of message entity.
|
||||
|
||||
:class:`telegram.ParseMode`:
|
||||
@@ -240,11 +247,12 @@ Attributes:
|
||||
"""
|
||||
from typing import List
|
||||
|
||||
BOT_API_VERSION: str = '5.4'
|
||||
BOT_API_VERSION: str = '5.6'
|
||||
MAX_MESSAGE_LENGTH: int = 4096
|
||||
MAX_CAPTION_LENGTH: int = 1024
|
||||
ANONYMOUS_ADMIN_ID: int = 1087968824
|
||||
SERVICE_CHAT_ID: int = 777000
|
||||
FAKE_CHANNEL_ID: int = 136817688
|
||||
|
||||
# constants above this line are tested
|
||||
|
||||
@@ -316,6 +324,7 @@ MESSAGEENTITY_TEXT_LINK: str = 'text_link'
|
||||
MESSAGEENTITY_TEXT_MENTION: str = 'text_mention'
|
||||
MESSAGEENTITY_UNDERLINE: str = 'underline'
|
||||
MESSAGEENTITY_STRIKETHROUGH: str = 'strikethrough'
|
||||
MESSAGEENTITY_SPOILER: str = 'spoiler'
|
||||
MESSAGEENTITY_ALL_TYPES: List[str] = [
|
||||
MESSAGEENTITY_MENTION,
|
||||
MESSAGEENTITY_HASHTAG,
|
||||
@@ -332,6 +341,7 @@ MESSAGEENTITY_ALL_TYPES: List[str] = [
|
||||
MESSAGEENTITY_TEXT_MENTION,
|
||||
MESSAGEENTITY_UNDERLINE,
|
||||
MESSAGEENTITY_STRIKETHROUGH,
|
||||
MESSAGEENTITY_SPOILER,
|
||||
]
|
||||
|
||||
PARSEMODE_MARKDOWN: str = 'Markdown'
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
# pylint: disable=R0903
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -17,24 +16,6 @@
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser Public License
|
||||
# along with this program. If not, see [http://www.gnu.org/licenses/].
|
||||
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Lesser Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser Public License for more details.
|
||||
#
|
||||
# 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 CallbackDataCache class."""
|
||||
import logging
|
||||
import time
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -41,7 +41,7 @@ class ChatJoinRequestHandler(Handler[Update, CCT]):
|
||||
When setting ``run_async`` to :obj:`True`, you cannot rely on adding custom
|
||||
attributes to :class:`telegram.ext.CallbackContext`. See its docs for more info.
|
||||
|
||||
.. versionadded:: 13.8
|
||||
.. versionadded:: 13.8
|
||||
|
||||
Args:
|
||||
callback (:obj:`callable`): The callback function for this handler. Will be called when
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2019-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2020
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2020-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -356,7 +356,7 @@ class Dispatcher(Generic[CCT, UD, CD, BD]):
|
||||
raise RuntimeError(f'{cls.__name__} not initialized or multiple instances exist')
|
||||
|
||||
def _pooled(self) -> None:
|
||||
thr_name = current_thread().getName()
|
||||
thr_name = current_thread().name
|
||||
while 1:
|
||||
promise = self.__async_queue.get()
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# pylint: disable=E0611,E0213,E1102,C0103,E1101,R0913,R0904
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -193,6 +193,7 @@ class ExtBot(telegram.bot.Bot):
|
||||
allow_sending_without_reply: ODVInput[bool] = DEFAULT_NONE,
|
||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
api_kwargs: JSONDict = None,
|
||||
protect_content: bool = None,
|
||||
) -> Union[bool, Message]:
|
||||
# We override this method to call self._replace_keyboard and self._insert_callback_data.
|
||||
# This covers most methods that have a reply_markup
|
||||
@@ -205,6 +206,7 @@ class ExtBot(telegram.bot.Bot):
|
||||
allow_sending_without_reply=allow_sending_without_reply,
|
||||
timeout=timeout,
|
||||
api_kwargs=api_kwargs,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
if isinstance(result, Message):
|
||||
self._insert_callback_data(result)
|
||||
@@ -299,6 +301,7 @@ class ExtBot(telegram.bot.Bot):
|
||||
reply_markup: ReplyMarkup = None,
|
||||
timeout: ODVInput[float] = DEFAULT_NONE,
|
||||
api_kwargs: JSONDict = None,
|
||||
protect_content: bool = None,
|
||||
) -> MessageId:
|
||||
# We override this method to call self._replace_keyboard
|
||||
return super().copy_message(
|
||||
@@ -314,6 +317,7 @@ class ExtBot(telegram.bot.Bot):
|
||||
reply_markup=self._replace_keyboard(reply_markup),
|
||||
timeout=timeout,
|
||||
api_kwargs=api_kwargs,
|
||||
protect_content=protect_content,
|
||||
)
|
||||
|
||||
def get_chat(
|
||||
|
||||
+34
-5
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -1965,16 +1965,16 @@ officedocument.wordprocessingml.document")``.
|
||||
|
||||
class sender_chat(_ChatUserBaseFilter):
|
||||
# pylint: disable=W0235
|
||||
"""Filters messages to allow only those which are from a specified sender chats chat ID or
|
||||
"""Filters messages to allow only those which are from a specified sender chat's chat ID or
|
||||
username.
|
||||
|
||||
Examples:
|
||||
* To filter for messages forwarded to a discussion group from a channel with ID
|
||||
* To filter for messages sent to a group by a channel with ID
|
||||
``-1234``, use ``MessageHandler(Filters.sender_chat(-1234), callback_method)``.
|
||||
* To filter for messages of anonymous admins in a super group with username
|
||||
``@anonymous``, use
|
||||
``MessageHandler(Filters.sender_chat(username='anonymous'), callback_method)``.
|
||||
* To filter for messages forwarded to a discussion group from *any* channel, use
|
||||
* To filter for messages sent to a group by *any* channel, use
|
||||
``MessageHandler(Filters.sender_chat.channel, callback_method)``.
|
||||
* To filter for messages of anonymous admins in *any* super group, use
|
||||
``MessageHandler(Filters.sender_chat.super_group, callback_method)``.
|
||||
@@ -1983,7 +1983,10 @@ officedocument.wordprocessingml.document")``.
|
||||
Remember, ``sender_chat`` is also set for messages in a channel as the channel itself,
|
||||
so when your bot is an admin in a channel and the linked discussion group, you would
|
||||
receive the message twice (once from inside the channel, once inside the discussion
|
||||
group).
|
||||
group). Since v13.9, the field :attr:`telegram.Message.is_automatic_forward` will be
|
||||
:obj:`True` for the discussion group message.
|
||||
|
||||
.. seealso:: :attr:`Filters.is_automatic_forward`
|
||||
|
||||
Warning:
|
||||
:attr:`chat_ids` will return a *copy* of the saved chat ids as :class:`frozenset`. This
|
||||
@@ -2089,6 +2092,32 @@ officedocument.wordprocessingml.document")``.
|
||||
super_group = _SuperGroup()
|
||||
channel = _Channel()
|
||||
|
||||
class _IsAutomaticForward(MessageFilter):
|
||||
__slots__ = ()
|
||||
name = 'Filters.is_automatic_forward'
|
||||
|
||||
def filter(self, message: Message) -> bool:
|
||||
return bool(message.is_automatic_forward)
|
||||
|
||||
is_automatic_forward = _IsAutomaticForward()
|
||||
"""Messages that contain :attr:`telegram.Message.is_automatic_forward`.
|
||||
|
||||
.. versionadded:: 13.9
|
||||
"""
|
||||
|
||||
class _HasProtectedContent(MessageFilter):
|
||||
__slots__ = ()
|
||||
name = 'Filters.has_protected_content'
|
||||
|
||||
def filter(self, message: Message) -> bool:
|
||||
return bool(message.has_protected_content)
|
||||
|
||||
has_protected_content = _HasProtectedContent()
|
||||
"""Messages that contain :attr:`telegram.Message.has_protected_content`.
|
||||
|
||||
.. versionadded:: 13.9
|
||||
"""
|
||||
|
||||
class _Invoice(MessageFilter):
|
||||
__slots__ = ()
|
||||
name = 'Filters.invoice'
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# Tymofii A. Khodniev (thodnev) <thodnev@mail.ru>
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2019-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -14,8 +14,8 @@
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Lesser Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser Public License
|
||||
# along with this program. If not, see [http://www.gnu.org/licenses/].
|
||||
# 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 PollAnswerHandler class."""
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2019-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# pylint: disable=W0622,E0611
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
@@ -45,16 +45,25 @@ class InlineKeyboardButton(TelegramObject):
|
||||
|
||||
.. versionadded:: 13.6
|
||||
|
||||
* Since Bot API 5.5, it's now allowed to mention users by their ID in inline keyboards.
|
||||
This will only work in Telegram versions released after December 7, 2021.
|
||||
Older clients will display *unsupported message*.
|
||||
|
||||
Warning:
|
||||
If your bot allows your arbitrary callback data, buttons whose callback data is a
|
||||
non-hashable object will be come unhashable. Trying to evaluate ``hash(button)`` will
|
||||
non-hashable object will become unhashable. Trying to evaluate ``hash(button)`` will
|
||||
result in a :class:`TypeError`.
|
||||
|
||||
.. versionchanged:: 13.6
|
||||
|
||||
Args:
|
||||
text (:obj:`str`): Label text on the button.
|
||||
url (:obj:`str`, optional): HTTP or tg:// url to be opened when button is pressed.
|
||||
url (:obj:`str`, optional): HTTP or tg:// url to be opened when the button is pressed.
|
||||
Links ``tg://user?id=<user_id>`` can be used to mention a user by
|
||||
their ID without using a username, if this is allowed by their privacy settings.
|
||||
|
||||
.. versionchanged:: 13.9
|
||||
You can now mention a user using ``tg://user?id=<user_id>``.
|
||||
login_url (:class:`telegram.LoginUrl`, optional): An HTTP URL used to automatically
|
||||
authorize the user. Can be used as a replacement for the Telegram Login Widget.
|
||||
callback_data (:obj:`str` | :obj:`Any`, optional): Data to be sent in a callback query to
|
||||
@@ -76,12 +85,18 @@ class InlineKeyboardButton(TelegramObject):
|
||||
be launched when the user presses the button. This type of button must always be
|
||||
the ``first`` button in the first row.
|
||||
pay (:obj:`bool`, optional): Specify :obj:`True`, to send a Pay button. This type of button
|
||||
must always be the ``first`` button in the first row.
|
||||
must always be the `first` button in the first row and can only be used in invoice
|
||||
messages.
|
||||
**kwargs (:obj:`dict`): Arbitrary keyword arguments.
|
||||
|
||||
Attributes:
|
||||
text (:obj:`str`): Label text on the button.
|
||||
url (:obj:`str`): Optional. HTTP or tg:// url to be opened when button is pressed.
|
||||
url (:obj:`str`): Optional. HTTP or tg:// url to be opened when the button is pressed.
|
||||
Links ``tg://user?id=<user_id>`` can be used to mention a user by
|
||||
their ID without using a username, if this is allowed by their privacy settings.
|
||||
|
||||
.. versionchanged:: 13.9
|
||||
You can now mention a user using ``tg://user?id=<user_id>``.
|
||||
login_url (:class:`telegram.LoginUrl`): Optional. An HTTP URL used to automatically
|
||||
authorize the user. Can be used as a replacement for the Telegram Login Widget.
|
||||
callback_data (:obj:`str` | :obj:`object`): Optional. Data to be sent in a callback query
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# pylint: disable=R0902,R0913
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
#
|
||||
# A library that provides a Python interface to the Telegram Bot API
|
||||
# Copyright (C) 2015-2021
|
||||
# Copyright (C) 2015-2022
|
||||
# Leandro Toledo de Souza <devs@python-telegram-bot.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user