G
G
georgich2018-11-07 14:01:38
API
georgich, 2018-11-07 14:01:38

How to delete a message in a supergroup by a bot?

Greetings.
Very tormented by spam in the supergroup. Mostly all kinds of bots in Arabic spam, plus occasionally users. Message texts in Arabic. I started writing a bot to clean up the chat from this rubbish. I use this library: https://github.com/Eleirbag89/TelegramBotPHP/blob/...
But I don't understand the triggering logic, namely:

//получаю текст сообщения
$result = telegram->getData();
$text = $result["message"]["text"];
$chat_id = $result["message"]["chat"]["id"];
$caption = $result["message"]["caption"];

//Далее проверяю на наличие арабского и удаляю

And everything seems to be fine. I myself tried to write a text in Arabic, threw it into the chat and he immediately left. Took a spam message from a bot and redirected it to a chat. Removed. But if the bot itself adds a message with a file and a description, then it is not deleted by my bot. The screenshot shows an example of such a message, which is deleted if it is forwarded to the same chat, but not deleted if it is added by a spam bot:
5be2c56dd9015168726658.jpeg
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Shatokhin, 2018-11-07
@georgich

Bots do not receive messages sent by other bots. This is a bot api limitation. This can be implemented on the client api (try the official one or the popular one on python )

P
pin1, 2019-01-14
@pin1

Don't thank.
https://t.me/bot_antispambot
or in the telegram itself in the search, type in
@bot_antispambot

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question