D
D
Dmitry2021-12-03 11:59:34
Python
Dmitry, 2021-12-03 11:59:34

How to remove Telegram system notifications?

Tell me how to remove system notifications, who joined the group and who left the group, read a lot of information, but it doesn’t work, the most important thing is that the code be on the telebot library, or on another library, so that they are friends with each other, because I want everything to be in one file.

from telebot import TeleBot
from telebot import types
import time

bot = TeleBot('moy_token')


I did it differently, but the group does not delete who joined or left the group.
@bot.message_handler(content_types=['text'])
def message_handler(message):
 bot.delete_message(message.chat.id, message.message_id)

@bot.message_handler(content_types=['text'])
async def my_event_handler(event):
 bot.delete_message(message.chat.id, message.message_id)
 
@bot.message_handler(content_types=['text'])
def echo(message):
 bot.delete_message(message.chat.id, message.message_id)

@bot.message_handler(content_types=['text'])
def deleted (message):
 bot.delete_message(message.chat.id, message.message_id)

I would be very grateful if you tell me how to solve the problem in this matter, and also, maybe some other libraries, you need to install and write in the file.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
AlexAlex229, 2021-12-03
@dmitriy8720

After that: Paste this:
bot = TeleBot('moy_token')

@bot.message_handler(content_types = ['new_chat_members', 'left_chat_member'])
def delete(message):
      bot.delete_message(message.chat.id, message.message_id)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question