From 602de99529a0d6660cc4fdaf6b235977e2871198 Mon Sep 17 00:00:00 2001 From: neko259 Date: Sun, 20 Jan 2019 10:12:12 +0200 Subject: [PATCH] Added settings for the update frequency --- init.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/init.lua b/init.lua index d11bf2c..8137e66 100644 --- a/init.lua +++ b/init.lua @@ -5,12 +5,16 @@ telegram = {} local token = minetest.settings:get("telegram.token") local chat_id = minetest.settings:get("telegram.chatid") +local updates_timeout = tonumber(minetest.settings:get("telegram.timeout")) + +if not updates_timeout then + updates_timeout = 1 +end if not token then error("Bot token should be specified in the config in order to work.") end -local UPDATES_TIMEOUT = 1 -- seconds local UPDATES_LIMIT = 10 local offset = 0 @@ -98,7 +102,7 @@ end local timer = 0 minetest.register_globalstep(function(dtime) timer = timer + dtime - if timer >= UPDATES_TIMEOUT and not http_in_progress then + if timer >= updates_timeout and not http_in_progress then local timeout = 0 print(offset)