-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to get a specific number of messages from history #31
Labels
Comments
I can reproduce that bug. I'll look into it. from pytg.sender import Sender ; s = Sender("localhost", 4458)
n_messages = len(s.history('my_contact', '10'))
print("Length is {length}".format(length=n_messages))
# 40 |
I located the bug. The problem is that the '10' is a string, so the optional parameter import logging ; logging.basicConfig(level=logging.DEBUG)
s.history('my_contact', '10')
# log shows:
DEBUG:pytg.sender:Parsing history: Argument user_name - <user> (needed)
DEBUG:pytg.sender:Parsing history: Argument 10 - [limit] (needed)
pytg.exceptions.ArgumentParseError: Not a int/long
DEBUG:pytg.sender:Skipping unfitting optional parameter #1 [limit] (type PositiveNumber) in function history.
DEBUG:pytg.sender:Parsing history: Argument 10 - [offset] (needed)
pytg.exceptions.ArgumentParseError: Not a int/long
DEBUG:pytg.sender:Skipping unfitting optional parameter #1 [offset] (type NonNegativeNumber) in function history.
DEBUG:pytg.sender:Sending command > [disable_preview] history user_name |
So that works like intended, the actual problem is that the int as argument does not work (#32). |
Fixed. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
I am trying to save the chat history into a file. However, when I use the execute_function function, I always get 40 results (the default number)
What is the way for specify the size of the history?
Thanks!
The text was updated successfully, but these errors were encountered: