botman / driver-telegram

BotMan Telegram Driver
MIT License
86 stars 75 forks source link

Why extra call to API for getUser()? #76

Open yarkm13 opened 4 years ago

yarkm13 commented 4 years ago

Method getUser() in TelegramDriver issue getChatMember telegram API call. Why fire 'expensive' by time API call while Telegram provides from entry in each call which is enought in most cases?

    "from": {
        "id": 000000,
        "is_bot": false,
        "first_name": "fname",
        "last_name": "lname",
        "username": "username",
        "language_code": "en"
    },

I think it must extract that information and may be implement in BotMan\Drivers\Telegram\Extensions\User getters for additional data, provided by getChatMember and call API only if one of additional fields is requested

feralheart commented 4 years ago

Because the from is an optional param. It's empty when the message comes from a channel.

As I see the driver only uses the 'user' entry of the getChatMember result what's the same User object as the message's from entry, so yes it would be an enchancement in the driver if someone adds this functionality.