| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Hi. The situation hasn't changed much since you opened #2764: We're still working on asyncio and gathering todos for CH in #2770. Note that it's not clear when we'll have the capacity to tackle #2770. Please either
|
Sorry, something went wrong.
|
Hi. I closed my previous PR. can you please give me a review is my code and PR is okay and I can take another PR? |
Sorry, something went wrong.
Thanks
Not at this point, no. As explained above, we're currently busy with getting the asyncio release ready and overhauling CH not one of the very next todo items.
I highly recomment to first outline your idea & thoughts on implementation in either a new feature request issue or on #2770 for conversation_data. It's highly unlikely that we'll be adding new functionality to CH before putting a lot of thought in how to overhaul it.
TBH I don't see this getting added to the main lib. If you are interested, you cann add a contribution to ptbcontrib instead. |
Sorry, something went wrong.
Okay. I will very wait until you will release a new CH implementation because most likely my implementation will depend on new CH version :)
I think we should do a poll. I see this as an extremely helpful tool. The case below is pretty easy but still makes a code cleaner. It helps to convert This: def target_checkboxes_handler(update: Update, context: CallbackContext):
if context.user_data['target_user'].set_matches(): # If user has matches
context.user_data['target_user'].set_new_matches()
update.message.reply_text(
text=f"Найдено {context.user_data['target_user'].all_matches_count} совпадений.",
reply_markup=keyboards.keyboard_for_show_matches(
len_all_matches=context.user_data['target_user'].all_matches_count,
len_new_matches=context.user_data['target_user'].new_matches_count))
else:
update.message.reply_text(text='No matches', reply_markup=keyboards.remove_keyboard())
return end_conversation(context=context)
context.user_data['last_function'] = None # To prevent "go back" at this state
return 5
To this: def target_checkboxes_handler(update: Update, context: CallbackContext, target_user: TargetUser):
if target_user.set_matches(): # If user has matches
target_user.set_new_matches()
update.message.reply_text(text=f"Найдено {target_user.all_matches_count} совпадений.",
reply_markup=keyboards.keyboard_for_show_matches(
len_all_matches=target_user.all_matches_count,
len_new_matches=target_user.new_matches_count))
else:
update.message.reply_text(text='No matches', reply_markup=keyboards.remove_keyboard())
return end_conversation(context=context)
context.user_data['last_function'] = None # To prevent "go back" at this state
return 5
|
Sorry, something went wrong.
|
can we close due to inactivity / adding it to the TODO for ConvHandler at a later stage? |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Imagine you have such CH:
ch = tg_ext.ConversationHandler( entry_points=[ tg_ext.CommandHandler("start", callback=lambda *args, **kwargs: 0)], states={ 0: [ tg_ext.MessageHandler(filters=tg_ext.Filters.text & ~Filters.regex("cancel"), callback=lambda *args, **kwargs: 1)], 1: [ tg_ext.MessageHandler(filters=tg_ext.Filters.text & ~Filters.regex("cancel"), callback=lambda *args, **kwargs: 2)], 2: [ tg_ext.MessageHandler(filters=tg_ext.Filters.text & ~Filters.regex("cancel"), callback=lambda *args, **kwargs: -1)], }, fallbacks=[ tg_ext.CommandHandler("cancel", callback=lambda *args, **kwargs: -1), ])Here you should apply & ~Filter for every handler in states to prevent catching a cancel command.
But it can be easily avoided by adding a list of handlers that should trigger before any other update.