Changelog#
3.0.0b8 [UNRELEASED DRAFT] (2023-03-11)#
Improved Documentation#
Changed small grammar typos for upload_file #1133
Misc#
Added full support of Bot API 6.6
Danger
Note that this issue has breaking changes described in in the Bot API changelog, this changes is not breaking in the API but breaking inside aiogram because Beta stage is not finished.
Added global defaults disable_web_page_preview and protect_content in addition to parse_mode to the Bot instance, reworked internal request builder mechanism. #1142
3.0.0b7 (2023-02-18)#
Warning
Note that this version has incompatibility with Python 3.8-3.9 in case when you create an instance of Dispatcher outside of the any coroutine.
Sorry for the inconvenience, it will be fixed in the next version.
This code will not work:
dp = Dispatcher()
def main():
...
dp.run_polling(...)
main()
But if you change it like this it should works as well:
router = Router()
async def main():
dp = Dispatcher()
dp.include_router(router)
...
dp.start_polling(...)
asyncio.run(main())
Features#
Added missing shortcuts, new enums, reworked old stuff
Breaking All previously added enums is re-generated in new place - aiogram.enums instead of aiogram.types
- Added enums:
aiogram.enums.bot_command_scope_type.BotCommandScopeType
, aiogram.enums.chat_action.ChatAction
,aiogram.enums.chat_member_status.ChatMemberStatus
,aiogram.enums.chat_type.ChatType
,aiogram.enums.content_type.ContentType
,aiogram.enums.dice_emoji.DiceEmoji
,aiogram.enums.inline_query_result_type.InlineQueryResultType
,aiogram.enums.input_media_type.InputMediaType
,aiogram.enums.mask_position_point.MaskPositionPoint
,aiogram.enums.menu_button_type.MenuButtonType
,aiogram.enums.message_entity_type.MessageEntityType
,aiogram.enums.parse_mode.ParseMode
,aiogram.enums.poll_type.PollType
,aiogram.enums.sticker_type.StickerType
,aiogram.enums.topic_icon_color.TopicIconColor
,aiogram.enums.update_type.UpdateType
,
Added shortcuts:
- Chat
aiogram.types.chat.Chat.get_administrators()
, aiogram.types.chat.Chat.delete_message()
,aiogram.types.chat.Chat.revoke_invite_link()
,aiogram.types.chat.Chat.edit_invite_link()
,aiogram.types.chat.Chat.create_invite_link()
,aiogram.types.chat.Chat.export_invite_link()
,aiogram.types.chat.Chat.do()
,aiogram.types.chat.Chat.delete_sticker_set()
,aiogram.types.chat.Chat.set_sticker_set()
,aiogram.types.chat.Chat.get_member()
,aiogram.types.chat.Chat.get_member_count()
,aiogram.types.chat.Chat.leave()
,aiogram.types.chat.Chat.unpin_all_messages()
,aiogram.types.chat.Chat.unpin_message()
,aiogram.types.chat.Chat.pin_message()
,aiogram.types.chat.Chat.set_administrator_custom_title()
,aiogram.types.chat.Chat.set_permissions()
,aiogram.types.chat.Chat.promote()
,aiogram.types.chat.Chat.restrict()
,aiogram.types.chat.Chat.unban()
,aiogram.types.chat.Chat.ban()
,aiogram.types.chat.Chat.set_description()
,aiogram.types.chat.Chat.set_title()
,aiogram.types.chat.Chat.delete_photo()
,aiogram.types.chat.Chat.set_photo()
,
- Chat
- Added enums:
Added callback answer feature #1091
Added a method that allows you to compactly register routers #1117
Bugfixes#
Check status code when downloading file #816
Fixed ignore_case parameter in
aiogram.filters.command.Command
filter #1106
Misc#
Added integration with new code-generator named Butcher #1069
Added full support of Bot API 6.4 #1088
Updated package metadata, moved build internals from Poetry to Hatch, added contributing guides. #1095
Added full support of Bot API 6.5
Danger
Note that
aiogram.types.chat_permissions.ChatPermissions
is updated without backward compatibility, so now this object has nocan_send_media_messages
attributeReplaced error
TypeError: TelegramEventObserver.__call__() got an unexpected keyword argument '<name>'
with a more understandable one for developers and with a link to the documentation. #1114Added possibility to reply into webhook with files #1120
Reworked graceful shutdown. Added method to stop polling. Now polling started from dispatcher can be stopped by signals gracefully without errors (on Linux and Mac). #1124
3.0.0b6 (2022-11-18)#
Features#
(again) Added possibility to combine filters with an and/or operations.
Read more in “Combining filters” documentation section #1018
Added following methods to
Message
class:Message.forward(...)
Message.edit_media(...)
Message.edit_live_location(...)
Message.stop_live_location(...)
Message.pin(...)
Message.unpin()
Added following methods to
User
class:User.mention_markdown(...)
User.mention_html(...)
Added full support of Bot API 6.3 #1057
Bugfixes#
Improved Documentation#
Misc#
Enabled testing on Python 3.11 #1044
Added a mandatory dependency
certifi
in due to in some cases on systems that doesn’t have updated ca-certificates the requests to Bot API fails with reason[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain
#1066
3.0.0b5 (2022-10-02)#
Features#
Add PyPy support and run tests under PyPy #985
Added message text to aiogram exceptions representation #988
Added warning about using magic filter from magic_filter instead of aiogram’s ones. Is recommended to use from aiogram import F instead of from magic_filter import F #990
Added more detailed error when server response can’t be deserialized. This feature will help to debug unexpected responses from the Server #1014
Bugfixes#
Reworked error event, introduced
aiogram.types.error_event.ErrorEvent
object. #898Fixed escaping markdown in aiogram.utils.markdown module #903
Fixed polling crash when Telegram Bot API raises HTTP 429 status-code. #995
Fixed empty mention in command parsing, now it will be None instead of an empty string #1013
Improved Documentation#
Initialized Docs translation (added Ukrainian language) #925
Deprecations and Removals#
Removed filters factory as described in corresponding issue. #942
Misc#
Now Router/Dispatcher accepts only keyword arguments. #982
3.0.0b4 (2022-08-14)#
Features#
Add class helper ChatAction for constants that Telegram BotAPI uses in sendChatAction request. In my opinion, this will help users and will also improve compatibility with 2.x version where similar class was called “ChatActions”. #803
Added possibility to combine filters or invert result
Example:
Text(text="demo") | Command(commands=["demo"]) MyFilter() & AnotherFilter() ~StateFilter(state='my-state')
Fixed type hints for redis TTL params. #922
Added full_name shortcut for Chat object #929
Bugfixes#
Fixed false-positive coercing of Union types in API methods #901
Added 3 missing content types:
proximity_alert_triggered
supergroup_chat_created
channel_chat_created
Fixed the ability to compare the state, now comparison to copy of the state will return True. #927
Fixed default lock kwargs in RedisEventIsolation. #972
Misc#
Restrict including routers with strings #896
Changed CommandPatterType to CommandPatternType in aiogram/dispatcher/filters/command.py #907
Added full support of Bot API 6.1 #936
Breaking! More flat project structure
These packages was moved, imports in your code should be fixed:
aiogram.dispatcher.filters
->aiogram.filters
aiogram.dispatcher.fsm
->aiogram.fsm
aiogram.dispatcher.handler
->aiogram.handler
aiogram.dispatcher.webhook
->aiogram.webhook
aiogram.dispatcher.flags/*
->aiogram.dispatcher.flags
(single module instead of package)
Removed deprecated
router.<event>_handler
androuter.register_<event>_handler
methods. #941Deprecated filters factory. It will be removed in next Beta (3.0b5) #942
MessageEntity method get_text was removed and extract was renamed to extract_from #944
Added full support of Bot API 6.2 #975
3.0.0b3 (2022-04-19)#
Features#
Added possibility to get command magic result as handler argument #889
Added full support of Telegram Bot API 6.0 #890
Bugfixes#
Misc#
Added automated check that pull-request adds a changes description to CHANGES directory #873
Changed
Message.html_text
andMessage.md_text
attributes behaviour when message has no text. The empty string will be used instead of raising error. #874Used redis-py instead of aioredis package in due to this packages was merged into single one #882
Solved common naming problem with middlewares that confusing too much developers - now you can’t see the middleware and middlewares attributes at the same point because this functionality encapsulated to special interface. #883
3.0.0b2 (2022-02-19)#
Features#
Added possibility to pass additional arguments into the aiohttp webhook handler to use this arguments inside handlers as the same as it possible in polling mode. #785
Added possibility to add handler flags via decorator (like pytest.mark decorator but aiogram.flags) #836
Added
ChatActionSender
utility to automatically sends chat action while long process is running.It also can be used as message middleware and can be customized via
chat_action
flag. #837
Bugfixes#
Misc#
3.0.0b1 (2021-12-12)#
Features#
Added new custom operation for MagicFilter named
as_
Now you can use it to get magic filter result as handler argument
from aiogram import F ... @router.message(F.text.regexp(r"^(\d+)$").as_("digits")) async def any_digits_handler(message: Message, digits: Match[str]): await message.answer(html.quote(str(digits))) @router.message(F.photo[-1].as_("photo")) async def download_photos_handler(message: Message, photo: PhotoSize, bot: Bot): content = await bot.download(photo)
Bugfixes#
Fixed: Missing
ChatMemberHandler
import inaiogram/dispatcher/handler
#751
Misc#
Check
destiny
in case of nowith_destiny
enabled in RedisStorage key builder #776Added full support of Bot API 5.5 #777
Stop using feature from #336. From now settings of client-session should be placed as initializer arguments instead of changing instance attributes. #778
Make TelegramAPIServer files wrapper in local mode bi-directional (server-client, client-server) Now you can convert local path to server path and server path to local path. #779
3.0.0a18 (2021-11-10)#
Features#
Breaking: Changed the signature of the session middlewares Breaking: Renamed AiohttpSession.make_request method parameter from call to method to match the naming in the base class Added middleware for logging outgoing requests #716
Improved description of filters resolving error. For example when you try to pass wrong type of argument to the filter but don’t know why filter is not resolved now you can get error like this:
aiogram.exceptions.FiltersResolveError: Unknown keyword filters: {'content_types'} Possible cases: - 1 validation error for ContentTypesFilter content_types Invalid content types {'42'} is not allowed here (type=value_error)
Breaking internal API change Reworked FSM Storage record keys propagation #723
Implemented new filter named
MagicData(magic_data)
that helps to filter event by data from middlewares or other filtersFor example your bot is running with argument named
config
that contains the application config then you can filter event by value from this config:@router.message(magic_data=F.event.from_user.id == F.config.admin_id) ...
Bugfixes#
Misc#
Enabled testing on Python 3.10 Removed async_lru dependency (is incompatible with Python 3.10) and replaced usage with protected property #719
Converted README.md to README.rst and use it as base file for docs #725
Rework filters resolving:
Automatically apply Bound Filters with default values to handlers
Fix data transfer from parent to included routers filters
Added full support of Bot API 5.4 https://core.telegram.org/bots/api-changelog#november-5-2021 #744
3.0.0a17 (2021-09-24)#
Misc#
3.0.0a16 (2021-09-22)#
Features#
Misc#
Covered by tests and docs KeyboardBuilder util #699
Breaking!!!. Refactored and renamed exceptions.
Exceptions module was moved from
aiogram.utils.exceptions
toaiogram.exceptions
Added prefix Telegram for all error classes
Replaced all
pragma: no cover
marks via global.coveragerc
config #702Updated dependencies.
Breaking for framework developers Now all optional dependencies should be installed as extra: poetry install -E fast -E redis -E proxy -E i18n -E docs #703
3.0.0a15 (2021-09-10)#
Features#
Ability to iterate over all states in StatesGroup. Aiogram already had in check for states group so this is relative feature. #666
Bugfixes#
Fixed incorrect type checking in the
aiogram.utils.keyboard.KeyboardBuilder
#674
Misc#
3.0.0a14 (2021-08-17)#
Features#
Bugfixes#
Prepare parse mode for InputMessageContent in AnswerInlineQuery method #660
Improved Documentation#
Added integration with
towncrier
#602
Misc#
2.14.3 (2021-07-21)#
2.14.2 (2021-07-26)#
2.14 (2021-07-27)#
Fixed
Message.send_copy
method for polls (#603)Updated pattern for
GroupDeactivated
exception (#549Added
caption_entities
field inInputMedia
base class (#583)Fixed HTML text decorations for tag
pre
(#597 fixes issues #596 and #481)Fixed
Message.get_full_command
method for messages with caption (#576)Improved
MongoStorage
: remove documents with empty data fromaiogram_data
collection to save memory. (#609)
2.13 (2021-04-28)#
Added full support of Bot API 5.2 (#572)
Fixed usage of
provider_data
argument insendInvoice
method callAllowed to use State instances FSM storage directly (#542)
Added possibility to get i18n locale without User instance (#546)
Fixed returning type of
Bot.*_chat_invite_link()
methods #548 (#549)Fixed deep-linking util (#569)
Small changes in documentation - describe limits in docstrings corresponding to the current limit. (#565)
Fixed internal call to deprecated ‘is_private’ method (#553)
Added possibility to use
allowed_updates
argument in Polling mode (#564)
2.12.1 (2021-03-22)#
Fixed
TypeError: Value should be instance of 'User' not 'NoneType'
(#527)Added missing
Chat.message_auto_delete_time
field (#535)Added
MediaGroup
filter (#528)Added
Chat.delete_message
shortcut (#526)Added mime types parsing for
aiogram.types.Document
(#431)Added warning in
TelegramObject.__setitem__
when Telegram adds a new field (#532)Fixed
examples/chat_type_filter.py
(#533)Removed redundant definitions in framework code (#531)
2.12 (2021-03-14)#
Full support for Telegram Bot API 5.1 (#519)
Fixed sending playlist of audio files and documents (#465, #468)
Fixed
FSMContextProxy.setdefault
method (#491)Fixed
Message.answer_location
andMessage.reply_location
unable to send live location (#497)Fixed
user_id
andchat_id
getters from the context at Dispatchercheck_key
,release_key
andthrottle
methods (#520)Fixed
Chat.update_chat
method and all similar situations (#516)Fixed
MediaGroup
attach methods (#514)Fixed state filter for inline keyboard query callback in groups (#508, #510)
Added missing
ContentTypes.DICE
(#466)Added missing vcard argument to
InputContactMessageContent
constructor (#473)Add missing exceptions:
MessageIdInvalid
,CantRestrictChatOwner
andUserIsAnAdministratorOfTheChat
(#474, #512)Added
answer_chat_action
to theMessage
object (#501)Added dice to
message.send_copy
method (#511)Removed deprecation warning from
Message.send_copy
Added an example of integration between externally created aiohttp Application and aiogram (#433)
Added
split_separator
argument tosafe_split_text
(#515)Fixed some typos in docs and examples (#489, #490, #498, #504, #514)
2.11.2 (2021-11-10)#
Fixed default parse mode
Added missing “supports_streaming” argument to answer_video method #462
2.11.1 (2021-11-10)#
2.11 (2021-11-08)#
Added full support of Telegram Bot API 5.0 (#454)
- Added possibility to more easy specify custom API Server (example)
WARNING: API method
close
was named in Bot class as close_bot in due to Bot instance already has method with the same name. It will be changed inaiogram 3.0
Added alias to Message object
Message.copy_to
with deprecation ofMessage.send_copy
ChatType.SUPER_GROUP
renamed toChatType.SUPERGROUP
(#438)
2.10.1 (2021-09-14)#
Fixed critical bug with getting asyncio event loop in executor. (#424)
AttributeError: 'NoneType' object has no attribute 'run_until_complete'
2.10 (2021-09-13)#
Breaking change: Stop using _MainThread event loop in bot/dispatcher instances (#397)
Fixed: TelegramObject’s aren’t destroyed after update handling #307 (#371)
Add setting current context of Telegram types (#369)
Fixed markdown escaping issues (#363)
Fixed HTML characters escaping (#409)
Fixed italic and underline decorations when parse entities to Markdown
Added missing thumb parameter (#362)
Added public methods to register filters and middlewares (#370)
Added ChatType builtin filter (#356)
Fixed IDFilter checking message from channel (#376)
Added missed answer_poll and reply_poll (#384)
Added possibility to ignore message caption in commands filter (#383)
Fixed addStickerToSet method
Added preparing thumb in send_document method (#391)
Added exception MessageToPinNotFound (#404)
Fixed handlers parameter-spec solving (#408)
Fixed CallbackQuery.answer() returns nothing (#420)
CHOSEN_INLINE_RESULT is a correct API-term (#415)
Fixed missing attributes for Animation class (#422)
Added missed emoji argument to reply_dice (#395)
Added is_chat_creator method to ChatMemberStatus (#394)
Added missed ChatPermissions to __all__ (#393)
Added is_forward method to Message (#390)
Fixed usage of deprecated is_private function (#421)
and many others documentation and examples changes:
Updated docstring of RedisStorage2 (#423)
Updated I18n example (added docs and fixed typos) (#419)
A little documentation revision (#381)
Added comments about correct errors_handlers usage (#398)
Fixed typo rexex -> regex (#386)
Fixed docs Quick start page code blocks (#417)
fixed type hints of callback_data (#400)
Prettify readme, update downloads stats badge (#406)
2.9.2 (2021-06-13)#
2.9 (2021-06-08)#
Added full support of Telegram Bot API 4.9
Fixed user context at poll_answer update (#322)
Fix Chat.set_description (#325)
Add lazy session generator (#326)
Fix missing
InlineQueryResultPhoto
parse_mode
field (#331)Fix fields from parent object in
KeyboardButton
(#344 fixes #343)Add possibility to get bot id without calling
get_me
(#296)
2.8 (2021-04-26)#
Added full support of Bot API 4.8
Added
Message.answer_dice
andMessage.reply_dice
methods (#306)
2.7 (2021-04-07)#
2.6.1 (2021-01-25)#
2.6 (2021-01-23)#
2.5.3 (2021-01-05)#
2.5.2 (2021-01-01)#
Get back
quote_html
andescape_md
functions
2.5.1 (2021-01-01)#
Hot-fix of
CommandStart
filter
2.5 (2021-01-01)#
#239 Fixed
check_token
method#248 Fixed support of aiohttp-socks
Updated setup.py. No more use of internal pip API
Updated links to documentations (https://docs.aiogram.dev)
Other small changes and minor improvements (#223 and others…)
2.4 (2021-10-29)#
Added Message.send_copy method (forward message without forwarding)
Safe close of aiohttp client session (no more exception when application is shutdown)
No more “adWanced” words in project #209
Arguments user and chat is renamed to user_id and chat_id in Dispatcher.throttle method #196
Fixed set_chat_permissions #198
Fixed Dispatcher polling task does not process cancellation #199, #201
Fixed compatibility with latest asyncio version #200
Disabled caching by default for lazy_gettext method of I18nMiddleware #203
Fixed HTML user mention parser #205
Added IsReplyFilter #210
Fixed send_poll method arguments #211
Added OrderedHelper #215
Fix incorrect completion order. #217
2.3 (2021-08-16)#
Full support of Telegram Bot API 4.4
Fixed #143
Added expire argument to RedisStorage2 and other storage fixes #145
Fixed JSON and Pickle storages #138
Implemented MongoStorage #153 based on aiomongo (soon motor will be also added)
Improved tests
Updated examples
Warning: Updated auth widget util. #190
Implemented throttle decorator #181
2.2 (2021-06-09)#
2.1 (2021-04-18)#
Implemented all new features from Telegram Bot API 4.2
is_member
andis_admin
methods ofChatMember
andChatMemberStatus
was renamed tois_chat_member
andis_chat_admin
Remover func filter
Added some useful Message edit functions (
Message.edit_caption
,Message.edit_media
,Message.edit_reply_markup
) (#121, #103, #104, #112)Added requests timeout for all methods (#110)
Added
answer*
methods toMessage
object (#112)Maked some improvements of
CallbackData
factoryAdded deep-linking parameter filter to
CommandStart
filterImplemented logging filter for extending LogRecord attributes (Will be usefull with external logs collector utils like GrayLog, Kibana and etc.)
Updated
requirements.txt
anddev_requirements.txt
filesOther small changes and minor improvements
2.0.1 (2021-12-31)#
2.0 (2021-10-28)#
This update will break backward compability with Python 3.6 and works only with Python 3.7+: - contextvars (PEP-567); - New syntax for annotations (PEP-563).
Changes:
- Used contextvars instead of aiogram.utils.context
;
- Implemented filters factory;
- Implemented new filters mechanism;
- Allowed to customize command prefix in CommandsFilter;
- Implemented mechanism of passing results from filters (as dicts) as kwargs in handlers (like fixtures in pytest);
- Implemented states group feature;
- Implemented FSM storage’s proxy;
- Changed files uploading mechanism;
- Implemented pipe for uploading files from URL;
- Implemented I18n Middleware;
- Errors handlers now should accept only two arguments (current update and exception);
- Used aiohttp_socks
instead of aiosocksy
for Socks4/5 proxy;
- types.ContentType was divided to types.ContentType
and types.ContentTypes
;
- Allowed to use rapidjson instead of ujson/json;
- .current()
method in bot and dispatcher objects was renamed to get_current()
;
Full changelog - You can read more details about this release in migration FAQ: https://aiogram.readthedocs.io/en/latest/migration_1_to_2.html
1.4 (2021-08-03)#
Bot API 4.0 (#57)
1.3.3 (2021-07-16)#
Fixed markup-entities parsing;
Added more API exceptions;
Now InlineQueryResultLocation has live_period;
Added more message content types;
Other small changes and minor improvements.
1.3.2 (2021-05-27)#
Fixed crashing of polling process. (i think)
Added parse_mode field into input query results according to Bot API Docs.
Warning: disabled connections limit for bot aiohttp session.
Warning: Destroyed “temp sessions” mechanism.
Added new error types.
Refactored detection of error type.
Small fixes of executor util.
Fixed RethinkDBStorage
1.3.1 (2018-05-27)#
1.3 (2021-04-22)#
Allow to use Socks5 proxy (need manually install
aiosocksy
).Refactored
aiogram.utils.executor
module.[Warning] Updated requirements list.
1.2.3 (2018-04-14)#
Fixed API errors detection
Fixed compability of
setup.py
with pip 10.0.0
1.2.2 (2018-04-08)#
Added more error types.
Implemented method
InputFile.from_url(url: str)
for downloading files.Implemented big part of API method tests.
Other small changes and mminor improvements.
1.2.1 (2018-03-25)#
1.2 (2018-02-23)#
Full provide Telegram Bot API 3.6
Fixed critical error:
Fatal Python error: PyImport_GetModuleDict: no module dictionary!
Implemented connection pool in RethinkDB driver
Typo fixes of documentstion
Other bug fixes and minor improvements.
1.1 (2018-01-27)#
Added more methods for data types (like
message.reply_sticker(...)
orfile.download(...)
Typo fixes of documentstion
Allow to set default parse mode for messages (
Bot( ... , parse_mode='HTML')
)Allowed to cancel event from the
Middleware.on_pre_process_<event type>
Fixed sending files with correct names.
Fixed MediaGroup
Added RethinkDB storage for FSM (
aiogram.contrib.fsm_storage.rethinkdb
)
1.0.4 (2018-01-10)#
1.0.3 (2018-01-07)#
Added middlewares mechanism.
Added example for middlewares and throttling manager.
Added logging middleware (
aiogram.contrib.middlewares.logging.LoggingMiddleware
)Fixed handling errors in async tasks (marked as ‘async_task’)
Small fixes and other minor improvements.
1.0.2 (2017-11-29)#
1.0.1 (2017-11-21)#
Implemented
types.InputFile
for more easy sending local filesDanger! Fixed typo in word pooling. Now whatever all methods with that word marked as deprecated and original methods is renamed to polling. Check it in you’r code before updating!
Fixed helper for chat actions (
types.ChatActions
)Added example for media group.
1.0 (2017-11-19)#
Remaked data types serialozation/deserialization mechanism (Speed up).
Fully rewrited all Telegram data types.
Bot object was fully rewritted (regenerated).
Full provide Telegram Bot API 3.4+ (with sendMediaGroup)
Warning: Now
BaseStorage.close()
is awaitable! (FSM)Fixed compability with uvloop.
More employments for
aiogram.utils.context
.Allowed to disable
ujson
.Other bug fixes and minor improvements.
Migrated from Bitbucket to Github.