You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bot.ChatByUsername queries the API with the chat_id instead of username, not sure what happened there because I see the function defined above (ChatByID), converts its int64 ID to a string and then calls ChatByUsername with it.
The text was updated successfully, but these errors were encountered:
After checking the official API documentation it seems like we can only query users by ID, it might seem ambiguous as it mentions usernames too but only for channels and supergroups...
From the official API docs:
getChat
Use this method to get up-to-date information about the chat. Returns a ChatFullInfo object on success.
Parameter
Type
Required
Description
chat_id
Integer or String
Yes
Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
For my usecase, I wanted to query users by username, not channels or supergroups.
However I'm going to try to query it with a username since it's not rare for docs to go out of date, especially for such a big project as the Telegram bot API. If I succeed I'll report it here and contribute by making the necessary changes, however if I don't succeed I'll just close this as not planned.
bot.ChatByUsername queries the API with the chat_id instead of username, not sure what happened there because I see the function defined above (ChatByID), converts its int64 ID to a string and then calls ChatByUsername with it.
The text was updated successfully, but these errors were encountered: