V
V
Vasily Volk2020-11-30 15:11:52
Python
Vasily Volk, 2020-11-30 15:11:52

Why can't the bot add a user to administrators?

The bot has administrator rights (to assign admins, including), while using the promote_chat_member function, I get an error of this nature:
Unauthorized: Forbidden: right_forbidden

@dp.message_handler (Command("admin", prefixes="!/"))
async def admin(message: types.Message):
    Chat = message.chat.id
    user = message.from_user.id
    await bot.promote_chat_member(user_id=user,chat_id=Chat,can_edit_messages=True)

thanks in advance for your reply

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
SunnyWolf, 2020-11-30
@NEDOprogrammer

@dp.message_handler (Command("admin", prefixes="!/"))
async def admin(message: types.Message):
    Chat = message.chat.id
    await bot.promote_chat_member(user_id="",chat_id=Chat,can_edit_messages=True)

Your user_id is empty, right?

A
antonwx, 2020-11-30
@antonwx

So, for a moment, if this is about discord, then the administrator cannot give the role of his own group. Even if he is an administrator, the group he gives out must be strictly lower than the one to which he belongs. Just create another group with the same rights right after the bot and issue it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question