Skip to content

Commit 089fde4

Browse files
committed
fix payload type
1 parent d2515b5 commit 089fde4

File tree

3 files changed

+6
-14
lines changed

3 files changed

+6
-14
lines changed

src/Events/EventTrait.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,6 @@ public function __construct(object $data)
2424
$this->chat_id = $value - 2000000000;
2525
}
2626

27-
if ($property === "payload") {
28-
if (is_object($value)) {
29-
$this->payload = $value;
30-
} elseif (is_string($value)) {
31-
$this->payload = json_encode($value, false);
32-
}
33-
}
34-
3527
$this->$property = $value;
3628
}
3729
});

src/Events/MessageEvent.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ final class MessageEvent
2121
private int $peer_id;
2222
private int $user_id;
2323
private int $conversation_message_id;
24-
private object $payload;
24+
private mixed $payload;
2525
private string $event_id;
2626

2727
/**
@@ -49,9 +49,9 @@ public function getEventId(): string
4949
}
5050

5151
/**
52-
* @return object|null
52+
* @return mixed
5353
*/
54-
public function getPayload(): ?object
54+
public function getPayload(): mixed
5555
{
5656
return $this->getField("payload");
5757
}

src/Events/MessageNew.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ final class MessageNew
3232
private array $attachments;
3333
private bool $important;
3434
private object $geo;
35-
private object $payload;
35+
private mixed $payload;
3636
private array $fwd_messages;
3737
private object $reply_message;
3838
private object $action;
@@ -135,9 +135,9 @@ public function getGeo(): ?object
135135
}
136136

137137
/**
138-
* @return object|null
138+
* @return mixed
139139
*/
140-
public function getPayload(): ?object
140+
public function getPayload(): mixed
141141
{
142142
return $this->getField("payload");
143143
}

0 commit comments

Comments
 (0)