Skip to content

Commit

Permalink
fix: make annotations for _handle_mentions and Member._try_upgrade co…
Browse files Browse the repository at this point in the history
…rrect
  • Loading branch information
Snipy7374 committed Nov 18, 2024
1 parent ef05e6c commit ffe679f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 6 additions & 2 deletions disnake/member.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,11 +385,15 @@ def _update_from_message(self, data: MemberPayload) -> None:

@classmethod
def _try_upgrade(
cls, *, data: UserWithMemberPayload, guild: Guild, state: ConnectionState
cls,
*,
data: Union[UserPayload, UserWithMemberPayload],
guild: Guild,
state: ConnectionState,
) -> Union[User, Self]:
# A User object with a 'member' key
try:
member_data = data.pop("member")
member_data = data.pop("member") # type: ignore
except KeyError:
return state.create_user(data)
else:
Expand Down
4 changes: 3 additions & 1 deletion disnake/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -1286,7 +1286,9 @@ def _handle_member(self, member: MemberPayload) -> None:
# TODO: consider adding to cache here
self.author = Member._from_message(message=self, data=member)

def _handle_mentions(self, mentions: List[UserWithMemberPayload]) -> None:
def _handle_mentions(
self, mentions: Union[List[UserPayload], List[UserWithMemberPayload]]
) -> None:
self.mentions = r = []
guild = self.guild
state = self._state
Expand Down

0 comments on commit ffe679f

Please sign in to comment.