This commit is contained in:
Klemek
2021-05-19 15:34:24 +02:00
parent 84734c7d4e
commit b1eddf0b4b
2 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
FROM python:3.8.10-alpine FROM python:3.8.10
# Create app directory # Create app directory
WORKDIR /usr/src/app WORKDIR /usr/src/app
+3 -3
View File
@@ -1,4 +1,4 @@
from enum import Enum from enum import IntEnum
from typing import Callable, List, Dict, Union, Optional, Any from typing import Callable, List, Dict, Union, Optional, Any
import os import os
import logging import logging
@@ -51,7 +51,7 @@ def deltas(t0: datetime):
return (datetime.now() - t0).total_seconds() return (datetime.now() - t0).total_seconds()
class FilterLevel(Enum): class FilterLevel(IntEnum):
NONE = 0 NONE = 0
ALLOW = 1 ALLOW = 1
ONLY = 2 ONLY = 2
@@ -113,7 +113,7 @@ def should_allow_spoiler(message: discord.Message, spoiler: FilterLevel) -> bool
is_spoiler = is_image_spoiler(message) is_spoiler = is_image_spoiler(message)
return ( return (
not is_spoiler not is_spoiler
and spoiler <= FilterLevel.ALLOW and spoiler <= FilterLevel.ONLY
or is_spoiler or is_spoiler
and spoiler >= FilterLevel.ALLOW and spoiler >= FilterLevel.ALLOW
) )