Skip to content

refactor: Update telegram filters import and usage syntax#5634

Merged
matiasb merged 1 commit intografana:devfrom
ckaytev:fix-telegram-filters
Feb 11, 2026
Merged

refactor: Update telegram filters import and usage syntax#5634
matiasb merged 1 commit intografana:devfrom
ckaytev:fix-telegram-filters

Conversation

@ckaytev
Copy link
Contributor

@ckaytev ckaytev commented Feb 2, 2026

What this PR does

Fix syntax for python-telegram-bot imports after upgrade to 20.0+ version

See release notes for python-telegram-bot 20.0

  1. Removed the Filters class. The filters are now directly attributes/classes of the filters module.
  2. The names of all filters has been updated:
  • Filter classes which are ready for use, e.g Filters.all are now capitalized, e.g filters.ALL.
  • Filters which need to be initialized are now in CamelCase. E.g. filters.User(...).
  • Filters which do both (like Filters.text) are now split as ready-to-use version filters.TEXT and class version filters.Text(...).

Without this change, the logs of the telegram‑polling container show the following error:

ImportError: cannot import name 'Filters' from 'telegram.ext' (/usr/local/lib/python3.12/site-packages/telegram/ext/__init__.py). Did you mean: 'filters'?

@ckaytev ckaytev requested a review from a team as a code owner February 2, 2026 06:13
@ckaytev ckaytev requested review from the-it and twu February 2, 2026 06:13
@CLAassistant
Copy link

CLAassistant commented Feb 2, 2026

CLA assistant check
All committers have signed the CLA.

Signed-off-by: ckaytev <anton-ckayt@mail.ru>
@matiasb matiasb force-pushed the fix-telegram-filters branch from 90602e5 to 1a33108 Compare February 11, 2026 14:10
@matiasb matiasb added pr:no public docs Added to a PR that does not require public documentation updates release:patch PR will be added to "Other Changes" section of release notes labels Feb 11, 2026
Copy link
Contributor

@matiasb matiasb left a comment

Choose a reason for hiding this comment

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

Thanks!

@matiasb matiasb added this pull request to the merge queue Feb 11, 2026
Merged via the queue into grafana:dev with commit ec1cebe Feb 11, 2026
42 of 46 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:no public docs Added to a PR that does not require public documentation updates release:patch PR will be added to "Other Changes" section of release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants