Skip to content
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

Client.iter_history(offset_date=<some date>, reverse=True) ignoring offset_date #494

Open
pramen opened this issue Sep 23, 2020 · 2 comments
Open

Comments

@pramen
Copy link

@pramen pramen commented Sep 23, 2020

Checklist

  • I am sure the error is coming from Pyrogram's code and not elsewhere.
  • I have searched in the issue tracker for similar bug reports, including closed ones.
  • I ran pip3 install -U https://github.com/pyrogram/pyrogram/archive/master.zip and reproduced the issue using the latest development version.

Description

When i use Client.iter_history(offset_date=, reverse=True) it returns all history without offset_date limits. I.e. I get messages created before offset_date and after offset_date.
This is undocumented here behavior?
Or this its a bug?

Would be good to fix this behavior to get messages older that date in reverse order.
And better for me, if it possible, to get messages newest that date in reverse order, as i feature requested in 495
Thank you.

Steps to Reproduce

offset = int(datetime(year=2020, month=9, day=14, hour=4).timestamp())
    for m in app.iter_history('me', offset_date=offset, reverse=True):
        print(datetime.fromtimestamp(m.date).strftime('%Y%m%d/%H:%M:%S'), m.message_id)

My out:

20200912/04:36:41 53361
20200912/04:36:48 53362
20200912/21:36:49 53387
20200914/03:05:36 53510
20200920/12:56:04 54064
20200921/02:09:35 54074

Without offset_date and reverse=True output the same but reversed (its OK):

for m in app.iter_history('me'):
    print(datetime.fromtimestamp(m.date).strftime('%Y%m%d/%H:%M:%S'), m.message_id)

My out:

20200921/02:09:35 54074
20200920/12:56:04 54064
20200914/03:05:36 53510
20200912/21:36:49 53387
20200912/04:36:48 53362
20200912/04:36:41 53361

With offset_date only everything works fine, and messages limiting by creation date:

offset = int(datetime(year=2020, month=9, day=14, hour=4).timestamp())
    for m in app.iter_history('me', offset_date=offset):
        print(datetime.fromtimestamp(m.date).strftime('%Y%m%d/%H:%M:%S'), m.message_id)

Out:

20200914/03:05:36 53510
20200912/21:36:49 53387
20200912/04:36:48 53362
20200912/04:36:41 53361

@pramen pramen changed the title pyrogram.Client.iter_history(offset_date=<some date>, reverse=True) ignoring offset_date Client.iter_history(offset_date=<some date>, reverse=True) ignoring offset_date Sep 23, 2020
@akashkj
Copy link

@akashkj akashkj commented Oct 1, 2020

Can I look into this?

@pramen
Copy link
Author

@pramen pramen commented Oct 10, 2020

Can I look into this?

This behavior happened in any telegram group. Just run examples that i write above. Or i didn't get what do you mean?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.