Skip to content

Commit 70706ff

Browse files
committed
Added updates about new requests to join the chat, represented by the ChatJoinRequest entity and the field chat_join_request in the Update entity.
1 parent 736269b commit 70706ff

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

src/Entities/ChatJoinRequest.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
namespace Longman\TelegramBot\Entities;
4+
5+
/**
6+
* Class ChatJoinRequest
7+
*
8+
* Represents a join request sent to a chat.
9+
*
10+
* @link https://core.telegram.org/bots/api#chatjoinrequest
11+
*
12+
* @method Chat getChat() Chat to which the request was sent
13+
* @method User getUser() User that sent the join request
14+
* @method int getDate() Date the request was sent in Unix time
15+
* @method string getBio() Optional. Bio of the user.
16+
* @method ChatInviteLink getInviteLink() Optional. Chat invite link that was used by the user to send the join request
17+
*/
18+
class ChatJoinRequest extends Entity
19+
{
20+
21+
protected function subEntities(): array
22+
{
23+
return [
24+
'chat' => Chat::class,
25+
'from' => User::class,
26+
'invite_link' => ChatInviteLink::class,
27+
];
28+
}
29+
30+
}

src/Entities/Update.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
* @method PollAnswer getPollAnswer() Optional. A user changed their answer in a non-anonymous poll. Bots receive new votes only in polls that were sent by the bot itself.
3434
* @method ChatMemberUpdated getMyChatMember() Optional. The bot's chat member status was updated in a chat. For private chats, this update is received only when the bot is blocked or unblocked by the user.
3535
* @method ChatMemberUpdated getChatMember() Optional. A chat member's status was updated in a chat. The bot must be an administrator in the chat and must explicitly specify “chat_member” in the list of allowed_updates to receive these updates.
36+
* @method ChatJoinRequest getChatJoinRequest() Optional. A request to join the chat has been sent. The bot must have the can_invite_users administrator right in the chat to receive these updates.
3637
*/
3738
class Update extends Entity
3839
{
@@ -49,6 +50,7 @@ class Update extends Entity
4950
public const TYPE_POLL_ANSWER = 'poll_answer';
5051
public const TYPE_MY_CHAT_MEMBER = 'my_chat_member';
5152
public const TYPE_CHAT_MEMBER = 'chat_member';
53+
public const TYPE_CHAT_JOIN_REQUEST = 'chat_join_request';
5254

5355
/**
5456
* {@inheritdoc}
@@ -69,6 +71,7 @@ protected function subEntities(): array
6971
self::TYPE_POLL_ANSWER => PollAnswer::class,
7072
self::TYPE_MY_CHAT_MEMBER => ChatMemberUpdated::class,
7173
self::TYPE_CHAT_MEMBER => ChatMemberUpdated::class,
74+
self::TYPE_CHAT_JOIN_REQUEST => ChatJoinRequest::class,
7275
];
7376
}
7477

0 commit comments

Comments
 (0)