我想将我的机器人和另一个人的整个对话转发给我自己
这是我的代码:
import telepot
bot = telepot.Bot('<Token>')
def handle(msg):
my_id = 123456789 # this is my id for example
chat_id = telepot.glance(msg)[2]
bot_msg = bot.sendMessage(chat_id, 'this message is sent by bot')
bot.forwardMessage(my_id, bot_msg['from']['id'], bot_msg['message_id']) # this line gets error
但是当我尝试转发来自机器人的消息时,出现此错误:
telepot.exception.TelegramError: ('Bad Request: message to forward not found', 400, {'ok': False, 'error_code': 400, 'description': 'Bad Request: message to forward not found'})
我做错什么了吗? 还是仅受电报限制?
答案 0 :(得分:0)
要转发的第二个参数应该是原始聊天ID,而不是用户ID。 尝试致电:
bot.forwardMessage(my_id,bot_msg ['chat'] ['id'],bot_msg ['message_id'])