-
Notifications
You must be signed in to change notification settings - Fork 336
Open
Description
Problem:
We have Update and Message Instance.
If chat group very small, we can get all new members by method getNewChatMembers(): User[]
But for example, my chat have 6000 members and method getNewChatMembers return always null.
How to smart fix:
Attention: You need set updates for Webhook.
For example:
$allowedUpdates = [
'message',
'callback_query',
'chat_member',
'my_chat_member',
];
$this->bot->setWebhook($page_url, allowedUpdates: $allowedUpdates)
Without allowed updates like a chat_member, Update will not send you required keys.
Smart fix for example
- Get all request (ex. Laravel: $request->all();
- Request has key
[chat_member]['new_chat_member']
- Do anything
Need to update package
Please add method for get ChatMember (not NewChatMembers());
Request
{
"update_id": 450268762,
"chat_member": {
"chat": {
"id": -100.....,
"title": "********",
"username": "*******",
"type": "supergroup"
},
"from": {
"id": 7150985510,
"is_bot": false,
"first_name": "Лилия",
"is_premium": true
},
"date": 1745486964,
"old_chat_member": {
"user": {
"id": 7150985510,
"is_bot": false,
"first_name": "Лилия",
"is_premium": true
},
"status": "left"
},
"new_chat_member": {
"user": {
"id": 7150985510,
"is_bot": false,
"first_name": "Лилия",
"is_premium": true
},
"status": "member"
},
"via_chat_folder_invite_link": true
}
}
Note that this request does not contain the message key, so getting an Message Instance impossible
$client->on(function (Update $update) use ($bot) {
$message = $update->getMessage();
}
//$message = null;
vbatalov
Metadata
Metadata
Assignees
Labels
No labels