Skip to content

[QUESTION] Protected function _update_state #2880

Closed
@rejedai

Description

@rejedai

Issue I am facing

Why is the _update_state function from ConversationHandler protected?

In my context, there is a certain task that should be performed once a week, and send some participants a "pass" for further dialogue.

At the moment I have to make extra queries to the database in order to save the "pass" and check if there is one every time a person writes something.

However, using _update_state after receiving the object via dispatcher greatly simplifies this task.

Are there any problems related to using this function, will it become invalid in future updates and will I have to rewrite this part of the logic?

Traceback to the issue

No response

Related part of your code

def send_pass(context: CallbackContext, users):
    for user in users:
        dispatcher: Dispatcher = context.dispatcher
        conv: ConversationHandler = dispatcher.handlers[0][0]
        conv._update_state(NextStep.NEXT, (user.id, user.id))

Operating System

Linux

Version of Python, python-telegram-bot & dependencies

python-telegram-bot 13.10 (0.3-1-g9c62773)
Bot API 5.6
certifi 2021.10.08
Python 3.9.9 (main, Dec 28 2021, 07:54:03)  [GCC 11.1.0]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions