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

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

Open
alebuffoli opened this issue Mar 21, 2019 · 0 comments
Open

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

alebuffoli opened this issue Mar 21, 2019 · 0 comments

Comments

@alebuffoli
Copy link

alebuffoli commented Mar 21, 2019

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant