diff options
Diffstat (limited to 'ATRI/plugins/setu/nsfw_checker.py')
-rw-r--r-- | ATRI/plugins/setu/nsfw_checker.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ATRI/plugins/setu/nsfw_checker.py b/ATRI/plugins/setu/nsfw_checker.py index 53546f6..d7ad6e1 100644 --- a/ATRI/plugins/setu/nsfw_checker.py +++ b/ATRI/plugins/setu/nsfw_checker.py @@ -40,9 +40,13 @@ def prepare_image(img): return image -async def detect_image(url: str, max_size: int) -> float: +async def detect_image(url: str, max_size: int, disab_gif: bool) -> float: try: req = await request.get(url) + if itype := req.headers.get("Content-Type"): + if disab_gif and itype == "image/gif": + return 0 + except Exception: raise RequestError("Get info from download image failed!") |