update example

This commit is contained in:
Jannes Höke 2015-12-01 18:06:42 +01:00
parent 9f07900d99
commit 185bff7117

View file

@ -106,7 +106,8 @@ def unknown_cli_command(bot, update):
def main(): def main():
# Create the EventHandler and pass it your bot's token. # 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 # Get the dispatcher to register handlers
dp = updater.dispatcher dp = updater.dispatcher
@ -125,13 +126,23 @@ def main():
# Start the Bot and store the update Queue, so we can insert updates # Start the Bot and store the update Queue, so we can insert updates
update_queue = updater.start_polling(poll_interval=0.1, timeout=20) update_queue = updater.start_polling(poll_interval=0.1, timeout=20)
''' '''
# Alternatively, run with webhook: # 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, 443,
'cert.pem', url_path=token,
'key.key', cert='cert.pem',
listen='0.0.0.0') 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 # Start CLI-Loop