-
-
Notifications
You must be signed in to change notification settings - Fork 713
Add get or fetch util #1837
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
Add get or fetch util #1837
Conversation
d1bb951
to
4d01e9b
Compare
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.
LGTM
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.
There's a possible missed migration here (L143 of bot/exts/utils/reminders.py).
Also not sure but should the converter instead catch discord.ext.commands.MemberNotFound
(the actual error rather than a parent class)?
I purposefully skipped that since it's an generator, so I'd need to convert it to an async generator, so that cna be done in a different PR.
This isn't a convertor, this is calling |
Looks good then. There's also the fact that the equivalent util for channels is called |
abccccd
to
34484a8
Compare
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.
LGTM
34484a8
to
a2c369f
Compare
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.
Have you considered making the helper a bot instance method, having the guild
argument optional and defaulting to pydis? In some cases, caller code could then have:
bot.get_or_fetch_member(1234)
Instead of:
import guild id
import get_or_fetch_member
guild = self.bot.get_guild(guild id)
get_or_fetch_member(guild, member id)
I haven't thought about it much, maybe this is a bad idea.
a2c369f
to
fb33b46
Compare
I haven't tested anything so won't formally approve, but after a few things discussed on Discord this all looks good now 👍 |
It's changed quite a bit since this approval
This is now needed, as we're a large server it's not guaranteed that the member cache will always be fully populated.
This protects us against the guild cache not being fully populated with members.
Updated the test task to now run with --ff which runs failed tests from the last run first Added retest, which runs pytest with --lf this only runs the failed tests from the last test run
fb33b46
to
e52db75
Compare
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.
LGTM, tested and seems to work smoothly
This is now needed, as we have noticed that it's not guaranteed that the member cache will always be fully populated. Leading to members not having their help cooldown roles removed.