From a78024914289b1bb32bbd05b7b4270a756ce7d51 Mon Sep 17 00:00:00 2001 From: yago Date: Mon, 12 Jan 2015 20:29:18 +0100 Subject: [PATCH 1/2] help by default --- bot/bot.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bot/bot.lua b/bot/bot.lua index eceabc2..c46170c 100644 --- a/bot/bot.lua +++ b/bot/bot.lua @@ -145,15 +145,16 @@ function create_config( ) -- A simple config with basic plugins and ourserves as priviled user config = { enabled_plugins = { - "9gag", - "echo", + "9gag", + "echo", "get", - "set", + "help" "images", "img_google", "location", "media", "plugins", + "set", "stats", "time", "version", From 4872ebf3a53c85913dbc5da555d62a1561b314be Mon Sep 17 00:00:00 2001 From: yago Date: Mon, 12 Jan 2015 20:38:36 +0100 Subject: [PATCH 2/2] CRON enabled. Mark msg as read when plugin matches. Updated version --- bot/bot.lua | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/bot/bot.lua b/bot/bot.lua index c46170c..07fa42e 100644 --- a/bot/bot.lua +++ b/bot/bot.lua @@ -5,7 +5,7 @@ json = (loadfile "./libs/JSON.lua")() serpent = (loadfile "./libs/serpent.lua")() require("./bot/utils") -VERSION = '0.8.2' +VERSION = '0.8.3' function on_msg_receive (msg) vardump(msg) @@ -15,8 +15,6 @@ function on_msg_receive (msg) end do_action(msg) - - mark_read(get_receiver(msg), ok_cb, false) end function ok_cb(extra, success, result) @@ -25,7 +23,7 @@ end function on_binlog_replay_end () started = 1 -- 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 _config = load_config() @@ -58,7 +56,6 @@ function do_lex(msg, text) end end end - -- print("Text mutated to " .. text) return text end @@ -71,7 +68,6 @@ function do_action(msg) -- we can match on it. The plugin is resposible for handling text = '['..msg.media.type..']' end - -- print("Received msg", text) msg.text = do_lex(msg, text) @@ -81,6 +77,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) print(" matches", pattern) if desc.run ~= nil then -- If plugin is for privileged user @@ -209,4 +206,4 @@ end -- Start and load values our_id = 0 -now = os.time() +now = os.time() \ No newline at end of file