【发布时间】:2022-12-12 21:14:46
【问题描述】:
尝试从其中只有媒体(照片、文档、语音、视频)的消息访问 from_id 属性时出现错误。错误:
Traceback (most recent call last):
File "C:\Users\User\AppData\Local\Programs\Python\Python310\lib\site-packages\telethon\client\updates.py", line 467, in _dispatch_update
await callback(event)
File "d:\Code\asd\back.py", line 16, in on_message
await pl.add_message(f'saved/{event.peer_id.user_id}/chat.json', event)
File "d:\Code\asd\plugins.py", line 25, in add_message
'author': event.from_id.user_id if event.from_id.user_id != None else event.peer_id.user_id,
AttributeError: 'NoneType' object has no attribute 'user_id'
发送媒体时不会出现错误,只有当我将媒体发送给我时才会发生。 我希望你们中的一些人可以帮助我找到问题的答案。
我一直在尝试使用 peer_id 而不是 from_id,但这并没有帮助
【问题讨论】:
-
请显示您的代码