如何将消息从机器人(不是人)转发到聊天
how to forward a message from the bot(not a person) to a chat
我想将我的机器人和另一个人的整个对话转发给我自己
这是我的代码:
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
但是当我尝试转发来自 bot 的消息时出现此错误:
telepot.exception.TelegramError: ('Bad Request: message to forward not found', 400, {'ok': False, 'error_code': 400, 'description': 'Bad Request: message to forward not found'})
我做错了什么吗?
还是只是被telegram限制了?
转发的第二个参数应该是原始聊天ID,而不是用户ID。
尝试调用:
bot.forwardMessage(my_id, bot_msg['chat']['id'], bot_msg['message_id'])
我想将我的机器人和另一个人的整个对话转发给我自己
这是我的代码:
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
但是当我尝试转发来自 bot 的消息时出现此错误:
telepot.exception.TelegramError: ('Bad Request: message to forward not found', 400, {'ok': False, 'error_code': 400, 'description': 'Bad Request: message to forward not found'})
我做错了什么吗? 还是只是被telegram限制了?
转发的第二个参数应该是原始聊天ID,而不是用户ID。 尝试调用:
bot.forwardMessage(my_id, bot_msg['chat']['id'], bot_msg['message_id'])