Skip to content

Send data to handleChatMessage() #666

@romatexdev

Description

@romatexdev

How to send data with a message from a user in a chat and intercept it in handleChatMessage()?

I ask the user to enter a number
Telegraph::message('Count')->send();

Next, I intercept the text in handleChatMessage()
protected function handleChatMessage(\Illuminate\Support\Stringable $text): void { $this->chat->html("Received: $text")->send(); }

Can you tell me how to send other data together and get it from handleChatMessage()?

When I receive in handleChatMessage(), the data contains only the entered text
{ "update_id": 564438053, "message": { "message_id": 586, "from": { "id": 9465464644, "is_bot": false, "first_name": "RDev", "username": "romatexdev", "language_code": "en" }, "chat": { "id": 9465464644, "first_name": "RDev", "username": "romatexdev", "type": "private" }, "date": 15546546464, "text": "3" } }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions