diff --git a/CHANGELOG b/CHANGELOG index f3f75a8..4aeda15 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,5 @@ 1.30 +* Do not crash when encountering graves of deleted files 1.29 * Do not crash when encountering deleted files diff --git a/control.py b/control.py index 7589b13..0c1f8df 100644 --- a/control.py +++ b/control.py @@ -44,11 +44,10 @@ async def handle_sendfile(ircclient: "IrcClient", reader, writer) -> None: async def handle_client(ircclient: "IrcClient", reader, writer) -> None: command = (await reader.readline()).strip() - match command: - case b"sendfile": - await handle_sendfile(ircclient, reader, writer) - case b"write": - await handle_write(ircclient, reader, writer) + if command == b"sendfile": + await handle_sendfile(ircclient, reader, writer) + elif command == b"write": + await handle_write(ircclient, reader, writer) async def listen(socket_path: str, ircclient: "IrcClient") -> None: server = await asyncio.start_unix_server(lambda r,w: handle_client(ircclient, r, w), socket_path) diff --git a/slack.py b/slack.py index f0cad5d..c7860b4 100644 --- a/slack.py +++ b/slack.py @@ -88,6 +88,16 @@ class File: title: Optional[str] = None mimetype: Optional[str] = None +@dataclass +class TabutuFile: + """ + 'un sacciu chi minchia รจ sta cosa. + + Sacciu sulu ca slack u manna + """ + id: str + mode: Literal['tombstone'] + class Topic(NamedTuple): """ @@ -300,7 +310,7 @@ class HistoryBotMessage: bot_id: Optional[str] username: str = 'bot' ts: float = 0 - files: list[File | DeletedFile] = field(default_factory=list) + files: list[File | DeletedFile | TabutuFile] = field(default_factory=list) thread_ts: Optional[str] = None attachments: list[dict[str, Any]] = field(default_factory=list) @@ -311,7 +321,7 @@ class HistoryMessage: user: str text: str ts: float - files: list[File | DeletedFile] = field(default_factory=list) + files: list[File | DeletedFile | TabutuFile] = field(default_factory=list) thread_ts: Optional[str] = None