Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
}
],
"require": {
"php": "^8.1",
"php": "^8.2",
"illuminate/support": "^10.0 | ^11.0 | ^12.0",
"illuminate/contracts": "^10.0 | ^11.0 | ^12.0",
"illuminate/http": "^10.0 | ^11.0 | ^12.0",
Expand Down
1 change: 1 addition & 0 deletions docs/12.features/9.dto.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ contains incoming data (a message or a callback query)

- `->id()` incoming _message_id_
- `->businessConnectionId()` unique identifier of a business connection
- `->mediaGroupId()` unique identifier of a media message group
- `->messageThreadId()` unique identifier of a message thread
- `->date()` a `CarbonInterface` holding the message sent date
- `->editDate()` a `CarbonInterface` holding the message last edit date
Expand Down
12 changes: 12 additions & 0 deletions src/DTO/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class Message implements Arrayable
private ?Invoice $invoice = null;
private ?Game $game = null;
private ?TextQuote $quote = null;
private ?string $mediaGroupId = null;
private ?SuccessfulPayment $successfulPayment = null;
private ?RefundedPayment $refundedPayment = null;
private ?WriteAccessAllowed $writeAccessAllowed = null;
Expand Down Expand Up @@ -100,6 +101,7 @@ private function __construct()
* invoice?: array<string, mixed>,
* game?:array<string, mixed>,
* quote?:array<string,mixed>,
* media_group_id?: string,
* successful_payment?: array<string, mixed>,
* refunded_payment?: array<string, mixed>,
* new_chat_members?: array<string, mixed>,
Expand All @@ -120,6 +122,10 @@ public static function fromArray(array $data): Message
$message->businessConnectionId = $data['business_connection_id'];
}

if (isset($data['media_group_id'])) {
$message->mediaGroupId = $data['media_group_id'];
}

if (isset($data['message_thread_id'])) {
$message->messageThreadId = $data['message_thread_id'];
}
Expand Down Expand Up @@ -278,6 +284,11 @@ public function businessConnectionId(): ?string
return $this->businessConnectionId;
}

public function mediaGroupId(): ?string
{
return $this->mediaGroupId;
}

public function date(): CarbonInterface
{
return $this->date;
Expand Down Expand Up @@ -458,6 +469,7 @@ public function toArray(): array
'id' => $this->id,
'message_thread_id' => $this->messageThreadId,
'business_connection_id' => $this->businessConnectionId,
'media_group_id' => $this->mediaGroupId,
'date' => $this->date->toISOString(),
'edit_date' => $this->editDate?->toISOString(),
'text' => $this->text,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
"supports_inline_queries": true,
"can_connect_to_business": false,
"has_main_web_app": false,
"has_topics_enabled": false
"has_topics_enabled": false,
"allows_users_to_create_topics": false
}

This file was deleted.

This file was deleted.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions tests/Unit/DTO/MessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
'message_id' => 2,
'message_thread_id' => 123456,
'business_connection_id' => 123456,
'media_group_id' => 123456,
'date' => now()->timestamp,
'edit_date' => now()->timestamp,
'text' => 'f',
Expand Down
Loading