have implemented a bot with InlineKeyboard and added allow_reentry=True option to make it possible to subscribe at the top and at the bottom. The problem is that I use user_data. Sadly, but user_data is common for all handlers and if I will work with two wizards, they both will be broken.
How can I make a separate user_data for unique instances of ConversationHandler? Thank you
I guess you have unique conversation (entry) handlers?
No, the same (that’s why I have added allow_reenrtry)
what do you need different user_data for then if its all in one conversation handler?
Yes, because for me (and for users) it’s two instances I don’t want to mix user_data for instances - it will break my bot
wait now you lost me, you have two instances of code running behind one bot (token)?
Two instances of one Conversation I did it because user may start conversation, forget about it and start it again But it will not started with allow_reentry=False With allow_reentry=True, it will be started, but user_data will be mixed with old data
> With allow_reentry=True, it will be started, but user_data will be mixed with old data But if you reenter the conversation, you don't have the old states. You are back at the entry callback/its return state. So you don't have two instances of conversations, or?
But user may return to previous conversation and in that case it will be broken
In your entry point of the ConversationHandler reset the respective users data and starts from the blank dict
But old Conversation will still work and will not be turned off So with that step (which I use for now) I reduced a risk of bug, but didn’t excluded
» Old conversation will still work 🙄 Old state only will be active till the user got a reentry Once your entry point handler executed again with allow_reentry=True then previous States will be removed.
Обсуждают сегодня