From 185bff7117f906352ecfeda26bef2f58c5b849b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jannes=20H=C3=B6ke?= Date: Tue, 1 Dec 2015 18:06:42 +0100 Subject: [PATCH] update example --- examples/updater_bot.py | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/examples/updater_bot.py b/examples/updater_bot.py index e2a2193c3..df1533ade 100644 --- a/examples/updater_bot.py +++ b/examples/updater_bot.py @@ -106,7 +106,8 @@ def unknown_cli_command(bot, update): def main(): # Create the EventHandler and pass it your bot's token. - updater = Updater("TOKEN", workers=2) + token = 'token' + updater = Updater(token, workers=2) # Get the dispatcher to register handlers dp = updater.dispatcher @@ -125,13 +126,23 @@ def main(): # Start the Bot and store the update Queue, so we can insert updates update_queue = updater.start_polling(poll_interval=0.1, timeout=20) + ''' # Alternatively, run with webhook: - update_queue = updater.start_webhook('example.com', + updater.bot.setWebhook(webhook_url='https://example.com/%s' % token, + certificate=open('cert.pem', 'wb')) + + update_queue = updater.start_webhook('0.0.0.0', 443, - 'cert.pem', - 'key.key', - listen='0.0.0.0') + url_path=token, + cert='cert.pem', + key='key.key') + + # Or, if SSL is handled by a reverse proxy, the webhook URL is already set + # and the reverse proxy is configured to deliver directly to port 6000: + + update_queue = updater.start_webhook('0.0.0.0', + 6000) ''' # Start CLI-Loop