Eleirbag89 / TelegramBotPHP

A very simple PHP Telegram Bot API for sending messages.
http://eleirbag89.github.io/TelegramBotPHP
MIT License
812 stars 342 forks source link

ErrorException Undefined array key "message" when using funtion UserID() #288

Closed Alfdwi closed 1 year ago

Alfdwi commented 1 year ago

I found error when i use function UserID()

Screenshot 2023-04-07 at 08 10 30

this is response from telegram what make the script error

{ "ok": true, "result": [ { "update_id": 496978082, "my_chat_member": { "chat": { "id": -1001776941924, "title": "test grup", "type": "supergroup" }, "from": { "id": 1166884544, "is_bot": false, "first_name": "Alif", "last_name": "Dwi", "username": "Alifdwi", "language_code": "en" }, "date": 1680830021, "old_chat_member": { "user": { "id": 5515352066, "is_bot": true, "first_name": "testingbcgamebot", "username": "testingbcgamebot" }, "status": "left" }, "new_chat_member": { "user": { "id": 5515352066, "is_bot": true, "first_name": "testingbcgamebot", "username": "testingbcgamebot" }, "status": "member" } } }, { "update_id": 496978083, "message": { "message_id": 1171, "from": { "id": 1166884544, "is_bot": false, "first_name": "Alif", "last_name": "Dwi", "username": "Alifdwi", "language_code": "en" }, "chat": { "id": -1001776941924, "title": "test grup", "type": "supergroup" }, "date": 1680830021, "new_chat_participant": { "id": 5515352066, "is_bot": true, "first_name": "testingbcgamebot", "username": "testingbcgamebot" }, "new_chat_member": { "id": 5515352066, "is_bot": true, "first_name": "testingbcgamebot", "username": "testingbcgamebot" }, "new_chat_members": [ { "id": 5515352066, "is_bot": true, "first_name": "testingbcgamebot", "username": "testingbcgamebot" } ] } }, { "update_id": 496978084, "my_chat_member": { "chat": { "id": -1001776941924, "title": "test grup", "type": "supergroup" }, "from": { "id": 1166884544, "is_bot": false, "first_name": "Alif", "last_name": "Dwi", "username": "Alifdwi", "language_code": "en" }, "date": 1680830031, "old_chat_member": { "user": { "id": 5515352066, "is_bot": true, "first_name": "testingbcgamebot", "username": "testingbcgamebot" }, "status": "member" }, "new_chat_member": { "user": { "id": 5515352066, "is_bot": true, "first_name": "testingbcgamebot", "username": "testingbcgamebot" }, "status": "administrator", "can_be_edited": false, "can_manage_chat": true, "can_change_info": true, "can_delete_messages": true, "can_invite_users": true, "can_restrict_members": true, "can_pin_messages": true, "can_manage_topics": false, "can_promote_members": false, "can_manage_video_chats": true, "is_anonymous": false, "can_manage_voice_chats": true } } } ] }

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Eleirbag89 commented 1 year ago

The attibute path message->from->id exist in the response JSON, so the error should not happen.

Are you doing something else ? Are you invoking the script from the browser ?

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.