我在php上有电报机器人代码,并通过replyWithMessage方法发送回复消息.
所有命令在这里:
$this->replyWithMessage(['text' => $item['title']. "\n\n" . $url]);
Run Code Online (Sandbox Code Playgroud)
如何在文本之前添加一些预览图像?
我只是实现了一个简单的机器人,该机器人应该将一些照片和视频发送给我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)
Run Code Online (Sandbox Code Playgroud)
在这一行中,bot.sendphoto我将插入chat_id图像的路径和,但是什么也没有发生。
我哪里错了?
谢谢