我向用户发送了很多消息。我需要知道已经看到了哪些消息
我使用了SearchRequest
,但是它对消息没有任何怀疑。
result = client(SearchRequest(
peer=ahmad, # On which chat/conversation
q='', # What to search for
filter=InputMessagesFilterEmpty(), # Filter to use (maybe filter for media)
min_date=None, # Minimum date
max_date=None, # Maximum date
offset_id=0, # ID of the message to use as offset
add_offset=0, # Additional offset
limit=20, # How many results
max_id=0, # Maximum message ID
min_id=0, # Minimum message ID
from_id=None, # Who must have sent the message (peer)
hash=0 # Special number to return nothing on no-change
))
if result:
print(result.count)
for message in result.messages:
print(message)
for chat in result.chats:
print(chat)
for user in result.users:
print(user)
输出:
Message(id=299213, to_id=PeerUser(user_id=74509408), date=datetime.datetime(2018, 8, 29, 7, 57, 9, tzinfo=datetime.timezone.utc), message='hello', out=True, mentioned=False, media_unread=False, silent=False, post=False, from_id=74509408, fwd_from=None, via_bot_id=None, reply_to_msg_id=None, media=None, reply_markup=None, entities=[], views=None, edit_date=None, post_author=None, grouped_id=None)
此外,GetMessagesViewsRequest
仅适用于频道消息,不适用于用户。
print(client(GetMessagesViewsRequest(
peer=ahmad,
id=[299049],
increment=True
)))
输出:
[0]