Skip to content

fix(asyncio): use asyncio StateContext in StateMiddleware - #2633

Merged
Badiboy merged 1 commit into
eternnoir:masterfrom
juancabe:fix/async-state-middleware
Oct 15, 2026
Merged

Badiboy merged 1 commit into
eternnoir:masterfrom
juancabe:fix/async-state-middleware

Conversation

@juancabe

Copy link
Copy Markdown
Contributor

Replaces #2631 (as requested by @Badiboy).

Description

In telebot/states/asyncio/middleware.py, StateMiddleware was importing StateContext from telebot.states.sync.context instead of telebot.states. asyncio.context.

This PR only includes the fix in telebot/states/asyncio/middleware.py without extra tests.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The targeted import correction matches the asynchronous middleware contract, with no unresolved issues.

0 open findings

What changed in this PR

Corrects the state context injected by asynchronous middleware into async bot handlers.

Changes:

  • Imports StateContext from the asyncio module instead of the synchronous module.
  • Keeps the replacement PR limited to the import fix, without additional tests.
File Description
telebot/​states/​asyncio/​middleware.py Uses the asynchronous StateContext.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@Badiboy

Badiboy commented Oct 15, 2026

Copy link
Copy Markdown
Collaborator

Thank you!

@Badiboy
Badiboy merged commit 9a55e2b into eternnoir:master Oct 15, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants