import telebot
import time
from telebot import types
bot = telebot.TeleBot("Moy_token")
@bot.message_handler(func=lambda message: message.entities is not None and message.chat.id)
def delete_links(message):
for entity in message.entities:
if entity.type in ["url", "text_link"]:
bot.delete_message(message.chat.id, message.message_id)
else:
return