From 9d52c6103c7b7173441b5fad41395774e5be23cf Mon Sep 17 00:00:00 2001 From: yago Date: Tue, 10 Mar 2015 20:35:19 +0100 Subject: [PATCH] Support for encr_chat --- bot/bot.lua | 4 ++-- bot/utils.lua | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/bot/bot.lua b/bot/bot.lua index d6f1b1b..3d4c929 100644 --- a/bot/bot.lua +++ b/bot/bot.lua @@ -39,7 +39,7 @@ function msg_valid(msg) print("Not valid, msg from us") return false end - if msg.date < now then + if msg.date < (now - 60) then print("Not valid, old msg") return false end @@ -87,7 +87,7 @@ function do_action(msg) -- print("Trying", text, "against", pattern) matches = { string.match(text, pattern) } if matches[1] then - mark_read(get_receiver(msg), ok_cb, false) + mark_read(receiver, ok_cb, false) print(" matches", pattern) if desc.run ~= nil then -- If plugin is for privileged user diff --git a/bot/utils.lua b/bot/utils.lua index 49a1305..cf0d940 100644 --- a/bot/utils.lua +++ b/bot/utils.lua @@ -8,6 +8,9 @@ function get_receiver(msg) if msg.to.type == 'chat' then return 'chat#id'..msg.to.id end + if msg.to.type == 'encr_chat' then + return msg.to.print_name + end end function is_chat_msg( msg )