Allow non-text changes to plugins

Implemented by:

- disabling the check for msg.text == nil
- setting the match text to [msg.media.type]
This commit is contained in:
Marcel van der Boom 2014-12-14 16:42:49 +01:00
parent 41f01a031d
commit 542dcd0483

View File

@ -37,9 +37,6 @@
end
function msg_valid(msg)
if msg.text == nil then
return false
end
--if msg.from.id == our_id then
-- return false
--end
@ -49,9 +46,6 @@
if msg.date < now then
return false
end
if msg.text == nil then
return false
end
if msg.unread == 0 then
return false
end
@ -61,6 +55,11 @@
function do_action(msg)
local receiver = get_receiver(msg)
local text = msg.text
if msg.text == nil then
-- Not a text message, make text the same as what tg shows so
-- we can match on it. The plugin is resposible for handling
text = '['..msg.media.type..']'
end
-- print("Received msg", text)
for name, desc in pairs(plugins) do
-- print("Trying module", name)