【发布时间】:2018-11-16 22:27:39
【问题描述】:
最近我编写的代码应该将来自某个用户的每条消息转发到我加入的所有组,但它没有。 这是我的代码:
for message in client.iter_messages('aliakhtari78'):
try:
dialogs = client.get_dialogs()
for dialog in dialogs:
id_chat = dialog.message.to_id.channel_id
entity = client.get_entity(id_chat)
client.forward_messages(
entity, # to which entity you are forwarding the messages
message.id, # the IDs of the messages (or message) to forward
'somebody' # who sent the messages?
)
except:
pass
在此代码中,我首先获取 'aliakhtari78' 发送给我的每条消息,然后获取我加入的群组的实体,最后它应该将消息转发给所有群组,但它没有,我检查我的代码并用用户实体替换实体并且它有效,我知道问题是因为实体,但我无法找出我的问题。 另外,很抱歉在我的问题中写错了。
【问题讨论】:
标签: python python-3.x telegram python-telegram-bot telethon