@bot.message_handler(func=lambda message: message.entities is not None or message.photo is not None and message.chat.id == GROUP_ID)
def delete_links(message):
for entity in message.entities:
if entity.type is not None:
bot.delete_message(message.chat.id, message.message_id)