Am writing my first telegram bot for group chats with python-telegram-bot
package. And faced an issue.
Bot with exactly same rights (all of them, incl. adding new admins)
-
in my test groups (few users) – can promote new admins and change their custom title, no problem, but
-
in larger group chat (300+ users) – fails to promote new admins & assign custom titles, and gets
telegram.error.BadRequest: Chat_admin_required
andtelegram.error.BadRequest: Not enough rights to change custom title of the user
errors.
Using bot.promoteChatMember
to promote new admins, and bot.set_chat_administrator_custom_title
to set custom titles.
Same bot, same rights, all looks same.
What can be an issue?
Thanks a lot
2
Answers
This problem is that:
400 CHAT_ADMIN_REQUIRED You must be an admin in this chat to do this
To change custom title, user has to be promoted by the bot itself. Bot can not change titles for users promoted by others.
Check
get_chat_administrators
method. For each user it will returncan_be_edited
flat which indicates whenever is bot capable for modifying this user.