-
Notifications
You must be signed in to change notification settings - Fork 209
fix(history_iterator): messages repeat if before & after not set #1273
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
base: master
Are you sure you want to change the base?
Conversation
teaishealthy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't seem to get more than 100 messages
counter = 0
async for _ in channel.history(limit=200):
counter += 1
print(counter) # 100 (?)in order to fix the functionality, the oldest_first parameter now defaults to True and the after parameter defaults to OLDEST_OBJECT to mimick the desired default behavior of fetching limit messages from the beginning of channel history.
|
this might be more than a fix now, it's a semi-refactor to try and more closely match the original discord.py behavior while fixing the desired result to fetch limit messages from the beginning of channel history. :p |
|
ran a few tests master EmmmaTech/fix/async-iterators |
|
oops accidentally closed this |
|
could you share the testing code you used so I can locally test with my own changes? :> |
|
@EmmmaTech make sure to configure the constants at the top of the file, then just call run_history_tests with a TextChannel |
Summary
fixes #1238, an issue introduced with the async iterator rewrite in 3.0 where messages would loop every 100 messages due to the
afterparameter never being updated. I also updated the documentation a bit to clarify this default behavior of the iterator since the original documentation never mentions it.This is a Code Change
task pyrightand fixed the relevant issues.