Answer the question
In order to leave comments, you need to log in
How to add chat to telegram via pyrogram?
How to add chat to telegram via pyrogram using its id?
I tried with
app.add_chat_members(chat_id, user_id)
But for some reason it returns the error pyrogram.errors.exceptions.bad_request_400.UsernameNotOccupied: [400 USERNAME_NOT_OCCUPIED]: The username is not occupied by anyone (caused by "contacts.ResolveUsername") , even though there are definitely users with that id , as they have just been received from another group
Answer the question
In order to leave comments, you need to log in
You may be entering the chat ID in the wrong format. The fact is that the ID formats in Telegram differ between the Bot API and the MT-Proto API. To work with Pyrogram, you need a chat ID in the MT-Proto API format.
For example, the t.me/BotTalk chat has ID 1311056733 (MT-Proto) and -1001311056733 (Bot API). In order to convert the ID to MT-Proto format, you need to take the number with the opposite sign (remove the minus) and subtract 1000000000000 from it
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question