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

fix(interactions): improve fallbacks in resolved data #646

Merged
merged 5 commits into from
Jul 21, 2022

Conversation

shiftinv
Copy link
Member

Summary

Improves channel/guild fallbacks in resolved interaction data, also fixing typing issues.
Resolves #644.

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, ...)

@shiftinv shiftinv added this to the disnake v2.6 milestone Jul 20, 2022
Copy link
Member

@onerandomusername onerandomusername left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is mostly good, although there is still a minor somewhat-bug, but I think this out of scope of this pull request.

With a command defined as

async def noguild(self, inter: disnake.CommandInteraction, channel: disnake.abc.GuildChannel) -> None:

the results of the variables are as follows:

>>> inter.channel.guild
Traceback (most recent call last):
  File "<string>", line 1, in <module>
AttributeError: 'PartialMessageable' object has no attribute 'guild'
>>> channel.guild
<Object id=755083284416954428>
>>> inter.guild
None

However, because inter.guild and inter.channel.guild stay consistent to what they would have been previously, there isn't really a change in behavior in this pull. The only inconsistent part is the provided channel has a guild attribute which isn't a guild attribute.

But given the current change in behavior this pull provides isn't a regression either, IMO.

@shiftinv
Copy link
Member Author

@onerandomusername Good point. Should keep that in mind, as far as I can tell that would potentially be fixed by #647

@onerandomusername onerandomusername merged commit c7fc91f into master Jul 21, 2022
@onerandomusername onerandomusername deleted the fix/appcmd-resolved branch July 21, 2022 22:54
shiftinv added a commit that referenced this pull request Jul 21, 2022
Co-authored-by: arl <genericusername414+git@gmail.com>
shiftinv added a commit that referenced this pull request Jul 21, 2022
Co-authored-by: arl <genericusername414+git@gmail.com>
@shiftinv shiftinv removed backport needed: 2.5 s: needs review Issue/PR is awaiting reviews labels Jul 21, 2022
@onerandomusername onerandomusername added s: in progress Issue/PR is being worked on s: waiting for api/docs Issue/PR is waiting for API support/documentation and removed s: in progress Issue/PR is being worked on s: waiting for api/docs Issue/PR is waiting for API support/documentation labels Jul 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Process crashing without any intents
2 participants