mirror of
https://github.com/flibusta-apps/telegram_files_server.git
synced 2025-12-06 12:35:39 +01:00
Fix
This commit is contained in:
@@ -10,7 +10,7 @@ class UploadBackend(enum.StrEnum):
|
|||||||
|
|
||||||
|
|
||||||
class Data(TypedDict):
|
class Data(TypedDict):
|
||||||
chat_id: str | int
|
chat_id: int
|
||||||
message_id: int
|
message_id: int
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from typing import AsyncIterator, Optional, Union
|
from typing import AsyncIterator, Optional
|
||||||
|
|
||||||
import telethon.client
|
import telethon.client
|
||||||
import telethon.errors
|
import telethon.errors
|
||||||
@@ -9,9 +9,7 @@ from core.config import env_config
|
|||||||
|
|
||||||
|
|
||||||
class BaseStorage:
|
class BaseStorage:
|
||||||
def __init__(
|
def __init__(self, channel_id: int, app_id: int, api_hash: str, session: str):
|
||||||
self, channel_id: Union[str, int], app_id: int, api_hash: str, session: str
|
|
||||||
):
|
|
||||||
self.channel_id = channel_id
|
self.channel_id = channel_id
|
||||||
|
|
||||||
self.client = telethon.client.TelegramClient(session, app_id, api_hash)
|
self.client = telethon.client.TelegramClient(session, app_id, api_hash)
|
||||||
@@ -26,7 +24,7 @@ class BaseStorage:
|
|||||||
file: telethon.hints.FileLike,
|
file: telethon.hints.FileLike,
|
||||||
file_size: int,
|
file_size: int,
|
||||||
caption: Optional[str] = None,
|
caption: Optional[str] = None,
|
||||||
) -> Optional[tuple[Union[str, int], int]]:
|
) -> Optional[tuple[int, int]]:
|
||||||
try:
|
try:
|
||||||
uploaded_file = await self.client.upload_file(file, file_size=file_size)
|
uploaded_file = await self.client.upload_file(file, file_size=file_size)
|
||||||
|
|
||||||
@@ -87,7 +85,7 @@ class UserStorage(BaseStorage):
|
|||||||
class BotStorage(BaseStorage):
|
class BotStorage(BaseStorage):
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
channel_id: Union[str, int],
|
channel_id: int,
|
||||||
app_id: int,
|
app_id: int,
|
||||||
api_hash: str,
|
api_hash: str,
|
||||||
session: str,
|
session: str,
|
||||||
|
|||||||
Reference in New Issue
Block a user