Skip to content

Latest commit

 

History

History
394 lines (335 loc) · 24 KB

CHANGELOG.md

File metadata and controls

394 lines (335 loc) · 24 KB

Changelog

Version 4.9

  • ⚠️ BREAKING CHANGES ⚠️ :

    • pytgbot now comes in two flavors, sync and async, making it fit for asyncio.
    • Those need different dependencies, as the favorite web framework for the normal mode is requests, but that one isn't suited for asyncio.
    • Therefore you have to now install it as pytgbot[sync] instead of just pytgbot.
    • Your pip command looks like pip install pytgbot[sync].
    • If you want to install the async version it's pytgbot[async].
    • If you just install pytgbot (without the version in square brackets), you have to install requests for the sync bot or httpx for the async bot yourself.
  • Added API definitions of v4.7, (March 30, 2020) with the following changelog:

    • Added the method send_dice for sending a dice message, which will have a random value from 1 to 6. (Yes, we're aware of the “proper” singular of die. But it's awkward, and we decided to help it change. One dice at a time!)
    • Added the field dice to the Message object.
    • Added the method get_my_commands for getting the current list of the bot's commands.
    • Added the method set_my_commands for changing the list of the bot's commands through the Bot API instead of @BotFather.
    • Added the ability to create animated sticker sets by specifying the parameter tgs_sticker instead of png_sticker in the method create_new_sticker_set.
    • Added the ability to add animated stickers to sets created by the bot by specifying the parameter tgs_sticker instead of png_sticker in the method add_sticker_to_set.
    • Added the field thumb to the StickerSet object.
    • Added the ability to change thumbnails of sticker sets created by the bot using the method set_sticker_set_thumb.
  • Added API definitions of v4.8, (April 24, 2020) with the following changelog:

    • Supported explanations for Quizzes 2.0. Add explanations by specifying the parameters explanation and explanation_parse_mode in the method send_poll.
    • Added the fields explanation and explanation_entities to the Poll object.
    • Supported timed polls that automatically close at a certain date and time. Set up by specifying the parameter open_period or close_date in the method send_poll.
    • Added the fields open_period and close_date to the Poll object.
    • Supported the new darts animation for the dice mini-game. Choose between the default dice animation and darts animation by specifying the parameter emoji in the method send_dice.
    • Added the field emoji to the Dice object.
  • Added API definitions of v4.9, (June 4, 2020) with the following changelog:

    • Added the new field via_bot to the Message object. You can now know which bot was used to send a message.
    • Supported video thumbnails for inline GIF and MPEG4 animations.
    • Supported the new basketball animation for the random dice. Choose between different animations (dice, darts, basketball) by specifying the emoji parameter in the method send_dice.
  • Minor changes

    • Fixed get_update where the time delta would easily underflow to being days, making it wait forever.
    • Fixed get_update where error_as_empty=True and return_python_objects=True were not playing well together, and returning the wrong type.

Version 4.6.1 (not released yet)

  • Added language to MessageEntity for real now.
  • Added poll_answer to Update as well.

Version 4.6

  • Added API definitions of v4.6, (January 23, 2020) with the following changelog:
    • Supported Polls 2.0.
    • Added the ability to send non-anonymous, multiple answer, and quiz-style polls: added the parameters is_anonymous, type, allows_multiple_answers, correct_option_id, is_closed options to the method send_poll.
    • Added the object KeyboardButtonPollType and the field request_poll to the object KeyboardButton.
    • Added updates about changes of user answers in non-anonymous polls, represented by the object PollAnswer and the field poll_answer in the Update object.
    • Added the fields total_voter_count, is_anonymous, type, allows_multiple_answers, correct_option_id to the Poll object.
    • Bots can now send polls to private chats.
    • Added more information about the bot in response to the getMe request: added the fields can_join_groups, can_read_all_group_messages and supports_inline_queries to the User object.
    • Added the optional field language to the MessageEntity object.
  • The new stuff:
    • New Fields:
      • pytgbot.api_types.receivable.media.MessageEntity: language
      • pytgbot.api_types.receivable.media.Poll: total_voter_count, is_closed, is_anonymous, type, allows_multiple_answers and correct_option_id
      • pytgbot.api_types.receivable.updates.Update: poll_answer
      • pytgbot.api_types.sendable.reply_markup.KeyboardButton: request_poll
      • pytgbot.api_types.receivable.peer.User: can_join_groups, can_read_all_group_messages, supports_inline_queries
      • pytgbot.api_types.receivable.peer.Chat: slow_mode_delay
      • pytgbot.api_types.receivable.peer.ChatMember: custom_title
    • New Arguments:
      • pytgbot.bot.Bot.get_me:
    • New Classes:
      • pytgbot.api_types.sendable.reply_markup.KeyboardButtonPollType
      • pytgbot.api_types.receivable.media.PollAnswer

Version 4.5.2

  • Fixed failing to merge the file_unique_id field into the media constructors.

Version 4.5.1

This is a re-release of 4.5.0 as I thought it didn't upload correctly

Version 4.5.0

  • Updated API definitions of v4.5, (December 31th, 2019) with the following changelog:
    • (not affected) 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.
    • (not affected) Added support for nested entities and the new tags / (for underlined text) and // (for strikethrough text) in parse mode HTML.
    • (not affected) 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.
    • (not affected) 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.

Version 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.

Version 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").

Version 4.0.3

  • Added .size property for all file based InputFile subclasses.

Version 4.0.2

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

Version 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>\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:

    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:

    TgApiResponseException(message:str, response: requests.Response, exception: Exception)

Version 4.0.0

  • Bot API 4.0 (July 26, 2018)
    • Added Telegram Passport
      • Added bot methods:
      • New pytgbot.api_types.receivable.passport containing: PassportData, PassportFile, EncryptedPassportElement and EncryptedCredentials
      • New pytgbot.api_types.sendable.passport containing: PassportElementError, PassportElementErrorDataField, PassportElementErrorFrontSide, PassportElementErrorReverseSide, PassportElementErrorSelfie, PassportElementErrorFile and PassportElementErrorFiles
    • More Changes:
      • api_types.receivable.media:
        • MessageEntity added "cashtag" as possible entity type.
        • Added thumb parameter to Audio.
        • Added vcard parameter to Contact.
        • Added foursquare_type parameter to Venue.
        • Added Animation class.
      • api_types.receivable.passport:
        • Added, see above.
      • api_types.receivable.updates:
        • Added parameters animation and passport_data to Message.
      • api_types.sendable.inline:
        • Added foursquare_type parameter to InlineQueryResultVenue and InputVenueMessageContent.
        • Added vcard parameter to InlineQueryResultContact and InputContactMessageContent.
      • api_types.sendable.input_media:
        • InputMedia: Created caption field, this is contained in all subclasses.
        • InputMediaPhoto:
          • moved the caption into the superclass.
          • fixed parse_mode not working in from_array(...)
        • InputMediaVideo:
          • moved the caption into the superclass.
          • fixed parse_mode not working in from_array(...)
          • added thumb parameter.
        • Added new InputMediaAnimation.
        • Added new InputMediaAudio.
        • Added new InputMediaDocument.
      • api_types.receivable.passport:
        • Added, see above.
      • bot.Bot:
        • Added thumb parameter to send_audio(...), send_video(...), send_video_note(...) and send_video_note(...).
        • Added foursquare_type parameter to send_venue(...).
        • Added vcard parameter to send_contact(...).
        • Added new send_animation(...) function.
        • Added new edit_message_media(...) function.
        • Added new set_passport_data_errors(...) function.
    • Documentation changes:
      • bot.Bot.set_webhook: Returns True, only on success.
      • bot.Bot.send_media_group: Instead of generic InputMedia, now only accepts InputMediaPhoto or InputMediaVideo
      • api_types.sendable.reply_markup.InlineKeyboardButton can now use tg:https:// urls, too.
  • Also, while at it
    • Fixed 'live_period' in inlinequeryresultlocation_instance wrongly returning False
    • Fixed InputFileFromBlob and InputFileFromURL: Reworked that whole InputFile piece, which should fix #6.
    • Fixed certificate argument in Bot.set_webhook(...) not working. - Therefore in _do_fileupload(...), the file can be set to be optional (_file_is_optional=True).
    • Added get_request_media(...) method to InputMedia, to allow sending easier. Is very similar to InputFile.get_request_files(...).
    • Fixed Bot.send_media_group(...) now supporting InputMediaPhoto and InputMediaVideo elements, so sending files is actually possible.
    • Fixed Bot.edit_message_media(...) now supporting InputMedia elements, so sending files is actually possible.

Version 3.6.0

  • Bot API 3.6 (February 13, 2018)
    • Added connected_website attribute to the Update class.
  • Added parse_mode attribute all stuff that has captions, in the bot functions and the sendable inline objects.
  • Also added supports_streaming to Bot.send_video(...) and sendable.inputmedia.InputMediaVideo.

Version 3.5.2

  • Added username and id property to the Bot class. This is basically the implementation used in Teleflask already, but calling it id and not user_id as it is a bot, not a user.
  • Added __str__ class, so that str(bot) displays as Bot(username="luckybot", id=108721382)

Version 3.5.1

  • Fixed InputFileFromDisk.
  • Usage of InputFile with file_blob is now deprecated. Use InputFileFromBlob instead.

Version 3.5.0

Updated official API changes of

Version 3.3.1

  • Removed doubled WebhookInfo classes at two different places. They are now the same.
  • Fixed importing Message in pytgbot.api_types.receivable.peer.Chat.

Version 3.3.0

  • Updated Official API changes of Bot API 3.3 (August 23, 2017)
    • Added new fields:
      • peer.Chat.pinned_message
      • peer.User.is_bot
      • updates.Message.forward_signature
      • updates.Message.author_signature
    • Removed fields:
      • updates.Message.new_chat_member
        • but updates.Message.new_chat_members still exists

Version 3.2.0 Not released 8eb2ff860af4ce6e44d3fcf5c012d8a070e046ee

Version 3.1.1 Not released 6654e962ce42e305be138efa90f9262098bf2b7d

  • fixed send_video_note, send_video, send_voice, set_chat_photo of pytgbot.bot.Bot.

Version 3.1.0

  • Updated Official API changes of Bot API 3.1 (June 30, 2017)
    • Added new functions:
      • pytgbot.bot.Bot.restrict_chat_member
      • pytgbot.bot.Bot.promote_chat_member
      • pytgbot.bot.Bot.export_chat_invite_link
      • pytgbot.bot.Bot.set_chat_photo
      • pytgbot.bot.Bot.delete_chat_photo
      • pytgbot.bot.Bot.set_chat_title
      • pytgbot.bot.Bot.set_chat_description
      • pytgbot.bot.Bot.pin_chat_message
      • pytgbot.bot.Bot.unpin_chat_message
    • Updated pytgbot.bot.Bot.kick_chat_member function, added until_date parameter.
    • Updated pytgbot.bot.Bot.send_invoice function, description parameter now optional.
    • Updated parameter chat_id in game related methods to no longer allows string, so no more "@username".
      • pytgbot.bot.Bot.send_game
      • pytgbot.bot.Bot.set_game_score
      • pytgbot.bot.Bot.get_game_high_scores
    • Added pytgbot.api_types.receivable.media.ChatPhoto.
    • Updated pytgbot.api_types.receivable.peer.Chat to include the new fields:
      • photo
      • description
      • invite_link
    • Updated api_types.receivable.peer.ChatMember:
      • status field can now also be "restricted"
      • Added fields:
      • until_date
      • can_be_edited
      • can_change_info
      • can_post_messages
      • can_edit_messages
      • can_delete_messages
      • can_invite_users
      • can_restrict_members
      • can_pin_messages
      • can_promote_members
      • can_send_messages
      • can_send_media_messages
      • can_send_other_messages
      • can_add_web_page_previews
    • Removed documentation saying pytgbot.api_types.sendable.inline.InlineQueryResultCachedDocument was limited to sending only pdf-files and zip archives.
  • Also now storing the incoming (decoded json) data in the _raw field of the object.

Version 3.0.0

  • Updated Official API changes of Bot API 3.0 (May 18, 2017)
    • Added pytgbot.api_types.receivable.VideoNote.
    • Updated pytgbot.api_types.receivable.peer.User to include the new language_code field.
    • Updated pytgbot.api_types.receivable.updates.Update to include the new shipping_query and pre_checkout_query fields.
    • Updated pytgbot.api_types.receivable.updates.Message to include the new video_note, new_chat_members, invoice and successful_payment fields.
    • Added pytgbot.api_types.receivable.updates.WebhookInfo
    • Updated pytgbot.api_types.sendable.inline.InlineQueryResultGif to include the new gif_duration field.
    • Updated pytgbot.api_types.sendable.inline.InlineQueryResultMpeg4Gif to include the new mpeg4_duration field.
    • Added pytgbot.api_types.sendable.payments.LabeledPrice
    • Added pytgbot.api_types.sendable.payments.ShippingOption
    • Updated pytgbot.api_types.sendable.reply_markup.InlineKeyboardButton to include the new pay field.
    • Added pytgbot.bot.Bot.delete_webhook function.
    • Added pytgbot.bot.Bot.send_video_note function.
    • Documented that pytgbot.bot.Bot.unban_chat_member now works with channels too.
    • Added pytgbot.bot.Bot.delete_message function.
    • Added pytgbot.bot.Bot.send_invoice function.
    • Added pytgbot.bot.Bot.answer_shipping_query function.
    • Added pytgbot.bot.Bot.answer_pre_checkout_query function.

Version 2.3.3

Version 2.3.2

  • Fixed failed version bump, which causing importing this package impossible.

Version 2.3.1

  • This is not Telegram Bot API 2.3.1!
  • This version doesn't work. Use 2.3.2 instead.
  • Fixed InlineQueryResultCachedSticker.

Version 2.3

Changes I observed:

Bot

answer_callback_query: added cache_time edit_message_text: works for game messages too. set_game_score: added force set_game_score: added disable_edit_message set_game_score: removed edit_message set_game_score: score can be 0. Now must be non-negative, before it must be postive.

Classes:

updates.Update: added channel_post updates.Update: added edited_channel_post updates.Message: added forward_from_message_id

Documentation:

Message ids are not called unique no more. CallbackQuery ids are not called global no more. Inline Keyboard Warnings removed.

Might be a incomplete list, also have a look at the api changelog.

Version 2.2.1

Bugfix release

Version 2.2.1a4

  • Fixed importing of Game in Update.from_array(array).

Version 2.2.1a3

  • Fixed importing of InputFile* after the package location change in V2.2.0.

Version 2.2.1a2

  • Manually added placeholder class pytgbot.api_types.receiveable.updates.CallbackGame

Version 2.2.1a1

  • Fixed using wrong templates

Version 2.2.0

  • Moving InputFile, InputFileFromDisk, InputFileFromURL to api_types.sendable.files.* #4
  • Implemented the changes from Bot API 2.2 (October 3, 2016) (gaming platform)
  • Improved templates, separated some stuff in the Bot.do(...) function for better subclassing. This will hopefully allow a subclass capable of returning infos, from an open webhook, later.

Version 2.1.4

  • Reworked InputFile, InputFileFromDisk, InputFileFromURL internals. They now should handle input better. #3, luckydonald/bonbot #131

Version 2.1.2

  • Fix: Also catching TgApiExceptions if get_updates(..., error_as_empty=True)

Version 2.1.1

  • Renamed get_updates(...)'s timeout parameter to poll_timeout.
  • Added request_timeout to do(...) method. Currently only get_updates(...) has that.

Version 2.1.0

  • Renamed pytgbot.api_types.receivable.media.File.download_url(token) to get_download_url(token)
  • Added a pytgbot.bot.Bot.get_download_url(file) method.

Version 2.0.1

  • Renamed InputFileURL to InputFileFromURL
  • Added InputFileFromDisk
  • InputFile is for buffers (strings) now

Version 2.0.0

Big overhaul:

  • Real Objects for everything.
  • Also most of this module can now be generated from the api website automatically, making updates a breeze.

Version 1.0.1

  • Added ability to ignore network errors in get_updates(...) without raising a exception by setting error_as_empty=True. Useful in for update in bot.get_updates(error_as_empty=True) constructs.

Version 1.0.0

Version 0.0.0

  • First implementation