F
F
fantezi2022-01-11 16:20:30
Python
fantezi, 2022-01-11 16:20:30

How to solve the problem with restrict_chat_member()?

@dp.message_handler(content_types=['text'])
async def mute(message: types.Message):
    await message.answer('Вы забанены')
    new = types.ChatPermissions(can_send_messages=False)
    await Bot.restrict_chat_member(chat_id=message.chat.id, user_id=message.from_user.id, permissions=new,
                                   until_date=time() + 120)

await Bot.restrict_chat_member(chat_id=message.chat.id, user_id=message.from_user.id, permissions=new,
TypeError: Bot.restrict_chat_member() missing 1 required positional argument: 'self'

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2022-01-11
@SoreMix

bot, most likely should be written in lowercase, depending on how the bot variable was named at the beginning of the code

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question