From da79c3610c5a71c9d6053622953c3b90ba67102f Mon Sep 17 00:00:00 2001 From: Pitchaya Boonsarngsuk Date: Sat, 22 Dec 2018 09:57:38 +0000 Subject: [PATCH] =?UTF-8?q?Add=20=E0=B8=A5=E0=B8=A7=E0=B8=99=E0=B8=A5?= =?UTF-8?q?=E0=B8=B2=E0=B8=A1=20handler=20with=20less=20chance=20than=20yi?= =?UTF-8?q?ff?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Handlers.php | 38 ++++++++++++++++++++++++++++++++++---- src/entryPoint.php | 1 + 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/src/Handlers.php b/src/Handlers.php index a54dc5b..f85bbbb 100644 --- a/src/Handlers.php +++ b/src/Handlers.php @@ -30,16 +30,16 @@ class BlueRoomYiffHandler extends MessageHandler public function TryHandle($room_id, $msgid, $message, $room_lang): bool { - if($room_id !== BLUE_ROOM) + if ($room_id !== BLUE_ROOM) return false; - if(randomorg(0,1) < 1) + if (randomorg(0, 1) < 1) return false; $message = strtolower($message); foreach ($this->keywords as $word) { - if(strpos($message, $word) !== false) { - switch (randomorg(0,2)) { + if (strpos($message, $word) !== false) { + switch (randomorg(0, 2)) { case 0: $this->sendSticker($room_id, "CAADBQADtwADKkugCycBx71Mqx5DAg"); break; @@ -58,6 +58,36 @@ class BlueRoomYiffHandler extends MessageHandler } } +class BlueRoomMolestHandler extends MessageHandler +{ + public function TryHandle($room_id, $msgid, $message, $room_lang): bool + { + if ($room_id !== BLUE_ROOM) + return false; + + if (randomorg(0, 2) < 1) + return false; + + $message = strtolower($message); + if (strpos($message, "ลวนลาม") !== false) { + switch (randomorg(0, 2)) { + case 0: + $this->sendSticker($room_id, "CAADBQADtwADKkugCycBx71Mqx5DAg"); + break; + case 1: + $this->sendSticker($room_id, "CAADBQADlAADKkugC5BlguxbLRbxAg"); + break; + case 2: + $this->sendSticker($room_id, "CAADBQADigADKkugC8khRLbrMMjwAg"); + break; + } + return true; + } + + return false; + } +} + class BoopTextHandler extends MessageHandler { public function TryHandle($room_id, $msgid, $message, $room_lang): bool diff --git a/src/entryPoint.php b/src/entryPoint.php index d556679..556d183 100644 --- a/src/entryPoint.php +++ b/src/entryPoint.php @@ -22,6 +22,7 @@ require_once 'Handlers.php'; $handlers = array( new BeatHandler(), new BlueRoomYiffHandler(), + new BlueRoomMolestHandler(), new BoopTextHandler(), new OwOHandler() );