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 )