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: 🐛 Fix Interaction.channel incorrectly set #2658

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

Paillat-dev
Copy link
Contributor

@Paillat-dev Paillat-dev commented Nov 28, 2024

Summary

InteractionPayload["channel"] is partial, thus, when creating a GuildChannel object from it, some attributes were missing/incorrectly set. With this pr, InteractionPayload["channel"] is used only in the following cases:

  1. When the interaction happens in private channels.
  2. When the channel is missing from the bot's cache.

In all other cases, it uses the full channel object from the cache.

Information

  • This PR fixes an issue.
    fixes: permissions_for returning wrong permissions #2281
  • 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, typehinting,
    examples, ...).

Checklist

  • I have searched the open pull requests for duplicates.
  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • If type: ignore comments were used, a comment is also left explaining why.
  • I have updated the changelog to include these changes.

@Paillat-dev Paillat-dev force-pushed the fix-interaction-channel-perms branch from 8683daa to 96a3141 Compare November 28, 2024 08:57
@Paillat-dev Paillat-dev changed the title 🐛 Fix Interaction.channel incorrectly set fix: 🐛 Fix Interaction.channel incorrectly set Nov 28, 2024
@NeloBlivion
Copy link
Member

Removing cached_channel makes this a breaking change; at most, it should be deprecated.

@Paillat-dev
Copy link
Contributor Author

Ok

Copy link
Member

@JustaSqu1d JustaSqu1d left a comment

Choose a reason for hiding this comment

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

please fix changelog entry

CHANGELOG.md Outdated Show resolved Hide resolved
discord/interactions.py Outdated Show resolved Hide resolved
@@ -306,12 +318,12 @@ def is_component(self) -> bool:
return self.type == InteractionType.component

@utils.cached_slot_property("_cs_channel")
@utils.deprecated("Interaction.channel", "2.7", stacklevel=4)
Copy link
Member

Choose a reason for hiding this comment

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

Why deprecate

Copy link
Contributor Author

@Paillat-dev Paillat-dev Dec 26, 2024

Choose a reason for hiding this comment

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

Nelo said I should deprecate instead of remove since I removed it in the beginning.
It makes no sense to have it imo, it provides at best the same as .channel and at worst just partials that serve no purpose that .channel would not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

permissions_for returning wrong permissions
5 participants