Make plugin.cron be called with the instance
This commit is contained in:
parent
24deaec759
commit
0e8a2693fb
2
bot.lua
2
bot.lua
@ -138,7 +138,7 @@ while instance.is_started do -- Start a loop while the bot should be running.
|
|||||||
utilities.save_data(instance.info.username..'.db', instance.database) -- Save the database.
|
utilities.save_data(instance.info.username..'.db', instance.database) -- Save the database.
|
||||||
for i,v in ipairs(instance.plugins) do
|
for i,v in ipairs(instance.plugins) do
|
||||||
if v.cron then -- Call each plugin's cron function, if it has one.
|
if v.cron then -- Call each plugin's cron function, if it has one.
|
||||||
local res, err = pcall(function() v.cron() end)
|
local res, err = pcall(function() v.cron(instance) end)
|
||||||
if not res then
|
if not res then
|
||||||
utilities.handle_exception(instance, err, 'CRON: ' .. i)
|
utilities.handle_exception(instance, err, 'CRON: ' .. i)
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user