diff --git a/app/Custom/CustomWorker.php b/app/Custom/CustomWorker.php deleted file mode 100644 index 5db9f99..0000000 --- a/app/Custom/CustomWorker.php +++ /dev/null @@ -1,9 +0,0 @@ -request['event']['text']; $mustMention = !(preg_match('/^D/', $this->request['event']['channel'])); + $parsedText = $this->parseText($rawText, $mustMention); if (isset($parsedText["type"])) { if ($parsedText["type"] == "gitlab-add") { diff --git a/config/bot.php b/config/bot.php index 40bb8e6..b3ba6bf 100644 --- a/config/bot.php +++ b/config/bot.php @@ -46,11 +46,13 @@ * "containsType" can only be one of the following: * "{email}", * + * The rules are all joined by ANDs + * * To extract a parenthesized regex pattern into a variable, - * put the name of the variable (in order) in square bracket + * put the name of the variable (in order) after the type (space-separated) */ "parse" => array( - "containsAll[username]" => array( + "containsAll username" => array( "/gitlab/i", "/username\s*:\s*([^@\s]+)/i" ), @@ -74,10 +76,10 @@ "containsAll" => array( "/pivotal/i" ), - "containsType[email]" => array( + "containsType email" => array( "{email}", ), - "canContain[project]" => array( + "canContain project" => array( "/project\s*:\s*([^@\s]+)/" ) ),