【发布时间】:2016-08-15 04:04:05
【问题描述】:
我只是在实现一个简单的机器人,它应该将一些照片和视频发送到我的chat_id。
嗯,我用的是python,这是脚本
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()吗?请修复您发布的代码中的缩进。 -
如果您将
telegram response告诉您的请求可能会很有帮助
标签: python telegram-bot telepot