Repository: python-telegram-bot/python-telegram-bot

Issue:
Update examples to be 12.0.0 compliant
Like the title says. The examples should in time be updated to reflect the deprecations from 12.0.0.
An example is the RegexHandler used in the conversation bots.  


Discussion:

Resolving patch:
diff --git a/examples/conversationbot.py b/examples/conversationbot.py
--- a/examples/conversationbot.py
+++ b/examples/conversationbot.py
@@ -21,7 +21,7 @@
 import logging
 
 from telegram import (ReplyKeyboardMarkup, ReplyKeyboardRemove)
-from telegram.ext import (Updater, CommandHandler, MessageHandler, Filters, RegexHandler,
+from telegram.ext import (Updater, CommandHandler, MessageHandler, Filters,
                           ConversationHandler)
 
 # Enable logging
@@ -131,7 +131,7 @@ def main():
         entry_points=[CommandHandler('start', start)],
 
         states={
-            GENDER: [RegexHandler('^(Boy|Girl|Other)$', gender)],
+            GENDER: [MessageHandler(Filters.regex('^(Boy|Girl|Other)$'), gender)],
 
             PHOTO: [MessageHandler(Filters.photo, photo),
                     CommandHandler('skip', skip_photo)],
diff --git a/examples/conversationbot2.py b/examples/conversationbot2.py
--- a/examples/conversationbot2.py
+++ b/examples/conversationbot2.py
@@ -21,7 +21,7 @@
 import logging
 
 from telegram import ReplyKeyboardMarkup
-from telegram.ext import (Updater, CommandHandler, MessageHandler, Filters, RegexHandler,
+from telegram.ext import (Updater, CommandHandler, MessageHandler, Filters,
                           ConversationHandler)
 
 # Enable logging
@@ -80,9 +80,9 @@ def received_information(update, context):
     del user_data['choice']
 
     update.message.reply_text("Neat! Just so you know, this is what you already told me:"
-                              "{}"
-                              "You can tell me more, or change your opinion on something.".format(
-                                  facts_to_str(user_data)), reply_markup=markup)
+                              "{} You can tell me more, or change your opinion"
+                              " on something.".format(facts_to_str(user_data)),
+                              reply_markup=markup)
 
     return CHOOSING
 
@@ -119,25 +119,22 @@ def main():
         entry_points=[CommandHandler('start', start)],
 
         states={
-            CHOOSING: [RegexHandler('^(Age|Favourite colour|Number of siblings)$',
-                                    regular_choice,
-                                    pass_user_data=True),
-                       RegexHandler('^Something else...$',
-                                    custom_choice),
+            CHOOSING: [MessageHandler(Filters.regex('^(Age|Favourite colour|Number of siblings)$'),
+                                      regular_choice),
+                       MessageHandler(Filters.regex('^Something else...$'),
+                                      custom_choice)
                        ],
 
             TYPING_CHOICE: [MessageHandler(Filters.text,
-                                           regular_choice,
-                                           pass_user_data=True),
+                                           regular_choice)
                             ],
 
             TYPING_REPLY: [MessageHandler(Filters.text,
-                                          received_information,
-                                          pass_user_data=True),
+                                          received_information),
                            ],
         },
 
-        fallbacks=[RegexHandler('^Done$', done, pass_user_data=True)]
+        fallbacks=[MessageHandler(Filters.regex('^Done$'), done)]
     )
 
     dp.add_handler(conv_handler)
diff --git a/examples/persistentconversationbot.py b/examples/persistentconversationbot.py
--- a/examples/persistentconversationbot.py
+++ b/examples/persistentconversationbot.py
@@ -19,7 +19,7 @@
 """
 
 from telegram import ReplyKeyboardMarkup
-from telegram.ext import (Updater, CommandHandler, MessageHandler, Filters, RegexHandler,
+from telegram.ext import (Updater, CommandHandler, MessageHandler, Filters,
                           ConversationHandler, PicklePersistence)
 
 import logging
@@ -129,10 +129,10 @@ def main():
         entry_points=[CommandHandler('start', start)],
 
         states={
-            CHOOSING: [RegexHandler('^(Age|Favourite colour|Number of siblings)$',
-                                    regular_choice),
-                       RegexHandler('^Something else...$',
-                                    custom_choice),
+            CHOOSING: [MessageHandler(Filters.regex('^(Age|Favourite colour|Number of siblings)$'),
+                                      regular_choice),
+                       MessageHandler(Filters.regex('^Something else...$'),
+                                      custom_choice),
                        ],
 
             TYPING_CHOICE: [MessageHandler(Filters.text,
@@ -144,7 +144,7 @@ def main():
                            ],
         },
 
-        fallbacks=[RegexHandler('^Done$', done)],
+        fallbacks=[MessageHandler(Filters.regex('^Done$'), done)],
         name="my_conversation",
         persistent=True
     )


Test patch: