Quantcast
Viewing all articles
Browse latest Browse all 3780

Troubleshooting • Need help with Telepot

Hi. Please be indulgent since i'm a beginner.
I am trying to delete the outgoing message sent by myself to telegram without success.
Here is the part of my script :

Code:

import timeimport oscurrentTime = time.time()tomorrow = currentTime + 43320import telepotfrom picamera import PiCameraimport RPi.GPIO as GPIOfrom time import sleepimport datetimefrom telepot.loop import MessageLoopfrom subprocess import call PIR    = 4camera = PiCamera()camera.resolution = (640, 480)camera.framerate = 25GPIO.setwarnings(False)  GPIO.setmode(GPIO.BCM)GPIO.setup(PIR, GPIO.IN)motion = 0motionNew = 0 def handle(msg):    global telegramText    global chat_id    global message_idchat_id = msg['chat']['id']    telegramText = msg['text']    message_id = msg['message_id']    MessageId = message_id      print('Message received from ' + str(chat_id))              if telegramText == '/start':                print(MessageId) # Here I'm getting my message Id without problem        time.sleep(5)                bot.sendMessage(chat_id, 'Security camera is activated.')                bot.deleteMessage(chat_id,MessageId,) # Here occurs  My Problem                print('The message has been deleted')        time.sleep(10)
When executing the script everything is going ok BUT i'm getting this message related to the message deletion :
TypeError: deleteMessage() takes 2 positional arguments but 3 were given .
What i'm doing wrong. Thanks for any help

Statistics: Posted by Eddy25 — Tue Feb 06, 2024 5:08 pm



Viewing all articles
Browse latest Browse all 3780

Trending Articles