Closed as not planned
Description
What kind of feature are you missing? Where do you notice a shortcoming of PTB?
Image user stuck in the infinite CH loop without exit
or cancel
buttons. State 1
returns state 2
and state 2
returns state 1
. This is definitely fault of bot developer, but what user should do in this case?
Note: inproper state of user/chat/_data
may also cause problems.
Describe the solution you'd like
I did such hadnler for myself.
async def restart(update: Update, context: CallbackContext, ):
context.user_data.clear()
context.chat_data.clear()
for handler in context.application.handlers[0]:
if isinstance(handler, ConversationHandler):
key = (update.effective_chat.id, update.effective_user.id)
if key in handler._conversations:
del handler._conversations[key]
await update.message.reply_text('Success restarted')
raise ApplicationHandlerStop() # Will prevent logging, clearing and other
Sure using the private state of handler._conversations[key]
is not encouraged but I don't see another solution. I believe any bot should have such command by default just like try / except
blocks.
My request - please review my solution and create prebuild handler inside telegram.ext.handlers package.
Describe alternatives you've considered
No response
Additional context
No response
Metadata
Metadata
Assignees
Labels
No labels