Skip to content
This repository was archived by the owner on Sep 2, 2025. It is now read-only.

Commit 42d6cf1

Browse files
committed
TelegramTypes: added ChatJoinRequest
1 parent 2187045 commit 42d6cf1

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace unreal4u\TelegramAPI\Telegram\Types;
6+
7+
use unreal4u\TelegramAPI\Abstracts\TelegramTypes;
8+
9+
/**
10+
* Represents a join request sent to a chat.
11+
*
12+
* @see https://core.telegram.org/bots/api#chatjoinrequest
13+
*/
14+
class ChatJoinRequest extends TelegramTypes
15+
{
16+
/**
17+
* Chat to which the request was sent
18+
*
19+
* @var Chat
20+
*/
21+
public $chat;
22+
23+
/**
24+
* User that sent the join request
25+
*
26+
* @var User
27+
*/
28+
public $from;
29+
30+
/**
31+
* Identifier of a private chat with the user who sent the join request. The bot can use this identifier
32+
* for 24 hours to send messages until the join request is processed, assuming no other administrator contacted
33+
* the user.
34+
*
35+
* @var int
36+
*/
37+
public $user_chat_id;
38+
39+
/**
40+
* Date the request was sent in Unix time
41+
*
42+
* @var int
43+
*/
44+
public $date;
45+
46+
/**
47+
* Optional. Bio of the user.
48+
*
49+
* @var string
50+
*/
51+
public $bio;
52+
53+
/**
54+
* Optional. Chat invite link that was used by the user to send the join request
55+
*
56+
* @var ChatInviteLink
57+
*/
58+
public $invite_link;
59+
60+
public function mapSubObjects(string $key, array $data): TelegramTypes
61+
{
62+
switch ($key) {
63+
case 'chat':
64+
return new Chat($data, $this->logger);
65+
case 'from':
66+
return new User($data, $this->logger);
67+
case 'invite_link':
68+
return new ChatInviteLink($data, $this->logger);
69+
}
70+
71+
return parent::mapSubObjects($key, $data);
72+
}
73+
}

0 commit comments

Comments
 (0)