From 221a48b74d74ca63d59775826823a6027f80ee58 Mon Sep 17 00:00:00 2001 From: stiff Date: Fri, 18 Dec 2015 20:08:01 +0300 Subject: [PATCH 1/2] Plugin for setting channel name --- plugins/topic.lua | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 plugins/topic.lua diff --git a/plugins/topic.lua b/plugins/topic.lua new file mode 100644 index 00000000..636cc79d --- /dev/null +++ b/plugins/topic.lua @@ -0,0 +1,21 @@ + +local function run(msg, matches) + local text = matches[1] + local chat = 'chat#id'..msg.to.id + + if msg.to.type == 'chat' then + print('rename chat '..chat..' to '..text) + rename_chat(chat, text, ok_cb, false) + else + return 'This isn\'t a chat group' + end +end + +return { + description = "set channel topic", + usage = "!topic [whatever]: set channel topic", + patterns = { + "^!topic +(.+)$" + }, + run = run +} From 5d4f86e72f3b222b5c4ddd47ecc6e73e40f956f6 Mon Sep 17 00:00:00 2001 From: stiff Date: Sat, 19 Dec 2015 14:07:29 +0300 Subject: [PATCH 2/2] fix regexp for !set cmd --- plugins/set.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/set.lua b/plugins/set.lua index 12bc5d04..71c614c9 100644 --- a/plugins/set.lua +++ b/plugins/set.lua @@ -28,7 +28,7 @@ return { description = "Plugin for saving values. get.lua plugin is necessary to retrieve them.", usage = "!set [value_name] [data]: Saves the data with the value_name name.", patterns = { - "!set ([^%s]+) (.+)$" + "^!set ([^%s]+) (.+)$" }, run = run }