Merge pull request #19 from mrvdb/nontext

Allow non-text input to plugins
This commit is contained in:
Yago 2014-12-14 20:24:25 +01:00
commit 495bad27ee

View File

@ -37,9 +37,6 @@
end end
function msg_valid(msg) function msg_valid(msg)
if msg.text == nil then
return false
end
--if msg.from.id == our_id then --if msg.from.id == our_id then
-- return false -- return false
--end --end
@ -49,9 +46,6 @@
if msg.date < now then if msg.date < now then
return false return false
end end
if msg.text == nil then
return false
end
if msg.unread == 0 then if msg.unread == 0 then
return false return false
end end
@ -61,6 +55,11 @@
function do_action(msg) function do_action(msg)
local receiver = get_receiver(msg) local receiver = get_receiver(msg)
local text = msg.text 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) -- print("Received msg", text)
for name, desc in pairs(plugins) do for name, desc in pairs(plugins) do
-- print("Trying module", name) -- print("Trying module", name)