diff --git a/README.rst b/README.rst index 816e6a02..87b5249f 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 0595db34..8d110694 100644 --- a/fbchat/client.py +++ b/fbchat/client.py @@ -616,7 +616,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)