python - How to send photo on telegram bot -
i'm implementing simple bot should send photos , videos chat_id
. well, i'm using python, 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 listening ...' while 1: time.sleep(10)
in line bot.sendphoto
insert path , chat_id
of image nothing happens.
where wrong?
thanks
you need pass 2 params
bot.sendphoto(chat_id, 'url')
Comments
Post a Comment