Changelog¶
0.2.0 (2026-10-28)¶
Breaking¶
HandlerRegistryandCommandHandler.register(...)replaced by decorators:@command_handler,@message_handler,@callback_handler,@inline_handler,@chosen_handler. Import them, and the handler classes, fromdj_telegram_bot.core.handlers. The routing code (core/routing.py) is internal- Maintenance mode and blocked-user checks no longer run automatically. Register them with
@before_handler is_user_block()replies only withnotify_user=Truectx.userisNonefor channel posts. Usectx.senderChosenInlineResultHandler.queryrenamed tochosen_query- Access guards (
sponsor_required,SponsorGuard, and the newstaff_requiredandsuperuser_required) live indj_telegram_bot.core.guards.sponsor_requiredused to be incontrib.decorators - Link previews are disabled by default in
send_message - New users get their Telegram id as password (was unusable)
business_connection_idmoved after the main parameters in the business and edit methods (edit_message_textis nowchat_id, message_id, text). Use keyword arguments
See the migration guide.
Added¶
- One import path: handler classes, all route decorators and
@before_handlercome fromdj_telegram_bot.core.handlers UpdateHandler: one class with every member of every update type, to inherit from in class handlers. Each update type also has its own class (CommandHandler,MessageHandler,CallBackQueryHandler,InlineQueryHandler,ChosenInlineResultHandler) with only its own members.@before_handlerfor pre-routing checks, as functions or class methods; registering a function twice is ignored. See Before handlers- Optional user model: any model with
user_idandstepworks, andTelegramUserMixin.get_or_create_telegram_user()customizes creation. See User model ctx.sender,ctx.has_started_bot,ctx.chosenSponsorGuard.ensure_joined(), usable in a before handler for every update@staff_requiredand@superuser_required- Step handlers:
@message_step_handler,@callback_step_handler, andset_step() - Wildcard triggers with
priority ChosenInlineResultHandlerand@chosen_handler- Channel post support
- Inline queries and inline callbacks in the sponsor check. Customize the answers with
@sponsor_required(on_inline=..., on_callback=...) switch_inline_query_current_chatin the keyboard builder- Telegram Bot API updates: February to July 2026, up to 10.3
Changed¶
- Database users are created only in private chats; elsewhere they are only looked up. The
typingchat action in groups is gone - Maintenance mode applies to private chats only
- The sponsor check is skipped in groups and channels
AUTH_USER_MODELis optional; the startup check forTelegramUserMixinis removed- Membership logic moved into
SponsorGuard;enforce()stays as an alias ofensure_joined()
Fixed¶
- Callbacks from inline messages
- Chat and user resolution for inline and group updates
- File name used for cover uploads
- Shared mutable default in
_add_file
0.1.4¶
Last release before the router rewrite.