Browse Source

Fix message_pin, message_unpin target id being None

Co-authored-by: Michael H <[email protected]>
Co-authored-by: Alex Nørgaard <[email protected]>
pull/10102/head
iyad-f 2 months ago
committed by GitHub
parent
commit
88d7bd1275
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 8
      discord/audit_logs.py

8
discord/audit_logs.py

@ -874,7 +874,13 @@ class AuditLogEntry(Hashable):
def _convert_target_emoji(self, target_id: int) -> Union[Emoji, Object]:
return self._state.get_emoji(target_id) or Object(id=target_id, type=Emoji)
def _convert_target_message(self, target_id: int) -> Union[Member, User, Object]:
def _convert_target_message(self, target_id: Optional[int]) -> Optional[Union[Member, User, Object]]:
# The message_pin and message_unpin action types do not have a
# non-null target_id so safeguard against that
if target_id is None:
return None
return self._get_member(target_id) or Object(id=target_id, type=Member)
def _convert_target_stage_instance(self, target_id: int) -> Union[StageInstance, Object]:

Loading…
Cancel
Save