I want to delete the messages in group but the bot only deletes the last few messages, about the last ten minutes.
I'm using message_id decreasing for doing that
$lastMessageID = --$result ['message']['message_id'];
for ($i=0; $i <$n ; $i++) {
$content = array('chat_id' => $chat_id, 'message_id' => $lastMessageID);
$telegram->deleteMessage($content);
$lastMessageID--;
}
I have checked the return value of deleting command and everything is fine I receive the {"ok":1,"result":1}
and of course for some messages it has the "message to delete not found" and it goes on but suddenly it just stops with no error. for example the last return value is {"ok":1,"result":1}
or in some cases {ok:1}
and no more messages will be deleted.
and I have considered following issues:
- A message can only be deleted if it was sent less than 48 hours ago.
- The bot is an administrator of group for a year
- The bot has all the permissions