From 542dcd04831a799d5c975ad9331c0a146eebfc27 Mon Sep 17 00:00:00 2001 From: Marcel van der Boom Date: Sun, 14 Dec 2014 16:42:49 +0100 Subject: [PATCH] Allow non-text changes to plugins Implemented by: - disabling the check for msg.text == nil - setting the match text to [msg.media.type] --- bot/bot.lua | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/bot/bot.lua b/bot/bot.lua index 1392564..12f9f33 100644 --- a/bot/bot.lua +++ b/bot/bot.lua @@ -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)