From 3203b8fe7ea8ddf36c3211262854032f1ad628ac Mon Sep 17 00:00:00 2001 From: topkecleon Date: Sun, 22 May 2016 03:03:50 -0400 Subject: [PATCH] Fix for the latest API update. --- bot.lua | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bot.lua b/bot.lua index 424c0c9..c624be2 100755 --- a/bot.lua +++ b/bot.lua @@ -95,16 +95,16 @@ function bot:run() while self.is_started do -- Start a loop while the bot should be running. - do - local res = bindings.getUpdates(self, self.last_update+1) -- Get the latest updates! - if res then - for _,v in ipairs(res.result) do -- Go through every new message. - self.last_update = v.update_id + local res = bindings.getUpdates(self, self.last_update+1) -- Get the latest updates! + if res then + for _,v in ipairs(res.result) do -- Go through every new message. + self.last_update = v.update_id + if v.message then bot.on_msg_receive(self, v.message) end - else - print(self.config.errors.connection) end + else + print(self.config.errors.connection) end if self.last_cron ~= os.date('%M') then -- Run cron jobs every minute.