Refine Filters in examples (#2027)

This commit is contained in:
Bibo-Joshi 2020-07-18 12:17:42 +02:00 committed by GitHub
parent d6f8077a50
commit 2789fd2bff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 15 deletions

View file

@ -130,7 +130,7 @@ def main():
LOCATION: [MessageHandler(Filters.location, location),
CommandHandler('skip', skip_location)],
BIO: [MessageHandler(Filters.text, bio)]
BIO: [MessageHandler(Filters.text & ~Filters.command, bio)]
},
fallbacks=[CommandHandler('cancel', cancel)]

View file

@ -116,13 +116,13 @@ def main():
custom_choice)
],
TYPING_CHOICE: [MessageHandler(Filters.text,
regular_choice)
],
TYPING_CHOICE: [
MessageHandler(Filters.text & ~(Filters.command | Filters.regex('^Done$')),
regular_choice)],
TYPING_REPLY: [MessageHandler(Filters.text,
received_information),
],
TYPING_REPLY: [
MessageHandler(Filters.text & ~(Filters.command | Filters.regex('^Done$')),
received_information)],
},
fallbacks=[MessageHandler(Filters.regex('^Done$'), done)]

View file

@ -58,7 +58,7 @@ def main():
dp.add_handler(CommandHandler("help", help_command))
# on noncommand i.e message - echo the message on Telegram
dp.add_handler(MessageHandler(Filters.text, echo))
dp.add_handler(MessageHandler(Filters.text & ~Filters.command, echo))
# Start the Bot
updater.start_polling()

View file

@ -284,7 +284,7 @@ def main():
states={
SELECTING_FEATURE: [CallbackQueryHandler(ask_for_input,
pattern='^(?!' + str(END) + ').*$')],
TYPING: [MessageHandler(Filters.text, save_input)],
TYPING: [MessageHandler(Filters.text & ~Filters.command, save_input)],
},
fallbacks=[

View file

@ -126,13 +126,13 @@ def main():
custom_choice),
],
TYPING_CHOICE: [MessageHandler(Filters.text,
regular_choice),
],
TYPING_CHOICE: [
MessageHandler(Filters.text & ~(Filters.command | Filters.regex('^Done$')),
regular_choice)],
TYPING_REPLY: [MessageHandler(Filters.text,
received_information),
],
TYPING_REPLY: [
MessageHandler(Filters.text & ~(Filters.command | Filters.regex('^Done$')),
received_information)],
},
fallbacks=[MessageHandler(Filters.regex('^Done$'), done)],