Pytgbot

Latest version: v5.7

Safety actively analyzes 706267 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 4 of 9

4.5.0

- Updated API definitions of v4.5, (December 31th, 2019) with the following changelog:
- <kbd>(not affected)</kbd> Added support for two new MessageEntity types, underline and strikethrough.
Added support for nested MessageEntity objects. Entities can now contain other entities. If two entities have common characters then one of them is fully contained inside the other.
- <kbd>(not affected)</kbd> Added support for nested entities and the new tags <u>/<ins> (for underlined text) and <s>/<strike>/<del> (for strikethrough text) in parse mode HTML.
- <kbd>(not affected)</kbd> Added a new parse mode, MarkdownV2, which supports nested entities and two new entities __ (for underlined text) and ~ (for strikethrough text). Parse mode Markdown remains unchanged for backward compatibility.
- <kbd>(not affected)</kbd> Added the field file_unique_id to the objects Animation, Audio, Document, PassportFile, PhotoSize, Sticker, Video, VideoNote, Voice, File and the fields small_file_unique_id and big_file_unique_id to the object ChatPhoto. The new fields contain a unique file identifier, which is supposed to be the same over time and for different bots, but can't be used to download or reuse the file.
- Added the field custom_title to the ChatMember object.
- Added the new method setChatAdministratorCustomTitle to manage the custom titles of administrators promoted by the bot.
- Added the field slow_mode_delay to the Chat object.

4.4.0

- Array validation is now a separate function to allow super calls.
- Added API definitions of v4.4, (July 29th, 2019) with the following changelog:
- Added support for animated stickers. New field `is_animated` in `Sticker` and `StickerSet` objects, animated stickers can now be used in `send_sticker` and `InlineQueryResultCachedSticker`.
- Added support for default permissions in groups. New object `ChatPermissions`, containing actions which a member can take in a chat. New field permissions in the Chat object; new method setChatPermissions.
- The field `all_members_are_administrators` has been removed from the documentation for the `Chat` object. The field is still returned in the object for backward compatibility, but new bots should use the permissions field instead.
- Added support for more permissions for group and supergroup members: added the new field `can_send_polls` to `ChatMember` object, added `can_change_info`, `can_invite_users`, `can_pin_messages` in `ChatMember` object for restricted users (previously available only for administrators).
- The method `restrict_chat_member` now takes the new user permissions in a single argument of the type `ChatPermissions`.
- Added `description` support for basic groups (previously available in supergroups and channel chats). You can pass a group's `chat_id` to `set_chat_description` and receive the group's description in the `Chat` object in the response to `get_chat` method.
- Added `invite_link` support for basic groups (previously available in supergroups and channel chats). You can pass a group's chat_id to `export_chat_invite_link` and receive the group's invite link in the `Chat` object in the response to `get_chat` method.

4.1.0

- Renamed `InputFile`'s `file_name` to simply `name`. (`InputFileFromDisk`, `InputFileFromURL`, `InputFileFromBlob`)
- Renamed `InputFile`'s `file_mime` to simply `mime`. (`InputFileFromDisk`, `InputFileFromURL`, `InputFileFromBlob`)
- Renamed `InputFile`'s `file_blob` to simply `blob`. (`InputFileFromDisk`, `InputFileFromURL`, `InputFileFromBlob`)
- Renamed `InputFileFromURL`'s `file_url` to simply `url`.
- Renamed `InputFileFromBlob`'s `file_blob` to simply `blob`.
- Renamed `InputFileFromDisk`'s `file_path` to simply `path`.
- Added `InputFileUseUrl` and `InputFileUseFileID` as an abstract way for url/file_id instead of the plain string.
- Now `InputFile(...)` wrappes the new `InputFile.factory(...)`, which can be used to create a instance of a matching subclass by parameter.
- e.g. `InputFile(url="https://example.com")` results in the same as `InputFileFromURL("https://example.com")` which is in long form `InputFileFromURL(url="https://example.com")`.

4.0.3

- Added `.size` property for all file based `InputFile` subclasses.

4.0.2

- Bugfix release fixing request logic: when checking for api success, the condition for success was corrupted in 4.0.1.

4.0.1

- the `.raw` value will now be reset if you set any value of an `TgBotApiObject` object.
- Handle Responses with aren't valid json,
e.g. `413 Request Entity Too Large` when uploading too large files

Because the API responded with status `413`, as `text/html`:
html
<html>\r\n<head><title>413 Request Entity Too Large</title></head>\r\n<body bgcolor="white">\r\n<center><h1>413 Request Entity Too Large</h1></center>\r\n<hr><center>nginx/1.12.2</center>\r\n</body>\r\n</html>\r\n


The code would fail with generic json decode exception:
py
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)


Now we wrap that in a new exception type, which also subclasses from `TgApiException`:
py
TgApiResponseException(message:str, response: requests.Response, exception: Exception)

Page 4 of 9

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.