Skip to content

Commit

Permalink
Add missing guild incident fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Soheab committed Apr 27, 2024
1 parent 8fd1fd8 commit 2a66357
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions discord/guild.py
Expand Up @@ -4416,6 +4416,22 @@ def dms_paused_until(self) -> Optional[datetime.datetime]:

return utils.parse_time(self._incidents_data.get('dms_disabled_until'))

@property
def dm_spam_detected_at(self) -> Optional[datetime.datetime]:
""":class:`datetime.datetime`: Returns the time when DM spam was detected in the guild."""
if not self._incidents_data:
return None

return self._incidents_data.get('dm_spam_detected_at', None)

@property
def raid_detected_at(self) -> Optional[datetime.datetime]:
"""Optional[:class:`datetime.datetime`]: Returns the time when a raid was detected in the guild"""
if not self._incidents_data:
return None

return self._incidents_data.get('raid_detected_at', None)

def invites_paused(self) -> bool:
""":class:`bool`: Whether invites are paused in the guild.
Expand All @@ -4435,3 +4451,17 @@ def dms_paused(self) -> bool:
return False

return self.dms_paused_until > utils.utcnow()

def dm_spam_detected(self) -> bool:
""":class:`bool`: Whether DM spam was detected in the guild."""
if not self.dm_spam_detected_at:
return False

return self.dm_spam_detected_at > utils.utcnow()

def raid_detected(self) -> bool:
""":class:`bool`: Whether a raid was detected in the guild."""
if not self.raid_detected_at:
return False

return self.raid_detected_at > utils.utcnow()

0 comments on commit 2a66357

Please sign in to comment.