CRON enabled. Mark msg as read when plugin matches. Updated version
This commit is contained in:
parent
a780249142
commit
4872ebf3a5
11
bot/bot.lua
11
bot/bot.lua
@ -5,7 +5,7 @@ json = (loadfile "./libs/JSON.lua")()
|
|||||||
serpent = (loadfile "./libs/serpent.lua")()
|
serpent = (loadfile "./libs/serpent.lua")()
|
||||||
require("./bot/utils")
|
require("./bot/utils")
|
||||||
|
|
||||||
VERSION = '0.8.2'
|
VERSION = '0.8.3'
|
||||||
|
|
||||||
function on_msg_receive (msg)
|
function on_msg_receive (msg)
|
||||||
vardump(msg)
|
vardump(msg)
|
||||||
@ -15,8 +15,6 @@ function on_msg_receive (msg)
|
|||||||
end
|
end
|
||||||
|
|
||||||
do_action(msg)
|
do_action(msg)
|
||||||
|
|
||||||
mark_read(get_receiver(msg), ok_cb, false)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function ok_cb(extra, success, result)
|
function ok_cb(extra, success, result)
|
||||||
@ -25,7 +23,7 @@ end
|
|||||||
function on_binlog_replay_end ()
|
function on_binlog_replay_end ()
|
||||||
started = 1
|
started = 1
|
||||||
-- Uncomment the line to enable cron plugins.
|
-- Uncomment the line to enable cron plugins.
|
||||||
-- postpone (cron_plugins, false, 5.0)
|
postpone (cron_plugins, false, 60*5.0)
|
||||||
-- See plugins/ping.lua as an example for cron
|
-- See plugins/ping.lua as an example for cron
|
||||||
|
|
||||||
_config = load_config()
|
_config = load_config()
|
||||||
@ -58,7 +56,6 @@ function do_lex(msg, text)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- print("Text mutated to " .. text)
|
|
||||||
return text
|
return text
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -71,7 +68,6 @@ function do_action(msg)
|
|||||||
-- we can match on it. The plugin is resposible for handling
|
-- we can match on it. The plugin is resposible for handling
|
||||||
text = '['..msg.media.type..']'
|
text = '['..msg.media.type..']'
|
||||||
end
|
end
|
||||||
-- print("Received msg", text)
|
|
||||||
|
|
||||||
msg.text = do_lex(msg, text)
|
msg.text = do_lex(msg, text)
|
||||||
|
|
||||||
@ -81,6 +77,7 @@ function do_action(msg)
|
|||||||
-- print("Trying", text, "against", pattern)
|
-- print("Trying", text, "against", pattern)
|
||||||
matches = { string.match(text, pattern) }
|
matches = { string.match(text, pattern) }
|
||||||
if matches[1] then
|
if matches[1] then
|
||||||
|
mark_read(get_receiver(msg), ok_cb, false)
|
||||||
print(" matches", pattern)
|
print(" matches", pattern)
|
||||||
if desc.run ~= nil then
|
if desc.run ~= nil then
|
||||||
-- If plugin is for privileged user
|
-- If plugin is for privileged user
|
||||||
@ -209,4 +206,4 @@ end
|
|||||||
|
|
||||||
-- Start and load values
|
-- Start and load values
|
||||||
our_id = 0
|
our_id = 0
|
||||||
now = os.time()
|
now = os.time()
|
Reference in New Issue
Block a user