D
D
Dmitry2021-12-04 17:28:47
Python
Dmitry, 2021-12-04 17:28:47

How to Remove the inscription, Bot blocked in the chat?

Tell me how to remove the inscription that the bot blocked in the chat, since this inscription is seen by everyone and more, tell me how to turn off notifications so that the melody does not sound on the phone, you open the curtain and there is nothing there, only sound, every time you send a bad word.

import telebot
from time import time 
from telebot import types

bot = telebot.TeleBot("moy_token")

@bot.message_handler(func=lambda message: message.text and message.text.lower() in restricted_messages and message.chat.id)
def set_ro(message):
    print(message.from_user.language_code)
    bot.restrict_chat_member(message.chat.id, message.from_user.id, until_date=time()+300)
    bot.send_message(message.chat.id, strings.get(get_language(message.from_user.language_code)).get("ro_msg"),
                     reply_to_message_id=message.message_id)

I read from the python-telegram-bot library what you need:
disable_notification (bool, optional) - sends a message without displaying messages. Users will receive a silent notification.
Question: Where should I put this code?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vindicar, 2021-12-04
@Vindicar

Look at the Bot.send_message() method you are using.
There really is a disable_notification parameter that can be passed.
So you just pass this parameter by name like disable_notification=True.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question