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
This commit is contained in:
Yan 2020-06-16 18:07:05 +03:00 committed by GitHub
parent 6005861f46
commit 0af5cc2db8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View file

@ -33,7 +33,7 @@ def start(update, context):
update.message.reply_text('Hi!') update.message.reply_text('Hi!')
def help(update, context): def help_command(update, context):
"""Send a message when the command /help is issued.""" """Send a message when the command /help is issued."""
update.message.reply_text('Help!') update.message.reply_text('Help!')
@ -55,7 +55,7 @@ def main():
# on different commands - answer in Telegram # on different commands - answer in Telegram
dp.add_handler(CommandHandler("start", start)) 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 # on noncommand i.e message - echo the message on Telegram
dp.add_handler(MessageHandler(Filters.text, echo)) dp.add_handler(MessageHandler(Filters.text, echo))

View file

@ -34,7 +34,7 @@ def start(update, context):
update.message.reply_text('Hi!') update.message.reply_text('Hi!')
def help(update, context): def help_command(update, context):
"""Send a message when the command /help is issued.""" """Send a message when the command /help is issued."""
update.message.reply_text('Help!') update.message.reply_text('Help!')
@ -75,7 +75,7 @@ def main():
# on different commands - answer in Telegram # on different commands - answer in Telegram
dp.add_handler(CommandHandler("start", start)) 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 # on noncommand i.e message - echo the message on Telegram
dp.add_handler(InlineQueryHandler(inlinequery)) dp.add_handler(InlineQueryHandler(inlinequery))

View file

@ -36,7 +36,7 @@ def button(update, context):
query.edit_message_text(text="Selected option: {}".format(query.data)) 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.") 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(CommandHandler('start', start))
updater.dispatcher.add_handler(CallbackQueryHandler(button)) updater.dispatcher.add_handler(CallbackQueryHandler(button))
updater.dispatcher.add_handler(CommandHandler('help', help)) updater.dispatcher.add_handler(CommandHandler('help', help_command))
# Start the Bot # Start the Bot
updater.start_polling() updater.start_polling()