Closed ldelgadop44 closed 4 years ago
You're using "raw API", which means you're directly talking to Telegram, and the error also comes from Telegram. This is not a bug.
Bots can't check invite links to obtain the ID / access hash. Instead you should rely on the channel ID or username. Access hashes are per account and the channel will be invalid if a bad hash is used. If you have more questions, you should ask those in StackOverflow or the @TelethonChat group.
Checklist
pip install -U https://github.com/LonamiWebs/Telethon/archive/master.zip
and triggered the bug in the latest version.I have tried use the EditBannedRequest method for a private channel, when used it with a client works fine, however, when i use a bot with administrator permission over the channel, I got this error
Main.telethon.errors.rpcerrorlist.BotMethodInvalidError: The API access for bot users is restricted. The method you tried to invoke cannot be executed as a bot (caused by CheckChatInviteRequest)
I handled EditBannedRequest method for receive directly valid entities without execute _get_inputchannel and _get_inputentity methods... Then, I printed the values generated for the bot and compared with values generated for the client, and were equals.
For example:
In the method, I modified resolve function so:
values generated by the client: InputChannel(channel_id=XXXXXXX, access_hash=XXXXXX) <class 'Main.telethon.tl.types.InputChannel'>
values sended by the bot: INVITE_ACCESS = [InputChannel(channel_id=XXXXXXX, access_hash=XXXXXXX)] USER = [InputUser(user_id=XXXXXXX, access_hash=-XXXXXXX)]
And the function is this:
The final error is this: