Python 转发消息bot电报
我使用python Telegrame bot,我不知道如何将消息从用户转发到Telegrame组,我有这样的东西:Python 转发消息bot电报,python,bots,telegram,Python,Bots,Telegram,我使用python Telegrame bot,我不知道如何将消息从用户转发到Telegrame组,我有这样的东西: def feed(bot, update): bot.send_message(chat_id=update.message.chat_id, text="reply this message" bot.forward_message(chat_id="telegram group", from_chat_id="username bot", message_id=?)
def feed(bot, update):
bot.send_message(chat_id=update.message.chat_id, text="reply this message"
bot.forward_message(chat_id="telegram group", from_chat_id="username bot", message_id=?)
我需要转发用户共享的消息,回复必须发送到一个组
怎么可能呢?发件人:聊天室id-目标聊天室的唯一标识符…
来自聊天室\u id-发送原始消息的聊天室的唯一标识符。
消息\u id-在from\u chat\u id中指定的聊天中的消息标识符 解决方案:
def feed(bot, update):
# send reply to the user
bot.send_message(chat_id=update.message.chat_id,
text='reply this message')
# forward user message to group
# note: group ID with the negative sign
bot.forward_message(chat_id='-1010101001010',
from_chat_id=update.message.chat_id,
message_id=update.message.message_id)
使用
Telethon
很容易
您需要聊天室id
,来自聊天室id
你可以添加一个机器人,你将需要令牌