WIP: Media import/export

This commit is contained in:
Profitroll 2023-03-18 20:53:26 +01:00
parent 06b6b49f43
commit a4323981fb
6 changed files with 22 additions and 4 deletions

View File

@ -1,5 +1,6 @@
from modules.utils import configGet from modules.utils import configGet
from classes.poster_client import PosterClient from classes.poster_client import PosterClient
from convopyro import Conversation
app = PosterClient( app = PosterClient(
"duptsiaposter", "duptsiaposter",
@ -7,3 +8,5 @@ app = PosterClient(
api_id=configGet("api_id", "bot"), api_id=configGet("api_id", "bot"),
api_hash=configGet("api_hash", "bot"), api_hash=configGet("api_hash", "bot"),
) )
Conversation(app)

View File

@ -1,5 +1,6 @@
from pyrogram import filters from pyrogram import filters
from pyrogram.types import Message from pyrogram.types import Message
from convopyro import listen_message
from classes.poster_client import PosterClient from classes.poster_client import PosterClient
from modules.app import app from modules.app import app
@ -8,7 +9,15 @@ from modules.app import app
@app.on_message(~filters.scheduled & filters.command(["import"], prefixes=["", "/"])) @app.on_message(~filters.scheduled & filters.command(["import"], prefixes=["", "/"]))
async def cmd_import(app: PosterClient, msg: Message): async def cmd_import(app: PosterClient, msg: Message):
if msg.from_user.id in app.admins: if msg.from_user.id in app.admins:
pass print("Listening to file...", flush=True)
answer = await app.listen.Message(
filters.document, id=filters.user(msg.from_user.id), timeout=None
)
if answer is None:
return
print("Gotcha", flush=True)
await answer.reply_text("Gotcha")
return
@app.on_message(~filters.scheduled & filters.command(["export"], prefixes=["", "/"])) @app.on_message(~filters.scheduled & filters.command(["export"], prefixes=["", "/"]))

View File

@ -49,7 +49,9 @@ async def get_submission(app: PosterClient, msg: Message):
) )
if msg.document.mime_type not in configGet("mime_types", "submission"): if msg.document.mime_type not in configGet("mime_types", "submission"):
await msg.reply_text( await msg.reply_text(
locale("mime_not_allowed", "message", locale=user_locale), locale("mime_not_allowed", "message", locale=user_locale).format(
", ".join(configGet("mime_types", "submission"))
),
quote=True, quote=True,
) )
return return

View File

@ -64,6 +64,9 @@ if configGet("submit", "mode"):
from plugins.commands.mode_submit import * from plugins.commands.mode_submit import *
from plugins.handlers.submission import * from plugins.handlers.submission import *
if configGet("post", "mode"):
from plugins.commands.photos import *
# if configGet("api_based", "mode"): # if configGet("api_based", "mode"):
# from modules.api_client import authorize # from modules.api_client import authorize
# =========================================================================================================================================== # ===========================================================================================================================================

View File

@ -1 +1 @@
tgcrypto~=1.2.5 tgcrypto==1.2.5

View File

@ -1,6 +1,7 @@
apscheduler~=3.10.1 apscheduler~=3.10.1
pyrogram~=2.0.102
pytimeparse~=1.1.8 pytimeparse~=1.1.8
convopyro==0.5
pyrogram~=2.0.102
aiofiles~=23.1.0 aiofiles~=23.1.0
aiohttp~=3.8.4 aiohttp~=3.8.4
psutil~=5.9.4 psutil~=5.9.4