diff --git a/README.rst b/README.rst index c02a7481..7a62dd48 100644 --- a/README.rst +++ b/README.rst @@ -61,7 +61,7 @@ Getting last messages sent .. code-block:: python - last_messages = client.getThreadInfo(friend.uid,0) + last_messages = client.getThreadInfo(friend.uid, last_n=20) last_messages.reverse() # messages come in reversed order for message in last_messages: diff --git a/fbchat/client.py b/fbchat/client.py index 91434b3c..633124c8 100644 --- a/fbchat/client.py +++ b/fbchat/client.py @@ -609,7 +609,7 @@ def getThreadInfo(self, userID, last_n=20, start=None, is_user=True): # `start` doesn't matter, always returns from the last # data['messages[{}][{}][offset]'.format(key, userID)] = start data = {'messages[{}][{}][offset]'.format(key, userID): 0, - 'messages[{}][{}][limit]'.format(key, userID): last_n, + 'messages[{}][{}][limit]'.format(key, userID): last_n - 1, 'messages[{}][{}][timestamp]'.format(key, userID): now()} r = self._post(MessagesURL, query=data)