Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get user and group sender of command #44

Closed
alvaro-octal opened this issue Oct 6, 2015 · 2 comments
Closed

Get user and group sender of command #44

alvaro-octal opened this issue Oct 6, 2015 · 2 comments

Comments

@alvaro-octal
Copy link

Hi,

As far as I have read, it's not possible to get the group or the user from which a command has been sent, it would be useful for "private" bots, or user systems.

what do you think?

@jonnywilliamson
Copy link
Contributor

Hi,

I'm not sure I follow what you mean.

When a command is issued by a user in a channel (say a group chat) this update object is sent to your webserver for processing.

As you can see it has the details of the user that sent it AND the name of the chat it was sent in.

Is this not what you are looking for?

(
    [update_id] => 304090973
    [message] => Array
        (
            [message_id] => 2733
            [from] => Array
                (
                    [id] => 12443287
                    [first_name] => FirstName
                    [last_name] => LastName
                    [username] => username
                )

            [chat] => Array
                (
                    [id] => -20301211
                    [title] => Chat Title
                )

            [date] => 1444162469
            [text] => /somecommand@botname
        )

)

@alvaro-octal
Copy link
Author

Yeah, telegram sends all that into to the web-hook, but I would like that info accesible from inside a Command class instead of only the command arguments.

Edit: Ok, just noticed the $this->update var, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants