Python 如何检测我的电报信息是否已被telethon阅读?
我使用telethon通过电报向联系人发送了多条消息,但我没有使用此事件来知道这些消息是否被直接读取,因此我想检查我的消息是否被读取或没有使用其他方法Python 如何检测我的电报信息是否已被telethon阅读?,python,telegram,telethon,Python,Telegram,Telethon,我使用telethon通过电报向联系人发送了多条消息,但我没有使用此事件来知道这些消息是否被直接读取,因此我想检查我的消息是否被读取或没有使用其他方法 @client.on(events.MessageRead) async def handler(event): # Log when someone reads your messages print('Someone has read all your messages until', event.max_id) 我阅读了
@client.on(events.MessageRead)
async def handler(event):
# Log when someone reads your messages
print('Someone has read all your messages until', event.max_id)
我阅读了完整的文档,但找不到答案。是否还有其他方法可以知道该消息是否已阅读,或者是否使用其id作为示例?cz即使在我调用get_dialogs()函数时,它也会给我上一条消息的ID,而不是用户上次阅读的消息的ID,作为给出的注释获取
对话框
,在该对话框中您使用发送消息
,如果read_outbox_max_ID
属性等于或高于消息.ID
,消息已被阅读
chat = 'INSERT_CHAT'
msg_id = (await client.send_message(chat, 'YOUR_TEXT')).id
# get the Dialog where you sent the message
result = await client(functions.messages.GetPeerDialogsRequest(
peers=[chat]
))
# check if the message has been read
if result.dialogs[0].read_outbox_max_id >= msg_id:
print('the message has been read')
else:
print('the message has not been read yet')
谢谢,GetPeerDialogsRequest()函数正在完成它的工作:)