Co-authored-by: Aditya <xditya@ultroid.tech> Co-authored-by: Danish <danish@ultroid.tech> Co-authored-by: Amit Sharma <48654350+buddhhu@users.noreply.github.com> Co-authored-by: TechiError <error@notavailable.live> Co-authored-by: Avish Kumar <85635883+aviskumar@users.noreply.github.com> Co-authored-by: Vɪɴᴀʏᴀᴋ Pᴀɴᴅᴇʏ <87496159+harpia-vieillot@users.noreply.github.com> Co-authored-by: Shrimadhav U K <6317196+spechide@users.noreply.github.com> Co-authored-by: Dark <darkbeamer.official@gmail.com> Co-authored-by: Muhamad Risman Aziz <62795826+mrismanaziz@users.noreply.github.com> Co-authored-by: Ashik Muhammed <84127769+MR-JINN-OF-TG@users.noreply.github.com> Co-authored-by: MMETMA <79155572+MMETMA@users.noreply.github.com> Co-authored-by: amirmehdinzri <94852182+amirmehdinzri@users.noreply.github.com>
50 lines
1.6 KiB
Python
50 lines
1.6 KiB
Python
# Ultroid - UserBot
|
|
# Copyright (C) 2021-2022 TeamUltroid
|
|
#
|
|
# This file is a part of < https://github.com/TeamUltroid/Ultroid/ >
|
|
# PLease read the GNU Affero General Public License in
|
|
# <https://www.github.com/TeamUltroid/Ultroid/blob/main/LICENSE/>.
|
|
"""
|
|
✘ Commands Available -
|
|
|
|
• `{i}webupload`
|
|
Upload files on another server.
|
|
"""
|
|
|
|
import os
|
|
|
|
from pyUltroid.functions.tools import _webupload_cache
|
|
|
|
from . import asst, get_string, ultroid_cmd
|
|
|
|
|
|
@ultroid_cmd(
|
|
pattern="webupload ?(.*)",
|
|
)
|
|
async def _(event):
|
|
xx = await event.eor(get_string("com_1"))
|
|
match = event.pattern_match.group(1)
|
|
if event.chat_id not in _webupload_cache:
|
|
_webupload_cache.update({int(event.chat_id): {}})
|
|
if match:
|
|
if not os.path.exists(match):
|
|
return await xx.eor("`File doesn't exist.`")
|
|
_webupload_cache[event.chat_id][event.id] = match
|
|
elif event.reply_to_msg_id:
|
|
reply = await event.get_reply_message()
|
|
if reply.photo:
|
|
file = await event.client.download_media("resources/downloads/")
|
|
_webupload_cache[int(event.chat_id)][int(event.id)] = file
|
|
else:
|
|
file, _ = await event.client.fast_downloader(
|
|
reply.document, reply.file.name, show_progress=True, event=xx
|
|
)
|
|
_webupload_cache[int(event.chat_id)][int(event.id)] = file.name
|
|
else:
|
|
return await xx.eor("`Reply to file or give file path...`")
|
|
results = await event.client.inline_query(
|
|
asst.me.username, f"fl2lnk {event.chat_id}:{event.id}"
|
|
)
|
|
await results[0].click(event.chat_id, reply_to=event.reply_to_msg_id)
|
|
await xx.delete()
|