From fdf8124965fc9527b06965947366a3f4d05e392d Mon Sep 17 00:00:00 2001 From: n5y <41209360+n5y@users.noreply.github.com> Date: Wed, 10 Jun 2020 21:30:56 +0300 Subject: [PATCH] Rename error_handler.py to errorhandlerbot.py and add a start command --- examples/{error_handler.py => errorhandlerbot.py} | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) rename examples/{error_handler.py => errorhandlerbot.py} (93%) diff --git a/examples/error_handler.py b/examples/errorhandlerbot.py similarity index 93% rename from examples/error_handler.py rename to examples/errorhandlerbot.py index 31fd09da6..3bdb294d3 100644 --- a/examples/error_handler.py +++ b/examples/errorhandlerbot.py @@ -56,6 +56,10 @@ def bad_command(update: Update, context: CallbackContext): context.bot.wrong_method_name() +def start(update: Update, context: CallbackContext): + update.effective_message.reply_text('Use /bad_command to cause an error.') + + def main(): # Create the Updater and pass it your bot's token. # Make sure to set use_context=True to use the new context based callbacks @@ -65,7 +69,8 @@ def main(): # Get the dispatcher to register handlers dp = updater.dispatcher - # Register the command... + # Register the commands... + dp.add_handler(CommandHandler('start', start)) dp.add_handler(CommandHandler('bad_command', bad_command)) # ...and the error handler