Skip to content
This repository was archived by the owner on Jun 2, 2019. It is now read-only.
This repository was archived by the owner on Jun 2, 2019. It is now read-only.

Deletting all messages sent by my bot into a chat. #455

@alebuffoli

Description

@alebuffoli

Hello.
I'm trying hard to delete all the messages sent by my bot into a chat.
I know that it is not possible to delete the messages sent by the user, so, i want at least delete all the messages sent by my bot.

so far to save a message id sent from my bot I use this code

messages_ids.update({chat_id: lastMessage})

That store in a dictionary the chat ID and all the information about the last messages that the bot sent.

Then, I delete the last message whit this method:

bot.deleteMessage(telepot.message_identifier(messages_ids[chat_id]))

But obviously I can't delete the message sent to a user before I implemented this method.
So, to clear the old chats, can I delete in someway all the message sent by my bot?

Or maybe there is a way to get all the messages ids of messages already sent? In this way I'd do a for cycle.
But I cannot do a for cycle without the ids because I should check hundred thousand messages for chat and obviously it would be really slow and annoying.

Hopefully there is an easier solution, Thankyou.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions