Home>

I figured out how to delete messages with a link, but now I want to also but only with words, I imagine there is a list or a dictionary, it lists forbidden words, the bot (I entered it in the chat administration) constantly reads the chat and if the message contains a word from the dictionary list, this message needs to be deleted bot.delete_message(message.chat.id, message.message_id) I use PyTelegramBotAPI in telebot vernacular

Dear lag, this is not the first time a question of this kind -the removal of "mate" -has been raised on the forum. I'm sorry to upset you, but so far in the competition of human intelligence, which wanted to swear, and the robot, which wanted to detect this fact (and erase the message) -a person has always won. Is always. If you have a decent technology -come and name any price :-) (I do not want to turn the comment into a demonstration of human capabilities, but anyone capable of consuming content has enough imagination)

S.H.2022-01-14 09:50:30

no, it’s not necessarily a swear word, it’s just a ban, I can’t call it right away, condemnations will go

lag2022-01-14 09:55:17

Okay, I’ll ask a question a little differently how to check messages in a group and if it matches the list or dictionary, then delete it)

lag2022-01-14 09:56:34

>how to check messages in a group and if it matches the list or dictionary, then delete -You started the question by learning how to delete messages with links. That is, you have, roughly speaking, "a sign that the message contains a link." Now let's replace this with "a sign that the individual words of the message are in such and such a dictionary" -well, that's it, in general terms

S.H.2022-01-14 10:38:11

I didn’t understand you a bit, I have a check if entity.type in ["url", "text_link"]:

lag2022-01-14 10:51:24