-
Notifications
You must be signed in to change notification settings - Fork 120
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
Rework permission checks #286
Rework permission checks #286
Conversation
Okay, currently this code is a mess because of cache and no cache support, and I see you adding the signature Can you abstract the distinct operations that need difference between cache and http into functions in a different file that we can switch between? |
Lets go from where the most recent commit is, what else ideally should be done to make this more presentable and maintainable? |
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.
Okay, this looks a bit better (may just be me getting some sleep). Just a few improvements that will make this even better, and some testing needs to be done if not already.
3c79dbc
to
fb0e42d
Compare
4e1af94
to
a58868b
Compare
b49f06f
to
6fe6a0a
Compare
91e9613
to
054f9ed
Compare
Closing in favor of #325. |
This shouldn't be breaking in the traditional sense, but does theoretically change behaviour in one case.
Previously, when the bots permissions could not be checked, it let the command run, now it fires a UserPermissionsError, there isn't really a nice way of checking where the error came from because the only place this can happen is in http requests.
The guild, channel or member itself could be the failure point, the only place we can now tell is directly on which member failed to fetch and return the "right" error from there.
I've placed a comment in the code about it, I just want to check if this is okay or if I should attempt to get the right error even though the only place it can come from is http.
I can pull the member from the cache too if that is desirable, but developers without
GUILD_MEMBERS
may suffer from this change. I believe checking for this is doable by directly accessingHttp
, but this is currently out of scope and can be handled later if that is desirable.In
serenity-next
the channel http request has already been removed and I'd rather not mess around doing that bit manually and falling back to http if it isn't cached.CURRENTLY UNTESTED.