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:
topkecleon
2016-01-13 13:00:17 -05:00
parent c50b1ca3fa
commit fe549add63
8 changed files with 89 additions and 13 deletions

View File

@ -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