diff --git a/fbchat/_client.py b/fbchat/_client.py index 2f0b78a..8c6b564 100644 --- a/fbchat/_client.py +++ b/fbchat/_client.py @@ -1693,63 +1693,6 @@ class Client: "/ajax/mercury/mark_seen.php", {"seen_timestamp": _util.now()} ) - def friend_connect(self, friend_id): - """ - Todo: - Documenting this - """ - data = {"to_friend": friend_id, "action": "confirm"} - - j = self._payload_post("/ajax/add_friend/action.php?dpr=1", data) - - def remove_friend(self, friend_id=None): - """Remove a specified friend from the client's friend list. - - Args: - friend_id: The ID of the friend that you want to remove - - Returns: - True - - Raises: - FBchatException: If request failed - """ - data = {"uid": friend_id} - j = self._payload_post("/ajax/profile/removefriendconfirm.php", data) - return True - - def block_user(self, user_id): - """Block messages from a specified user. - - Args: - user_id: The ID of the user that you want to block - - Returns: - True - - Raises: - FBchatException: If request failed - """ - data = {"fbid": user_id} - j = self._payload_post("/messaging/block_messages/?dpr=1", data) - return True - - def unblock_user(self, user_id): - """Unblock a previously blocked user. - - Args: - user_id: The ID of the user that you want to unblock - - Returns: - Whether the request was successful - - Raises: - FBchatException: If request failed - """ - data = {"fbid": user_id} - j = self._payload_post("/messaging/unblock_messages/?dpr=1", data) - return True - def move_threads(self, location, thread_ids): """Move threads to specified location. diff --git a/fbchat/_user.py b/fbchat/_user.py index da35652..1224fbe 100644 --- a/fbchat/_user.py +++ b/fbchat/_user.py @@ -82,6 +82,26 @@ class User(Thread): #: The default emoji emoji = attr.ib(None) + def confirm_friend_request(self): + """Confirm a friend request, adding the user to your friend list.""" + data = {"to_friend": self.id, "action": "confirm"} + j = self.session._payload_post("/ajax/add_friend/action.php?dpr=1", data) + + def remove_friend(self): + """Remove the user from the client's friend list.""" + data = {"uid": self.id} + j = self.session._payload_post("/ajax/profile/removefriendconfirm.php", data) + + def block(self): + """Block messages from the user.""" + data = {"fbid": self.id} + j = self.session._payload_post("/messaging/block_messages/?dpr=1", data) + + def unblock(self): + """Unblock a previously blocked user.""" + data = {"fbid": self.id} + j = self.session._payload_post("/messaging/unblock_messages/?dpr=1", data) + @classmethod def _from_graphql(cls, session, data): if data.get("profile_picture") is None: