i'm just implementing a simple bot who should send some photos and videos to my chat_id
.
Well, i'm using python, this is the script
import sys
import time
import random
import datetime
import telepot
def handle(msg):
chat_id = msg['chat']['id']
command = msg['text']
print 'Got command: %s' % command
if command == 'command1':
bot.sendMessage(chat_id, *******)
elif command == 'command2':
bot.sendMessage(chat_id, ******)
elif command == 'photo':
bot.sendPhoto(...)
bot = telepot.Bot('*** INSERT TOKEN ***')
bot.message_loop(handle)
print 'I am listening ...'
while 1:
time.sleep(10)
In the line bot.sendphoto
I would insert the path and the chat_id
of my image but nothing happens.
Where am I wrong?
thanks
you can use following lines:
You need to pass 2 params
I've tried also sending from python using requests. Maybe it's late answer, but leaving this here for others like me.. maybe it'll come to use.. I succeded with
subprocess
like so:I have used the following command while using python-telegram-bot to send the image along with a caption:
sendPhoto requires at least two parameters; first one is target chat_id, and for second one photo you have three options: