Add OwO handler functionality
This commit is contained in:
@@ -73,12 +73,22 @@ class BoopTextHandler extends MessageHandler
|
|||||||
|
|
||||||
class OwOHandler extends MessageHandler
|
class OwOHandler extends MessageHandler
|
||||||
{
|
{
|
||||||
|
private $eyes = array('O', '0', '👁️');
|
||||||
|
private $mouths = array('ω','👄');
|
||||||
|
|
||||||
public function TryHandle($room_id, $msgid, $message, $room_lang): bool
|
public function TryHandle($room_id, $msgid, $message, $room_lang): bool
|
||||||
{
|
{
|
||||||
if(preg_match('/^\s+[o0][wω][o0]\s+$/i', $message) === false)
|
if(preg_match('/^\s*[ou0][wω][ou0]\s*$/i', $message) === 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$this->sendSticker($room_id, "CAADBAADUwAD7Z8MDl38hfMCvM06Ag");
|
if(randomorg(0,1) < 1)
|
||||||
|
$this->sendMessage($room_id, $room_lang === "th"? "อะไรนี่" : "What's this");
|
||||||
|
else {
|
||||||
|
$eye = $this->eyes[randomorg(0, count($this->eyes)-1)];
|
||||||
|
$mouth = $this->mouths[randomorg(0, count($this->mouths)-1)];
|
||||||
|
$this->sendMessage($room_id, $eye.$mouth.$eye);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -22,7 +22,8 @@ require_once 'Handlers.php';
|
|||||||
$handlers = array(
|
$handlers = array(
|
||||||
new BeatHandler(),
|
new BeatHandler(),
|
||||||
new BlueRoomYiffHandler(),
|
new BlueRoomYiffHandler(),
|
||||||
new BoopTextHandler()
|
new BoopTextHandler(),
|
||||||
|
new OwOHandler()
|
||||||
);
|
);
|
||||||
|
|
||||||
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
|
||||||
|
|||||||
@@ -17,6 +17,6 @@ do {
|
|||||||
$input = fread(STDIN, 80); // Read up to 80 characters or a newline
|
$input = fread(STDIN, 80); // Read up to 80 characters or a newline
|
||||||
$trimmed = trim($input);
|
$trimmed = trim($input);
|
||||||
|
|
||||||
echo reply_user($room_id, $msg_id, $trimmed, "th") , "\n";
|
echo reply_user($room_id, $msg_id, $trimmed, "en") , "\n";
|
||||||
$msg_id++;
|
$msg_id++;
|
||||||
} while($trimmed !== "exit");
|
} while($trimmed !== "exit");
|
||||||
Reference in New Issue
Block a user