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:
parent
b9dbaa3244
commit
55a56e1a6f
@ -222,16 +222,8 @@ function match_plugins(self, msg, config, plugin)
|
|||||||
return plugin.action(self, msg, config, matches)
|
return plugin.action(self, msg, config, matches)
|
||||||
end)
|
end)
|
||||||
if not success then
|
if not success then
|
||||||
-- If the plugin has an error message, send it. If it does
|
utilities.handle_exception(self, result, msg.from.id .. ': ' .. msg.text, config)
|
||||||
-- not, use the generic one specified in config. If it's set
|
return
|
||||||
-- 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
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -485,18 +485,14 @@ function utilities:user_from_message(msg, no_extra)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function utilities:handle_exception(err, message, config)
|
function utilities:handle_exception(err, message, config)
|
||||||
|
if not err then err = '' 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
|
||||||
local output = '\n[' .. os.date('%F %T', os.time()) .. ']\n' .. self.info.username .. ': ' .. err .. '\n' .. message .. '\n'
|
output = '```' .. output .. '```'
|
||||||
|
utilities.send_message(self, config.log_chat, output, true, nil, true)
|
||||||
if config.log_chat then
|
else
|
||||||
output = '```' .. output .. '```'
|
print(output)
|
||||||
utilities.send_message(self, config.log_chat, output, true, nil, true)
|
end
|
||||||
else
|
|
||||||
print(output)
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- MOVED TO DOWNLOAD_TO_FILE
|
-- MOVED TO DOWNLOAD_TO_FILE
|
||||||
|
Reference in New Issue
Block a user