Merge pull request #75 from dcep93/enable_friend_request_accept
friend_connect and the like
This commit is contained in:
@@ -39,6 +39,7 @@ StickyURL ="https://0-edge-chat.facebook.com/pull"
|
|||||||
PingURL ="https://0-channel-proxy-06-ash2.facebook.com/active_ping"
|
PingURL ="https://0-channel-proxy-06-ash2.facebook.com/active_ping"
|
||||||
UploadURL ="https://upload.facebook.com/ajax/mercury/upload.php"
|
UploadURL ="https://upload.facebook.com/ajax/mercury/upload.php"
|
||||||
UserInfoURL ="https://www.facebook.com/chat/user_info/"
|
UserInfoURL ="https://www.facebook.com/chat/user_info/"
|
||||||
|
ConnectURL ="https://www.facebook.com/ajax/add_friend/action.php?dpr=1"
|
||||||
RemoveUserURL="https://www.facebook.com/chat/remove_participants/"
|
RemoveUserURL="https://www.facebook.com/chat/remove_participants/"
|
||||||
LogoutURL ="https://www.facebook.com/logout.php"
|
LogoutURL ="https://www.facebook.com/logout.php"
|
||||||
|
|
||||||
@@ -465,6 +466,19 @@ class Client(object):
|
|||||||
r = self._post(MarkSeenURL, {"seen_timestamp": 0})
|
r = self._post(MarkSeenURL, {"seen_timestamp": 0})
|
||||||
return r.ok
|
return r.ok
|
||||||
|
|
||||||
|
def friend_connect(self, friend_id):
|
||||||
|
data = {
|
||||||
|
"to_friend": friend_id,
|
||||||
|
"action": "confirm"
|
||||||
|
}
|
||||||
|
|
||||||
|
r = self._post(ConnectURL, data)
|
||||||
|
|
||||||
|
if self.debug:
|
||||||
|
print(r)
|
||||||
|
print(data)
|
||||||
|
return r.ok
|
||||||
|
|
||||||
|
|
||||||
def ping(self, sticky):
|
def ping(self, sticky):
|
||||||
data = {
|
data = {
|
||||||
@@ -559,6 +573,9 @@ class Client(object):
|
|||||||
fbid = m['delta']['messageMetadata']['actorFbId']
|
fbid = m['delta']['messageMetadata']['actorFbId']
|
||||||
name = None
|
name = None
|
||||||
self.on_message(mid, fbid, name, message, m)
|
self.on_message(mid, fbid, name, message, m)
|
||||||
|
elif m['type'] in ['jewel_requests_add']:
|
||||||
|
from_id = m['from']
|
||||||
|
self.on_friend_request(from_id)
|
||||||
else:
|
else:
|
||||||
if self.debug:
|
if self.debug:
|
||||||
print(m)
|
print(m)
|
||||||
@@ -678,6 +695,13 @@ class Client(object):
|
|||||||
print("%s said: %s"%(author_name, message))
|
print("%s said: %s"%(author_name, message))
|
||||||
|
|
||||||
|
|
||||||
|
def on_friend_request(self, from_id):
|
||||||
|
'''
|
||||||
|
subclass Client and override this method to add custom behavior on event
|
||||||
|
'''
|
||||||
|
print("friend request from %s"%from_id)
|
||||||
|
|
||||||
|
|
||||||
def on_typing(self, author_id):
|
def on_typing(self, author_id):
|
||||||
'''
|
'''
|
||||||
subclass Client and override this method to add custom behavior on event
|
subclass Client and override this method to add custom behavior on event
|
||||||
|
Reference in New Issue
Block a user