Better logging, new preview.lua plugin.
When an exception is caught, info will be printed to the config.log_chat or the console. /preview will give an "unlinked" preview for the link. youtube.lua now uses config.google_api_key. youtube.lua now uses unlinked previews. lastfm.lua gives more informative error messages. New utility: handle_exception().
This commit is contained in:
@ -140,3 +140,16 @@ resolve_username = function(target)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
handle_exception = function(err, message)
|
||||
|
||||
local output = '\n[' .. os.date('%F %T', os.time()) .. ']\n' .. bot.username .. ': ' .. err .. '\n' .. message .. '\n'
|
||||
|
||||
if config.log_chat then
|
||||
output = '```' .. output .. '```'
|
||||
sendMessage(config.log_chat, output, true, nil, true)
|
||||
else
|
||||
print(output)
|
||||
end
|
||||
|
||||
end
|
||||
|
Reference in New Issue
Block a user