Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix message_pin, message_unpin target id being None #10061

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion discord/audit_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,13 @@ def _convert_target_invite(self, target_id: None) -> Invite:
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]]:
iyad-f marked this conversation as resolved.
Show resolved Hide resolved
# 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)
iyad-f marked this conversation as resolved.
Show resolved Hide resolved

def _convert_target_stage_instance(self, target_id: int) -> Union[StageInstance, Object]:
Expand Down
Loading