Closed PascalVH closed 3 years ago
Did you use the private or public jid. To receive the information you have to use the private jid if I remember right.
But I also never checked for the age and never saw this information anywhere.
No matter what Ido, I Can only see one type of jid formatted as: USERNAME_xyz@talk.kik.com. I Have no idea if that is the public or private one. I'm trying to get the information that in the Kik client is displayed as "X Days on Kik". When looking at the available properties, I would expect that this could be calculated out of "creation_date_seconds". But it is of course possible that I'm looking in the wrong direction ...
@PascalVH The following worked for me:
on_group_status_received you can do:
if response.status.find("has joined") > 0:
client.add_friend(response.status_jid)
We need to do that in order to get the "private jid". That add_friend
will trigger on_peer_info_received, there we can do something like:
def on_peer_info_received(self, response: PeersInfoResponse):
client.xiphias_get_users(response.users[0].jid)
xiphias_get_users will trigger on_xiphias_get_users_response, there you will get an UsersResponseUser
https://github.com/tomer8007/kik-bot-api-unofficial/blob/7b591c983377639a8550949c717faf5dfe289a20/kik_unofficial/datatypes/xmpp/xiphias.py#L48 where you can access creation_date_seconds
or creation_date_nanos
.
I hope that helps.
@fcoms Thanks a lot! The _on_xiphias_get_usersresponse after calling _client.xiphias_getusers indeed provides values for _creation_dateseconds while _on_peer_inforeceived doesn't. So in my case all I had to do extra was calling the _client.xiphias_getusers in _on_peer_inforeceived to get the missing info.
Thank you ver much for your help in solving my problem.
I'm trying to query the user details of users that join in a group to check the age of the account. When the on_group_status_received triggers I'll execute the following:
Then as expected, "on_peer_info_received" triggers but the received data is far from complete like described in #131.
This is the full response I receive (In response.raw_element):
<iq id="77df3f80-56dc-48fd-9afd-315042c59f89" to="[MYBOTUSER]@talk.kik.com/CAN620XXXXXXXXXXXXXXXXXXXXXXXXXXXXX" type="result"> <query xmlns="kik:iq:friend"> <item jid="[USERTHATJOINED]@talk.kik.com"> <username>USERNAME</username> <display-name>DISPLAY NAME</display-name> <pic ts="1604828788873">http://profilepics.cf.kik.com/somehash</pic> <pubkey/> </item> </query> </iq>
As I'm looking for the age of the account, I was expecting a value for "creation_date_seconds" in the response. I Tried to friend the user first (using "client.add_friend") like @Basti567 suggested in #131 and then triggering "client.request_info_of_users" again but that makes no difference.
Or is there another/better way to get the age of an account? Any help would be highly appreciated.