summaryrefslogtreecommitdiff
path: root/matrix-specification/Events/Message/FormattedMessageEvent.php
diff options
context:
space:
mode:
Diffstat (limited to 'matrix-specification/Events/Message/FormattedMessageEvent.php')
-rw-r--r--matrix-specification/Events/Message/FormattedMessageEvent.php39
1 files changed, 39 insertions, 0 deletions
diff --git a/matrix-specification/Events/Message/FormattedMessageEvent.php b/matrix-specification/Events/Message/FormattedMessageEvent.php
new file mode 100644
index 0000000..92e73a1
--- /dev/null
+++ b/matrix-specification/Events/Message/FormattedMessageEvent.php
@@ -0,0 +1,39 @@
+<?php
+
+namespace Matrix\Events\Message;
+
+use Matrix\Data\UnsignedData;
+use Matrix\Enums\EventType;
+use Matrix\Enums\MessageFormat;
+use Matrix\Enums\MessageType;
+
+class FormattedMessageEvent extends MessageEvent
+{
+ public function __construct(
+ string $eventId,
+ int $originServerTimestamp,
+ string $roomId,
+ string $sender,
+ string $body,
+ MessageType $msgtype,
+ ?MessageFormat $format = null,
+ ?string $formattedBody = null,
+ ?UnsignedData $unsigned = null,
+ )
+ {
+ parent::__construct(
+ array_filter([
+ "body" => $body,
+ "format" => $format,
+ "formatted_body" => $formattedBody,
+ "msgtype" => $msgtype,
+ ], fn ($value) => ! is_null($value)),
+ $eventId,
+ $originServerTimestamp,
+ $roomId,
+ $sender,
+ EventType::ROOM_MESSAGE,
+ $unsigned,
+ );
+ }
+}