Y
Y
Yura2020-12-11 16:07:23
Python
Yura, 2020-12-11 16:07:23

How to prohibit writing in telebot, but allow inviting friends?

Tell me why this does not work bot.restrict_chat_member(chat_id, user_id, can_invite_users=True) the
bot simply bans the user from everything, he cannot invite friends, although I set can_invite_users=True

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Krostelev, 2020-12-11
@N0tdefined

I have suspicions that restrict_chat_member does not work correctly in the telebot library.
If you look at the Bot API documentation, it says that the permissions parameter , which is a JSON string , is substituted into the restrictChatMember method. And the bot.restrict_chat_member method , if you dig around on the github, simply transfers all permissions without converting them to JSON and without putting them in a separate permissions argument. Alternatively, call the restrictChatMember method directly with a Post request using the requests library, correctly passing all the necessary parameters there

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question