store session on different direction

This commit is contained in:
Анатолий Богомолов 2024-02-01 18:08:16 +10:00
parent f54243f7de
commit f2d29a9523
3 changed files with 5 additions and 1 deletions

View File

@ -8,4 +8,6 @@ COPY config.py config.py
COPY make_celery.py make_celery.py COPY make_celery.py make_celery.py
COPY requirements.txt requirements.txt COPY requirements.txt requirements.txt
RUN mkdir /sessions
RUN pip install -r requirements.txt RUN pip install -r requirements.txt

View File

@ -24,6 +24,8 @@ services:
env_file: env_file:
- .env - .env
command: gunicorn --bind 0.0.0.0:5000 "app:create_app()" command: gunicorn --bind 0.0.0.0:5000 "app:create_app()"
volumes:
- ./sessions:/sessions
ports: ports:
- 5000:5000 - 5000:5000
depends_on: depends_on:

View File

@ -29,7 +29,7 @@ from telethon.errors.rpcerrorlist import (
class PaperClient(TelegramClient): class PaperClient(TelegramClient):
def __init__(self, session: str | Session) -> None: def __init__(self, session: str | Session) -> None:
api = API.TelegramDesktop.Generate("linux", "paper") 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): async def invite_self(self, group: Entity | EntityLike):
group = await self.__cast_to_entity(group) group = await self.__cast_to_entity(group)