From 0af5cc2db8448a0392d60a8ccd5bb1184d7096bb Mon Sep 17 00:00:00 2001 From: Yan Date: Tue, 16 Jun 2020 18:07:05 +0300 Subject: [PATCH] Don't override builtin method help() in examples (#1997) * Do not override builtin method help() * Rename inlinebot and inlinekeyboard /help function to not conflict with builtin --- examples/echobot2.py | 4 ++-- examples/inlinebot.py | 4 ++-- examples/inlinekeyboard.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/echobot2.py b/examples/echobot2.py index b6abbbbad..f611bcf86 100644 --- a/examples/echobot2.py +++ b/examples/echobot2.py @@ -33,7 +33,7 @@ def start(update, context): update.message.reply_text('Hi!') -def help(update, context): +def help_command(update, context): """Send a message when the command /help is issued.""" update.message.reply_text('Help!') @@ -55,7 +55,7 @@ def main(): # on different commands - answer in Telegram dp.add_handler(CommandHandler("start", start)) - dp.add_handler(CommandHandler("help", help)) + dp.add_handler(CommandHandler("help", help_command)) # on noncommand i.e message - echo the message on Telegram dp.add_handler(MessageHandler(Filters.text, echo)) diff --git a/examples/inlinebot.py b/examples/inlinebot.py index f1b3e2f84..f65cd0aa4 100644 --- a/examples/inlinebot.py +++ b/examples/inlinebot.py @@ -34,7 +34,7 @@ def start(update, context): update.message.reply_text('Hi!') -def help(update, context): +def help_command(update, context): """Send a message when the command /help is issued.""" update.message.reply_text('Help!') @@ -75,7 +75,7 @@ def main(): # on different commands - answer in Telegram dp.add_handler(CommandHandler("start", start)) - dp.add_handler(CommandHandler("help", help)) + dp.add_handler(CommandHandler("help", help_command)) # on noncommand i.e message - echo the message on Telegram dp.add_handler(InlineQueryHandler(inlinequery)) diff --git a/examples/inlinekeyboard.py b/examples/inlinekeyboard.py index ffc7a164b..b5d2cdfb7 100644 --- a/examples/inlinekeyboard.py +++ b/examples/inlinekeyboard.py @@ -36,7 +36,7 @@ def button(update, context): query.edit_message_text(text="Selected option: {}".format(query.data)) -def help(update, context): +def help_command(update, context): update.message.reply_text("Use /start to test this bot.") @@ -48,7 +48,7 @@ def main(): updater.dispatcher.add_handler(CommandHandler('start', start)) updater.dispatcher.add_handler(CallbackQueryHandler(button)) - updater.dispatcher.add_handler(CommandHandler('help', help)) + updater.dispatcher.add_handler(CommandHandler('help', help_command)) # Start the Bot updater.start_polling()