example
This commit is contained in:
@@ -256,24 +256,3 @@ class MatrixRoom
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$cb = function($event)
|
||||
{
|
||||
if ($event->event_type == "m.room.message") {
|
||||
var_dump($event);
|
||||
if ($event->content["body"] && $event->content["body"][0] === "!") {
|
||||
$command_parts = explode(" ", $event->content["body"], 2);
|
||||
$command = $command_parts[0];
|
||||
$arg = isset($command_parts[1]) ? $command_parts[1] : "";
|
||||
|
||||
switch($command) {
|
||||
case "!echo":
|
||||
$event->room->send_text($arg);
|
||||
break;
|
||||
case "!help":
|
||||
$event->room->send_text("Usage: !COMMAND ARG1 ARG2...\n!echo TEXT => repeat TEXT");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user