Poll when webhook domain is missing

Hooks is not very easy to setup, so lets fallback to polling if the hook domain is not defined

Signed-off-by: baalajimaestro <me@baalajimaestro.me>
This commit is contained in:
baalajimaestro 2022-04-11 18:15:59 +05:30
parent 9c9a7f71f3
commit ed158f0a47
Signed by: baalajimaestro
GPG key ID: F93C394FE9BBAFD5

View file

@ -221,4 +221,7 @@ bot.onUpdate(updateHandler)
bot.onCommand("start", startHandler) bot.onCommand("start", startHandler)
bot.onCommand("ban", banHandler) bot.onCommand("ban", banHandler)
bot.onCommand("unban", unbanHandler) bot.onCommand("unban", unbanHandler)
bot.startWebhook(getEnv("HOOK_SECRET"), getEnv("HOOK_DOMAIN") & "/" & getEnv("HOOK_SECRET")) if getEnv("HOOK_DOMAIN") != "":
bot.startWebhook(getEnv("HOOK_SECRET"), getEnv("HOOK_DOMAIN") & "/" & getEnv("HOOK_SECRET"))
else:
bot.poll(timeout=300)