'Python telebot cant restrict chat member

I want to restrict chat member in writing but give him opportunity to invite users. I tried

bot.restrict_chat_member(chat_id, user_id, can_invite_users=True)

But this restrict chat member of everything, he cant invite users. Also I tried this

bot.restrict_chat_member(chat_id, user_id) bot.promote_chat_member(chat.get_chat_id(), us.get_user_id(), can_invite_users=True)

But it also doesnt work How can I do this?



Solution 1:[1]

chat_id = message.chat.id
user_id = message.from_user.id
permissions = ChatMember(can_send_messages = False)
restrict_chat_member(chat_id, user_id, permissions)

This should work

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 stabpaokara