我只是實現一個簡單的機器人誰應該發送一些照片和視頻到我的chat_id
。 好,我使用的蟒蛇,這是腳本如何在電報機器人上發送照片
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)
在行bot.sendphoto
我會插入路徑和我的形象的chat_id
但沒有任何反應。
我在哪裏錯了?
感謝
你能發佈到'sendPhoto確切的調用()' ?並且請修改您的發佈代碼中的縮進。 –
如果您告訴您的請求有「電報迴應」,它可能會非常有用 –