Skip to content

Commit

Permalink
Correct miscellaneous types
Browse files Browse the repository at this point in the history
  • Loading branch information
dolfies committed Jan 15, 2024
1 parent 763eb2e commit e525cc3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions discord/read_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,16 +164,18 @@ def flags(self) -> ReadStateFlags:
return ReadStateFlags._from_value(self._flags)

@property
def resource(self) -> Optional[Union[ClientUser, Guild, MessageableChannel]]:
"""Optional[Union[:class:`ClientUser`, :class:`Guild`, :class:`TextChannel`, :class:`StageChannel`, :class:`VoiceChannel`, :class:`Thread`, :class:`DMChannel`, :class:`GroupChannel`, :class:`PartialMessageable`]]: The entity associated with the read state."""
def resource(self) -> Union[ClientUser, Guild, MessageableChannel]:
"""Union[:class:`ClientUser`, :class:`Guild`, :class:`TextChannel`, :class:`StageChannel`, :class:`VoiceChannel`, :class:`Thread`, :class:`DMChannel`, :class:`GroupChannel`, :class:`PartialMessageable`]: The entity associated with the read state."""
state = self._state

if self.type == ReadStateType.channel:
return state._get_or_create_partial_messageable(self.id) # type: ignore
elif self.type in (ReadStateType.scheduled_events, ReadStateType.guild_home, ReadStateType.onboarding):
return state._get_or_create_unavailable_guild(self.id)
elif self.type == ReadStateType.notification_center and self.id == state.self_id:
return state.user
return state.user # type: ignore
else:
raise NotImplementedError(f'Unknown read state type {self.type!r}')

@property
def last_entity_id(self) -> int:
Expand Down
4 changes: 2 additions & 2 deletions discord/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ class BaseUser(_UserTag):
_state: ConnectionState
_avatar: Optional[str]
_avatar_decoration: Optional[str]
_avatar_decoration_sku_id: Optional[Snowflake]
_avatar_decoration_sku_id: Optional[int]
_banner: Optional[str]
_accent_colour: Optional[int]
_public_flags: int
Expand Down Expand Up @@ -405,7 +405,7 @@ def avatar_decoration(self) -> Optional[Asset]:
return None

@property
def avatar_decoration_sku_id(self) -> Optional[Snowflake]:
def avatar_decoration_sku_id(self) -> Optional[int]:
"""Optional[:class:`int`]: Returns the avatar decoration's SKU ID.
If the user does not have a preset avatar decoration, ``None`` is returned.
Expand Down

0 comments on commit e525cc3

Please sign in to comment.