8000 CallbackQueryHandler to support filtering game_short_name · Issue #4269 · python-telegram-bot/python-telegram-bot · GitHub
[go: up one dir, main page]

Skip to content
CallbackQueryHandler to support filtering game_short_name #4269
@jainamoswal

Description

@jainamoswal

What kind of feature are you missing? Where do you notice a shortcoming of PTB?

Currently, the CallbackQueryHandler in the library only checks the .data attribute when handling callback queries (ref). This presents a limitation as it doesn't support regex filtering handling clicks on buttons associated with CallbackGame. When a user clicks on a CallbackGame button, the .data attribute is None, causing the CallbackQueryHandler's regex pattern match to fail if it is set.

Describe the solution you'd like

I think changing this line to

callback_data = update.callback_query.data or update.callback_query.game_short_name

would solve this limitation.

Describe alternatives you've considered

Currently I manage to overcome this by handling all callbacks in one handler without pattern match and then using if else with .game_short_name attribute

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0