Answer the question
In order to leave comments, you need to log in
How to fix an error when mute TG?
Should check the name, if it matches, then stir up the person.
@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"}']
Answer the question
In order to leave comments, you need to log in
Did you read the error?
Bad Request: method is available only for supergroupsBad request. The method is only available for supergroups.
Invalid request. The method is only available for supergroups.- changed the translation a bit, because "some" users don't understand the translation above (maybe IT is not for them?) ¯\_(ツ)_/¯
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question