skip to Main Content

I am working with pyTelegramBotAPI, and I was checking the deleteMessage method, and it says you have 48 hours ( in a group / channel ) for delete a message, but, I don’t find the way to put the timer, ¿can somebody help?

2

Answers


  1. If by "timer" you mean an attribute that may specify when to delete the message, you will hardly find it there.
    What the documentation means by

    A message can only be deleted if it was sent less than 48 hours ago.

    is that once you send the message, after you send a message, you have 48 hours to use this endpoint to delete the request.

    If you want to delete it after some time, you need to implement some kind of scheduling in you application (probably the one that sends the messages)

    For that you might want to use Python’s sched or schedule or something more advance like Celery Beat.

    Login or Signup to reply.
  2. You must remember the chat and the message id and delete it later by calling the method. Delayed deletion is not implemented in telegram API.

    As an option, write a separate daemon that will perform certain actions at a certain time

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search