Skip to content

Commit

Permalink
Revert "Don't fail if guild is None in voice state create"
Browse files Browse the repository at this point in the history
This reverts commit 65c7705.
  • Loading branch information
4Kaylum committed Jan 18, 2024
1 parent 65c7705 commit 1a88406
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 2 additions & 0 deletions novus/models/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,12 +398,14 @@ def partial(
data={"id": id, "type": type.value} # pyright: ignore
)

# @cached_slot_property("_cs_guild")
@property
def guild(self) -> BaseGuild | None:
if self.guild_id is None:
return None
return self.state.cache.get_guild(self.guild_id)

# @cached_slot_property("_cs_parent")
@property
def parent(self) -> Channel | None:
if self.parent_id is None:
Expand Down
3 changes: 1 addition & 2 deletions novus/models/voice_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,5 @@ def _update(self, data: payloads.VoiceState) -> Self:
self.request_to_speak_timestamp = parse_timestamp(data.get("request_to_speak_timestamp"))
self.mute = data.get("mute", False)
self.deaf = data.get("deaf", False)
if self.guild is not None:
self.guild._add_voice_state(self)
self.guild._add_voice_state(self)
return self

0 comments on commit 1a88406

Please sign in to comment.