From 22169266c0f6e5a2fd61d9621ec9fcfd54ca980f Mon Sep 17 00:00:00 2001 From: Akamaru Date: Sun, 19 Jul 2015 18:58:45 +0200 Subject: [PATCH] afk plugin (not really) fixed --- plugins/afk.lua | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/plugins/afk.lua b/plugins/afk.lua index d0958c1..decc19d 100644 --- a/plugins/afk.lua +++ b/plugins/afk.lua @@ -1,26 +1,29 @@ - function run(msg, matches) - text = matches[2] + --local text = matches[2] local user_name = get_name(msg) - if matches[1] == '/afk' and not text then - return user_name .. ' ist nun AFK' + --[[if matches[1] == '/afk' and matches[2] then + return user_name .. ' ist nun AFK (' .. text .. ')' + else + return user_name .. ' ist nun AFK' + end]] + + if string.starts(msg.text, '/afk') then + return user_name .. ' ist nun AFK' + --elseif string.starts(msg.text, '/afk') and text == not nil then + --return user_name .. ' ist nun AFK (' .. text .. ')' end - if matches[1] == '/afk' then - return user_name .. ' ist nun AFK (' .. text .. ')' - end - - if matches[1] == '/re' or '/wd' then + if string.starts(msg.text, '/re') or string.starts(msg.text, '/wd') then return user_name .. ' ist wieder da!' - end + end end return { description = 'Sagt dass ihr afk oder wieder da seid', usage = {'/afk','/re','/wd'}, - patterns = {'^/([A|a][F|f][K|k])$','^/([A|a][F|f][K|k]) (.*)$','^/([R|r][E|e])$','^/([W|w][D|d])$'}, + patterns = {'^/[A|a][F|f][K|k]$','^/[A|a][F|f][K|k] (.*)$','^/[R|r][E|e]$','^/[W|w][D|d]$'}, run = run } --by Akamaru [https://ponywave.de] \ No newline at end of file