From ed158f0a474ee5ac0268b670e9dafb32edc16b3b Mon Sep 17 00:00:00 2001 From: baalajimaestro Date: Mon, 11 Apr 2022 18:15:59 +0530 Subject: [PATCH] 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 --- src/nim_censor_bot.nim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/nim_censor_bot.nim b/src/nim_censor_bot.nim index ab7923b..a16df9f 100644 --- a/src/nim_censor_bot.nim +++ b/src/nim_censor_bot.nim @@ -221,4 +221,7 @@ bot.onUpdate(updateHandler) bot.onCommand("start", startHandler) bot.onCommand("ban", banHandler) 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)