Add blue room yiff handler

This commit is contained in:
2018-12-21 17:55:50 +00:00
parent 022c54ca70
commit 7dc5231165
2 changed files with 36 additions and 2 deletions

View File

@@ -5,7 +5,7 @@ class BeatHandler extends MessageHandler
{ {
public function TryHandle($room_id, $msgid, $message, $room_lang): bool public function TryHandle($room_id, $msgid, $message, $room_lang): bool
{ {
if(strpos ($message, "ฟาด") === false) if(strpos($message, "ฟาด") === false)
return false; return false;
if(randomorg(0,1) < 1) if(randomorg(0,1) < 1)
@@ -23,3 +23,36 @@ class BeatHandler extends MessageHandler
return true; return true;
} }
} }
class BlueRoomYiff extends MessageHandler
{
private $keywords = array ("nude", "จู๋", "yiff");
public function TryHandle($room_id, $msgid, $message, $room_lang): bool
{
if($room_id !== BLUE_ROOM)
return false;
if(randomorg(0,1) < 1)
return false;
foreach ($this->keywords as $word) {
if(strpos($message, $word) !== 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;
}
}

View File

@@ -20,7 +20,8 @@ require_once 'MessageHandler.php';
require_once 'Handlers.php'; require_once 'Handlers.php';
$handlers = array( $handlers = array(
new BeatHandler() new BeatHandler(),
new BlueRoomYiff()
); );
function reply_user(int $room_id, int $msgid, string $message, $room_lang): bool function reply_user(int $room_id, int $msgid, string $message, $room_lang): bool