Add beat handler
This commit is contained in:
@@ -1,16 +1,25 @@
|
||||
<?php
|
||||
|
||||
require_once 'MessageHandler.php';
|
||||
|
||||
class TestHandler extends MessageHandler
|
||||
class BeatHandler extends MessageHandler
|
||||
{
|
||||
|
||||
public function TryHandle($room_id, $msgid, $message, $room_lang): bool
|
||||
{
|
||||
if($msgid != 0)
|
||||
if(strpos ($message, "ฟาด") === false)
|
||||
return false;
|
||||
|
||||
$this->sendMessage($room_id, "uwu");
|
||||
if(randomorg(0,1) < 1)
|
||||
return false;
|
||||
|
||||
switch (randomorg(0,1)) {
|
||||
case 0:
|
||||
$this->sendSticker($room_id, "CAADBQADZAEAAvxwTgbC0dARe9U8kAI");
|
||||
break;
|
||||
case 1:
|
||||
$this->sendSticker($room_id, "CAADBQADZwEAAvxwTgbnO6oUQCtGpAI");
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -10,12 +10,17 @@ define("INTER_ROOM", 111213);
|
||||
|
||||
// randomorg($start,$end);
|
||||
|
||||
// Placeholder
|
||||
function randomorg(int $min, int $max) {
|
||||
return random_int ($min, $max);
|
||||
}
|
||||
|
||||
|
||||
require_once 'MessageHandler.php';
|
||||
require_once 'Handlers.php';
|
||||
|
||||
$handlers = array(
|
||||
new TestHandler(),
|
||||
new TestHandler()
|
||||
new BeatHandler()
|
||||
);
|
||||
|
||||
function reply_user(int $room_id, int $msgid, string $message, $room_lang): bool
|
||||
|
||||
Reference in New Issue
Block a user