Closed osqenawi closed 1 year ago
The documentation says:
Both users and bots may be able to use this request
Not:
Both users and bots are able to use this request
This line in the raw API page is manually regenerated by me every now and then, and I haven't done so for newer requests yet. So the default is "maybe it works, maybe not".
I wonder why the official Telegram Docs says:
Bots can use this method
You are using raw API, which means the results you are getting come directly from Telegram, and Telethon is not changing them in any way (other than adapting some input parameters where needed, all while respecting the intended values). Unfortunately this means it's something Telethon cannot "fix" and it's just the way Telegram's API works.
Their documentation could have a mistake.
Code that causes the issue
Expected behavior
The channels.getForumTopics method should work for bot accounts with the appropriate permissions, as stated in the documentation.
Actual behavior
The method returns an error when used with a bot account.
Traceback
Telethon version
1.29.2
Python version
3.9.7
Operating system (including distribution name and version)
macOS 13.4.1
Other details
When using the channels.getForumTopics API method with a bot account, I encountered the following error:
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 GetForumTopicsRequest)
The official Telethon documentation claims that the channels.getForumTopics method is accessible to both users and bots. However, in my testing, I found that the method works as expected for user accounts but fails with the aforementioned error when used with bot accounts.
Checklist
pip install -U https://github.com/LonamiWebs/Telethon/archive/v1.zip
and triggered the bug in the latest version.