Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Dorukyum <[email protected]>
Signed-off-by: Middledot <[email protected]>
  • Loading branch information
Middledot and Dorukyum authored Nov 29, 2023
1 parent 639a43a commit d883718
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
5 changes: 1 addition & 4 deletions discord/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -712,10 +712,7 @@ def permissions_for(self, obj: Member | Role, /) -> Permissions:
return Permissions.all()

default = self.guild.default_role
if default:
base = Permissions(default.permissions.value)
else:
base = Permissions.none()
base = Permissions(default.permissions.value if default else 0)

# Handle the role case first
if isinstance(obj, Role):
Expand Down
7 changes: 3 additions & 4 deletions discord/interactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,9 @@ def _from_data(self, data: InteractionPayload):
self._permissions: int = 0

self._guild: Guild | None = None
if self.guild is None and (_guild_data := data.get("guild")):
self._guild = Guild(data=data, state=self)

self._guild_data = _guild_data
self._guild_data = data.get("guild")
if self.guild is None and self._guild_data:
self._guild = Guild(data=self._guild_data, state=self)

# TODO: there's a potential data loss here
if self.guild_id:
Expand Down

0 comments on commit d883718

Please sign in to comment.