相关疑难解决方法(0)

在带有图像的电报机器人中发送消息

我在php上有电报机器人代码,并通过replyWithMessage方法发送回复消息.

所有命令在这里:

 $this->replyWithMessage(['text' => $item['title']. "\n\n" . $url]);
Run Code Online (Sandbox Code Playgroud)

如何在文本之前添加一些预览图像?

php telegram telegram-bot

8
推荐指数
3
解决办法
4万
查看次数

如何在电报机器人上发送照片

我只是实现了一个简单的机器人,该机器人应该将一些照片和视频发送给我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图像的路径和,但是什么也没有发生。

我哪里错了?

谢谢

python telegram-bot telepot

7
推荐指数
6
解决办法
1万
查看次数

标签 统计

telegram-bot ×2

php ×1

python ×1

telegram ×1

telepot ×1