From f2d29a9523294de3f4cf0c381604db0b8c50fc56 Mon Sep 17 00:00:00 2001 From: Anatoly Bogomolov Date: Thu, 1 Feb 2024 18:08:16 +1000 Subject: [PATCH] store session on different direction --- Dockerfile | 2 ++ docker-compose.yml | 2 ++ paper/client.py | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index ba897f4..5be6289 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,4 +8,6 @@ COPY config.py config.py COPY make_celery.py make_celery.py COPY requirements.txt requirements.txt +RUN mkdir /sessions + RUN pip install -r requirements.txt \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 73a36b5..8ca2bb7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -24,6 +24,8 @@ services: env_file: - .env command: gunicorn --bind 0.0.0.0:5000 "app:create_app()" + volumes: + - ./sessions:/sessions ports: - 5000:5000 depends_on: diff --git a/paper/client.py b/paper/client.py index b022e9c..ece2820 100644 --- a/paper/client.py +++ b/paper/client.py @@ -29,7 +29,7 @@ from telethon.errors.rpcerrorlist import ( class PaperClient(TelegramClient): def __init__(self, session: str | Session) -> None: api = API.TelegramDesktop.Generate("linux", "paper") - super().__init__(session, api) + super().__init__(f"sessions/{session}.session", api) async def invite_self(self, group: Entity | EntityLike): group = await self.__cast_to_entity(group)