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 } 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 +}