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

feat!: provide guild objects in interactions when guild is uncached #647

Closed
wants to merge 1 commit into from

Conversation

onerandomusername
Copy link
Member

Summary

Checklist

  • If code changes were made, then they have been tested
    • I have updated the documentation to reflect the changes
    • I have formatted the code properly by running task lint
    • I have type-checked the code by running task pyright
  • This PR fixes an issue
  • This PR adds something new (e.g. new method or parameters)
  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • This PR is not a code change (e.g. documentation, README, ...)

@onerandomusername onerandomusername added breaking change Includes breaking changes to code/packaging p: medium Medium priority s: in progress Issue/PR is being worked on s: needs review Issue/PR is awaiting reviews labels Jul 20, 2022
@onerandomusername onerandomusername added this to the disnake v2.6 milestone Jul 20, 2022
@onerandomusername onerandomusername force-pushed the feat/always-resolve-guild branch from 1d67a4c to 410fdc0 Compare July 22, 2022 00:29
@onerandomusername onerandomusername changed the title feat: provide guild objects in interactions when guild is uncached feat!: provide guild objects in interactions when guild is uncached Jul 22, 2022
@onerandomusername onerandomusername force-pushed the feat/always-resolve-guild branch 5 times, most recently from 1b0b7d3 to b4f0d76 Compare July 28, 2022 22:46
@onerandomusername onerandomusername force-pushed the feat/always-resolve-guild branch 2 times, most recently from a59c849 to b1a9c4b Compare August 3, 2022 00:20
@onerandomusername onerandomusername force-pushed the feat/always-resolve-guild branch from b1a9c4b to 1c59659 Compare August 13, 2022 22:58
@shiftinv shiftinv modified the milestones: disnake v2.6, disnake v2.7 Sep 1, 2022
@onerandomusername onerandomusername force-pushed the feat/always-resolve-guild branch from 1c59659 to ac6c00a Compare September 3, 2022 20:04
@onerandomusername onerandomusername force-pushed the feat/always-resolve-guild branch 2 times, most recently from c0ef536 to b7ec407 Compare September 26, 2022 14:04
@onerandomusername onerandomusername marked this pull request as ready for review September 26, 2022 14:04
@onerandomusername onerandomusername force-pushed the feat/always-resolve-guild branch 3 times, most recently from 1a6d269 to 24032b9 Compare October 1, 2022 18:28
@onerandomusername onerandomusername force-pushed the feat/always-resolve-guild branch from 24032b9 to 0efcc5a Compare October 4, 2022 05:01
@onerandomusername onerandomusername removed the s: in progress Issue/PR is being worked on label Oct 16, 2022
@onerandomusername onerandomusername force-pushed the feat/always-resolve-guild branch from 0efcc5a to 4ac1a69 Compare October 16, 2022 05:10
Copy link
Member

@shiftinv shiftinv left a 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:

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)

@onerandomusername
Copy link
Member Author

onerandomusername commented Oct 24, 2022

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.

@onerandomusername onerandomusername force-pushed the feat/always-resolve-guild branch 3 times, most recently from 30debeb to 63a640e Compare October 30, 2022 18:39
@shiftinv shiftinv modified the milestones: disnake v2.8, disnake v2.9 Feb 5, 2023
@onerandomusername onerandomusername force-pushed the feat/always-resolve-guild branch from 63a640e to 30b08af Compare February 22, 2023 04:54
@onerandomusername onerandomusername force-pushed the feat/always-resolve-guild branch from 30b08af to 4bdccd0 Compare February 22, 2023 04:55
@shiftinv shiftinv removed this from the disnake v2.9 milestone May 24, 2023
@shiftinv
Copy link
Member

Closing this for now, since the API provides a (very) partial guild object as of a few weeks ago, which we should implement instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Includes breaking changes to code/packaging p: medium Medium priority s: needs review Issue/PR is awaiting reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants