Sende keine Fehlermeldungen mehr an den Chat, sondern ignoriere die Nachricht einfach. Es wird empfohlen, einen Log-Chat einzurichten und die Fehlermeldungen dort hinleiten zu lassen (siehe config.lua.example)

This commit is contained in:
Andreas Bielawski 2016-08-09 00:49:54 +02:00
parent b9dbaa3244
commit 55a56e1a6f
2 changed files with 10 additions and 22 deletions

View File

@ -222,16 +222,8 @@ function match_plugins(self, msg, config, plugin)
return plugin.action(self, msg, config, matches)
end)
if not success then
-- If the plugin has an error message, send it. If it does
-- not, use the generic one specified in config. If it's set
-- to false, do nothing.
if plugin.error then
utilities.send_reply(self, msg, plugin.error)
elseif plugin.error == nil then
utilities.send_reply(self, msg, config.errors.generic, true)
end
utilities.handle_exception(self, result, msg.from.id .. ': ' .. msg.text, config)
return
utilities.handle_exception(self, result, msg.from.id .. ': ' .. msg.text, config)
return
end
end
end

View File

@ -485,18 +485,14 @@ function utilities:user_from_message(msg, no_extra)
end
function utilities:handle_exception(err, message, config)
if not err then err = '' end
local output = '\n[' .. os.date('%F %T', os.time()) .. ']\n' .. self.info.username .. ': ' .. err .. '\n' .. message .. '\n'
if config.log_chat then
output = '```' .. output .. '```'
utilities.send_message(self, config.log_chat, output, true, nil, true)
else
print(output)
end
if not err then err = '' end
local output = '\n[' .. os.date('%F %T', os.time()) .. ']\n' .. self.info.username .. ': ' .. err .. '\n' .. message .. '\n'
if config.log_chat then
output = '```' .. output .. '```'
utilities.send_message(self, config.log_chat, output, true, nil, true)
else
print(output)
end
end
-- MOVED TO DOWNLOAD_TO_FILE