Должен проверять имя, если оно совпадает, то мутить человека.
@bot.message_handler(content_types=["new_chat_members"])
def cmd_mute(message):
name = message.from_user.first_name
if name == 'Кто-то':
bot.restrict_chat_member(message.chat.id, message.from_user.id,can_send_messages=False,can_send_media_messages=True,can_send_other_messages=True,can_add_web_page_previews=True,until_date=1)
bot.send_message(message.chat_id, 'Успешно')
Ошибка:
File ".\main.py", line 10, in cmd_mute
bot.restrict_chat_member(message.chat.id, message.from_user.id,can_send_messages=False,can_send_media_messages=True,can_send_other_messages=True,can_add_web_page_previews=True,until_date=1)
telebot.apihelper.ApiException: A request to the Telegram API was unsuccessful. The server returned HTTP 400 Bad Request. Response body:
[b'{"ok":false,"error_code":400,"description":"Bad Request: method is available only for supergroups"}']