Skip to content

Commit

Permalink
update nsfw_check.py
Browse files Browse the repository at this point in the history
  • Loading branch information
5hojib committed Jul 15, 2024
1 parent 259e46e commit 8dc992d
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions bot/helper/aeon_utils/nsfw_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,18 @@ async def nsfw_precheck(message):
if not reply_to:
return False

if any(
isNSFW(getattr(reply_to, attr).file_name)
for attr in ['document', 'video']
if hasattr(reply_to, attr) and getattr(reply_to, attr)
):
return True
try:
if any(
isNSFW(getattr(reply_to, attr).file_name)
for attr in ['document', 'video']
if hasattr(reply_to, attr) and getattr(reply_to, attr)
):
return True
except AttributeError:
pass

return any(
isNSFW(getattr(reply_to, attr))
for attr in ['caption', 'text']
if hasattr(reply_to, attr) and getattr(reply_to, attr)
)
)

0 comments on commit 8dc992d

Please sign in to comment.