Closed khigor777 closed 9 months ago
If you are using the EchoBot example as a template, did you remember to edit it to import GroupSearchResponse
?
If not, use:
from kik_unofficial.datatypes.xmpp.roster import GroupSearchResponse
I've posted working example source code for you to reference here. I hope this helps!
sure I adedd this import
from kik_unofficial.datatypes.xmpp.roster import FetchRosterResponse, PeersInfoResponse, GroupSearchResponse
Great! Did this fix your problem?
No, here is the full example: https://pastebin.com/4aPF5Tud
I set up breakpoint in def on_group_search_response method, but it doesn't invoke.
You can't search for groups until your bot is authenticated, the code you provided attempts to search for groups immediately, prior to your bot being authenticated. I've made two edited copies of your code to demonstrate solutions to this.
Easy solution: Move search_group
to under on_authenticated
(Edited code here)
Another solution: Use a while loop to wait until bot is authenticated before triggering search_group
(Edited code here)
Thanks a lot, works correctly, but after when I find groups I need token to join them, in documentation wrote that I can fetch it from GroupSearchResponse in def on_group_search_response(self, response: GroupSearchResponse)
method, but what property should I use from GroupSearchResponse
?
Use self.group_join_token
If you peek over at line 181 of roster.py, you'll notice that GroupSearchResponse
doesn't return tokens by default, but I just made a fork and edited that line to return the tokens too. (Example here.)
In order to join groups you also need to make some more edits to bypass the safetynet check or it will raise the 400/bad-request error, this is discussed in more detail in my response to #207.
Edit: I don't intend on elaborating further on how to bypass the safetynet check here, due to the thot bot issue BlueMods mentioned in that previous issue. Honestly though its not worth the trouble with how often it times out anyways.
When I make
search_group
request ,def on_group_search_response
callback doesn't invoke. Any help?