Fix for the latest API update.

This commit is contained in:
topkecleon 2016-05-22 03:03:50 -04:00
parent 68c1ae226c
commit 3203b8fe7e

14
bot.lua
View File

@ -95,16 +95,16 @@ function bot:run()
while self.is_started do -- Start a loop while the bot should be running. 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!
local res = bindings.getUpdates(self, self.last_update+1) -- Get the latest updates! if res then
if res then for _,v in ipairs(res.result) do -- Go through every new message.
for _,v in ipairs(res.result) do -- Go through every new message. self.last_update = v.update_id
self.last_update = v.update_id if v.message then
bot.on_msg_receive(self, v.message) bot.on_msg_receive(self, v.message)
end end
else
print(self.config.errors.connection)
end end
else
print(self.config.errors.connection)
end end
if self.last_cron ~= os.date('%M') then -- Run cron jobs every minute. if self.last_cron ~= os.date('%M') then -- Run cron jobs every minute.