Deleting message text using telepot

38 Views Asked by At

Please be indulgent. I'm a beginner. I am running a Python PIR (motion detection) script on my Raspberry Pi which sends notification if motion is triggered. The script is using Telepot to interact with Telegram.

Here is the part of the script concerned by the problem:

    while True:

    if telegramText.lower() == '/start':
           bot.sendMessage(chat_id, 'Your security camera is activated.')

    while 1:
       time.sleep(10)

Tried: Send a message text to telegram
expected: receive one response
actually: received huge number of responses

When I execute the script and send the /start message I receive a huge number of answers: (Your security camera is activated.) because it's inside the infinite loop.

My question is how to delete the message (/start) from the telegram server so I get just one response (i.e. what is the instruction to put after receiving the bot message in order to delete my /start message?

Thanks in advance.

0

There are 0 best solutions below