Fix for the latest API update.
This commit is contained in:
parent
68c1ae226c
commit
3203b8fe7e
4
bot.lua
4
bot.lua
@ -95,17 +95,17 @@ 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
|
||||||
|
end
|
||||||
else
|
else
|
||||||
print(self.config.errors.connection)
|
print(self.config.errors.connection)
|
||||||
end
|
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.
|
||||||
self.last_cron = os.date('%M')
|
self.last_cron = os.date('%M')
|
||||||
|
Reference in New Issue
Block a user