-
Notifications
You must be signed in to change notification settings - Fork 139
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
feat!: provide guild objects in interactions when guild is uncached #647
Conversation
1d67a4c
to
410fdc0
Compare
1b0b7d3
to
b4f0d76
Compare
a59c849
to
b1a9c4b
Compare
b1a9c4b
to
1c59659
Compare
1c59659
to
ac6c00a
Compare
ac6c00a
to
a935318
Compare
c0ef536
to
b7ec407
Compare
1a6d269
to
24032b9
Compare
24032b9
to
0efcc5a
Compare
0efcc5a
to
4ac1a69
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.
If this is changed now, we should look at other occurences of _get_guild
where a guild may not be cached (like invites), and change them accordingly as well.
With the changes in this PR, this part could be simplified too:
disnake/disnake/interactions/application_command.py
Lines 396 to 402 in 076adda
guild: Optional[Guild] = None | |
# `guild_fallback` is only used in guild contexts, so this `MISSING` value should never be used. | |
# We need to define it anyway to satisfy the typechecker. | |
guild_fallback: Union[Guild, Object] = MISSING | |
if guild_id is not None: | |
guild = state._get_guild(guild_id) | |
guild_fallback = guild or Object(id=guild_id) |
I think this might be fine how it is (for now) since it somewhat moves the exceptions to a different point. OTOH repr for a thread will no longer crash in this case. |
30debeb
to
63a640e
Compare
63a640e
to
30b08af
Compare
30b08af
to
4bdccd0
Compare
Closing this for now, since the API provides a (very) partial guild object as of a few weeks ago, which we should implement instead. |
Summary
Checklist
task lint
task pyright