- Pulled in the latest changes from bot API 5.7.
- Nicer multiline descriptions for classes.
- Pulled in the latest changes from bot API 5.6.
- Added compatibility fallback for the renamed
bot.kick_chat_member(…)
andbot.get_chat_members_count(…)
.- Still you should now use
bot.ban_chat_member(…)
andbot.get_chat_member_count(…)
instead.
- Still you should now use
- Pulled in the latest changes from bot API 5.5.
Telegram renamed two functions:
bot.kick_chat_member(…)
is nowbot.ban_chat_member(…)
andbot.get_chat_members_count(…)
is nowbot.get_chat_member_count(…)
instead. Those are missing compatibility code to still work on the python side.
⚠️ MovedProximityAlertTriggered
frompytgbot.api_types.receiveable.media.ProximityAlertTriggered
topytgbot.api_types.receiveable.services.ProximityAlertTriggered
. It also no longer subclassesreceiveable.media.Media
, but a newreceiveable.services.ServiceMessage
- there should be a import from the old location making that backwards compatible, but that's not something you should depend on as we will remove it in a newer version.
id
: This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. Python itself is not affected, but your database might.- polls can have 45 more letters now
- Fixed httpx import error in the async client.
- Fix for
InputMediaWithThumb.thumb
not being optional [R2TG-9V].
Added download_url
parameter to the constructor of the Bot
s, so one can set the download url for non-official API servers.
Those might be different for a selfhosted server.
If that is not given but only a base_url
is, we'll try to guess it but show a warning.
That is used in get_download_url(…)
.
Fixed syntax error in get_download_url(…)
.
Also cut a stable release (too early again).
Fixed Sync bot not resolving username and id correctly.
Fixed importing the wrong bot, the async one, per default.
This is a re-release of 5.0.0-beta.1
, as PyPi did like that short version format better.
Other than the version number it is exactly the same as 5.0.0-beta.1
.
Core:
- The already for a while now deprecated
pytgbot.api_types.sendable.InputFile
,pytgbot.api_types.sendable.InputFileFromURL
andpytgbot.api_types.sendable.InputFileFromDisk
can no longer be found inpytgbot.api_types.sendable.\*
They are now only available atpytgbot.api_types.sendable.files.\*
, resulting inpytgbot.api_types.sendable.files.InputFile
,pytgbot.api_types.sendable.files.InputFileFromURL
andpytgbot.api_types.sendable.files.InputFileFromDisk
.
.as_array()
now has aprefer_original=False
boolean, if it should return the data this was constructed with if available. Otherwise, it will be constructed normally from the data of the object, as it was before.
Licence:
- Switched from GPL to LGPL.
- Fixed
pytgbot.bot
not being part of the pip release.
- Make exceptions inherit from Exception and not BaseException.
- Added Updates from the Bot API 4.9, including:
- Added StickerSet.thumb.
- Added Dice
- Shifting around of argument order in Message.
- Also adds Message.via_bot, Message.dice.
- Added InlineQueryResultGif .thumb_mime_type.
- Added InlineQueryResultMpeg4Gif.thumb_mime_type.
- Added Bot.set_sticker_set_thumb(…)
- Added Bot.get_my_commands(…)
- Added
language
toMessageEntity
for real now. - Added
poll_answer
toUpdate
as well.
- 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 methodsendPoll
. - Added the object
KeyboardButtonPollType
and the fieldrequest_poll
to the objectKeyboardButton
. - Added updates about changes of user answers in non-anonymous polls, represented by the object
PollAnswer
and the fieldpoll_answer
in theUpdate
object. - Added the fields
total_voter_count
,is_anonymous
,type
,allows_multiple_answers
,correct_option_id
to thePoll
object. - Bots can now send polls to private chats.
- Added more information about the bot in response to the
getMe
request: added the fieldscan_join_groups
,can_read_all_group_messages
andsupports_inline_queries
to the User object. - Added the optional field
language
to theMessageEntity
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
andcorrect_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
- New Fields:
- Fixed failing to merge the
file_unique_id
field into the media constructors.
This is a re-release of 4.5.0
as I thought it didn't upload correctly
- 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.
- 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
inSticker
andStickerSet
objects, animated stickers can now be used insend_sticker
andInlineQueryResultCachedSticker
. - 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 theChat
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
toChatMember
object, addedcan_change_info
,can_invite_users
,can_pin_messages
inChatMember
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 typeChatPermissions
. - Added
description
support for basic groups (previously available in supergroups and channel chats). You can pass a group'schat_id
toset_chat_description
and receive the group's description in theChat
object in the response toget_chat
method. - Added
invite_link
support for basic groups (previously available in supergroups and channel chats). You can pass a group's chat_id toexport_chat_invite_link
and receive the group's invite link in theChat
object in the response toget_chat
method.
- Added support for animated stickers. New field
- Renamed
InputFile
'sfile_name
to simplyname
. (InputFileFromDisk
,InputFileFromURL
,InputFileFromBlob
) - Renamed
InputFile
'sfile_mime
to simplymime
. (InputFileFromDisk
,InputFileFromURL
,InputFileFromBlob
) - Renamed
InputFile
'sfile_blob
to simplyblob
. (InputFileFromDisk
,InputFileFromURL
,InputFileFromBlob
) - Renamed
InputFileFromURL
'sfile_url
to simplyurl
. - Renamed
InputFileFromBlob
'sfile_blob
to simplyblob
. - Renamed
InputFileFromDisk
'sfile_path
to simplypath
. - Added
InputFileUseUrl
andInputFileUseFileID
as an abstract way for url/file_id instead of the plain string. - Now
InputFile(...)
wrappes the newInputFile.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 asInputFileFromURL("https://example.com")
which is in long formInputFileFromURL(url="https://example.com")
.
- e.g.
- Added
.size
property for all file basedInputFile
subclasses.
- Bugfix release fixing request logic: when checking for api success, the condition for success was corrupted in 4.0.1.
-
the
.raw
value will now be reset if you set any value of anTgBotApiObject
object. -
Handle Responses with aren't valid json, e.g.
413 Request Entity Too Large
when uploading too large filesBecause the API responded with status
413
, astext/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)
Bot API 4
.0
(July 26, 2018)- Added Telegram Passport
- Added bot methods:
- New
pytgbot.api_types.receivable.passport
containing:PassportData
,PassportFile
,EncryptedPassportElement
andEncryptedCredentials
- New
pytgbot.api_types.sendable.passport
containing:PassportElementError
,PassportElementErrorDataField
,PassportElementErrorFrontSide
,PassportElementErrorReverseSide
,PassportElementErrorSelfie
,PassportElementErrorFile
andPassportElementErrorFiles
- More Changes:
api_types.receivable.media
:MessageEntity
added"cashtag"
as possible entity type.- Added
thumb
parameter toAudio
. - Added
vcard
parameter toContact
. - Added
foursquare_type
parameter toVenue
. - Added
Animation
class.
api_types.receivable.passport
:- Added, see above.
api_types.receivable.updates
:- Added parameters
animation
andpassport_data
toMessage
.
- Added parameters
api_types.sendable.inline
:- Added
foursquare_type
parameter toInlineQueryResultVenue
andInputVenueMessageContent
. - Added
vcard
parameter toInlineQueryResultContact
andInputContactMessageContent
.
- Added
api_types.sendable.input_media
:InputMedia
: Createdcaption
field, this is contained in all subclasses.InputMediaPhoto
:- moved the
caption
into the superclass. - fixed
parse_mode
not working infrom_array(...)
- moved the
InputMediaVideo
:- moved the
caption
into the superclass. - fixed
parse_mode
not working infrom_array(...)
- added
thumb
parameter.
- moved the
- Added new
InputMediaAnimation
. - Added new
InputMediaAudio
. - Added new
InputMediaDocument
.
api_types.receivable.passport
:- Added, see above.
bot.Bot
:- Added
thumb
parameter tosend_audio(...)
,send_video(...)
,send_video_note(...)
andsend_video_note(...)
. - Added
foursquare_type
parameter tosend_venue(...)
. - Added
vcard
parameter tosend_contact(...)
. - Added new
send_animation(...)
function. - Added new
edit_message_media(...)
function. - Added new
set_passport_data_errors(...)
function.
- Added
- Documentation changes:
bot.Bot.set_webhook
: Returns True, only on success.bot.Bot.send_media_group
: Instead of genericInputMedia
, now only acceptsInputMediaPhoto
orInputMediaVideo
api_types.sendable.reply_markup.InlineKeyboardButton
can now usetg://
urls, too.
- Added Telegram Passport
- Also, while at it
- Fixed
'live_period' in inlinequeryresultlocation_instance
wrongly returningFalse
- Fixed
InputFileFromBlob
andInputFileFromURL
: Reworked that wholeInputFile
piece, which should fix #6. - Fixed
certificate
argument inBot.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 toInputMedia
, to allow sending easier. Is very similar toInputFile.get_request_files(...)
. - Fixed
Bot.send_media_group(...)
now supportingInputMediaPhoto
andInputMediaVideo
elements, so sending files is actually possible. - Fixed
Bot.edit_message_media(...)
now supportingInputMedia
elements, so sending files is actually possible.
- Fixed
Bot API 3
.6
(February 13, 2018)- Added
connected_website
attribute to theUpdate
class.
- Added
- Added
parse_mode
attribute all stuff that has captions, in the bot functions and the sendable inline objects. - Also added
supports_streaming
toBot.send_video(...)
andsendable.inputmedia.InputMediaVideo
.
- Added
username
andid
property to theBot
class. This is basically the implementation used in Teleflask already, but calling itid
and notuser_id
as it is a bot, not a user. - Added
__str__
class, so thatstr(bot)
displays asBot(username="luckybot", id=108721382)
- Fixed
InputFileFromDisk
. - Usage of
InputFile
withfile_blob
is now deprecated. UseInputFileFromBlob
instead.
Updated official API changes of
- Removed doubled
WebhookInfo
classes at two different places. They are now the same. - Fixed importing
Message
inpytgbot.api_types.receivable.peer.Chat
.
- 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
- but
- Added new fields:
- Updated Official API changes of
Bot API 3
.2
(July 21, 2017)- Stickers'n'stuff
- fixed
send_video_note
,send_video
,send_voice
,set_chat_photo
ofpytgbot.bot.Bot
.
- 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, addeduntil_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.
- Added new functions:
- Also now storing the incoming (decoded json) data in the
_raw
field of the object.
- 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 newlanguage_code
field. - Updated
pytgbot.api_types.receivable.updates.Update
to include the newshipping_query
andpre_checkout_query
fields. - Updated
pytgbot.api_types.receivable.updates.Message
to include the newvideo_note
,new_chat_members
,invoice
andsuccessful_payment
fields. - Added
pytgbot.api_types.receivable.updates.WebhookInfo
- Updated
pytgbot.api_types.sendable.inline.InlineQueryResultGif
to include the newgif_duration
field. - Updated
pytgbot.api_types.sendable.inline.InlineQueryResultMpeg4Gif
to include the newmpeg4_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 newpay
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.
- Added
- Updated Official API changes of
Bot API 2
.3
.1
(December 4, 2016)
- Fixed failed version bump, which causing importing this package impossible.
- This is not Telegram
Bot API 2.3.1
! - This version doesn't work. Use
2.3.2
instead. - Fixed InlineQueryResultCachedSticker.
- Updated API changes of
Bot API 2.3
(November 21, 2016)
Changes I observed:
Bot
answer_callback_query
: addedcache_time
edit_message_text
: works for game messages too.set_game_score
: addedforce
set_game_score
: addeddisable_edit_message
set_game_score
: removededit_message
set_game_score
:score
can be0
. Now must be non-negative, before it must be postive.Classes:
updates.Update
: addedchannel_post
updates.Update
: addededited_channel_post
updates.Message
: addedforward_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.
Bugfix release
Version 2.2.1a4
- Fixed importing of
Game
inUpdate.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
- Moving
InputFile
,InputFileFromDisk
,InputFileFromURL
toapi_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.
- Reworked
InputFile
,InputFileFromDisk
,InputFileFromURL
internals. They now should handle input better. #3,luckydonald/bonbot
#131
- Fix: Also catching
TgApiException
s ifget_updates(..., error_as_empty=True)
- Renamed
get_updates(...)
'stimeout
parameter topoll_timeout
. - Added
request_timeout
todo(...)
method. Currently onlyget_updates(...)
has that.
- Renamed
pytgbot.api_types.receivable.media.File.download_url(token)
toget_download_url(token)
- Added a
pytgbot.bot.Bot.get_download_url(file)
method.
- Renamed
InputFileURL
toInputFileFromURL
- Added
InputFileFromDisk
InputFile
is for buffers (strings) now
Big overhaul:
- Real Objects for everything.
- Also most of this module can now be generated from the api website automatically, making updates a breeze.
- Added ability to ignore network errors in
get_updates(...)
without raising a exception by settingerror_as_empty=True
. Useful infor update in bot.get_updates(error_as_empty=True)
constructs.
- Added Inline mode including inlinefeedback.
This should be
Bot API 2.0
(April 9, 2016).
- First implementation