Add support for webhooks.
This commit is contained in:
parent
79a81bb9d1
commit
9d7baf5b18
6
bot.py
6
bot.py
|
@ -501,4 +501,10 @@ unknown = MessageHandler(Filters.command, lambda x, y: message_handling(x, y,
|
||||||
db))
|
db))
|
||||||
dispatcher.add_handler(unknown)
|
dispatcher.add_handler(unknown)
|
||||||
|
|
||||||
|
if config.update_method == "polling":
|
||||||
updater.start_polling()
|
updater.start_polling()
|
||||||
|
elif config.update_method == "webhook":
|
||||||
|
updater.start_webhook(listen=config.webhook["listen"],
|
||||||
|
url=config.webhook["url_path"],
|
||||||
|
port=config.webhook["port"])
|
||||||
|
updater.set_webhook(webhook_url=config.webhook["url"])
|
||||||
|
|
|
@ -9,3 +9,17 @@ gifs = [
|
||||||
"https://media.giphy.com/media/1wo19g2Fc6d8rqhSvp/giphy.gif",
|
"https://media.giphy.com/media/1wo19g2Fc6d8rqhSvp/giphy.gif",
|
||||||
"https://media.giphy.com/media/l2vAhfuyG9m9lJQnyS/giphy.gif"
|
"https://media.giphy.com/media/l2vAhfuyG9m9lJQnyS/giphy.gif"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
# Update method
|
||||||
|
# Available Modes: "polling", "webhook"
|
||||||
|
update_method = "polling"
|
||||||
|
|
||||||
|
# Webhook Config
|
||||||
|
# Check the following urls for more details
|
||||||
|
# https://github.com/python-telegram-bot/python-telegram-bot/wiki/Webhooks
|
||||||
|
|
||||||
|
webhook = {"listen": "0.0.0.0",
|
||||||
|
"url": "https://example.com/" + api_key,
|
||||||
|
"url_path": api_key,
|
||||||
|
"port": 9999,
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue