plugin.pre_process

This commit is contained in:
yago 2015-04-12 20:12:41 +02:00
parent 6f99b97479
commit 1e18d97034

View File

@ -45,12 +45,11 @@ function msg_valid(msg)
return true return true
end end
-- Apply plugin.pre_process function
function do_lex(msg) function pre_process_msg(msg)
-- Plugins which implements lex.
for name,plugin in pairs(plugins) do for name,plugin in pairs(plugins) do
if plugin.lex ~= nil then if plugin.pre_process then
msg = plugin.lex(msg) msg = plugin.pre_process(msg)
end end
end end
@ -102,22 +101,6 @@ function _send_msg(destination, text)
send_large_msg(destination, text) send_large_msg(destination, text)
end end
--Apply lex and other text.
function pre_process_msg(msg)
if msg.text == nil then
-- Not a text message, make text the same as what tg shows so
-- we can match on it. Maybe a plugin activated my media type.
if msg.media ~= nil then
msg.text = '['..msg.media.type..']'
end
end
msg = do_lex(msg)
return msg
end
-- Save the content of _config to config.lua -- Save the content of _config to config.lua
function save_config( ) function save_config( )
serialize_to_file(_config, './data/config.lua') serialize_to_file(_config, './data/config.lua')