Commited backup

This commit is contained in:
2025-07-10 21:02:34 +03:00
parent 952c1001e3
commit da0b80823e
1310 changed files with 254133 additions and 41 deletions

View File

@@ -0,0 +1,56 @@
import os
from .. import loader, utils
from asyncio import sleep
def register(cb):
cb(ReplyDownloaderMod())
class ReplyDownloaderMod(loader.Module):
"""Скачать файлом реплай."""
strings = {'name': 'Reply Downloader'}
async def dlrcmd(self, message):
"""Команда .dlr <реплай на файл> <название (по желанию)> скачивает файл, либо сохраняет текст в файл на который был сделан реплай."""
name = utils.get_args_raw(message)
reply = await message.get_reply_message()
if reply:
await message.edit('Скачиваем...')
if reply.text:
text = reply.text
fname = f'{name or message.id+reply.id}.txt'
file = open(fname, 'w')
file.write(text)
file.close()
await message.edit(f'Файл сохранён как: <code>{fname}</code>.\n\nВы можете отправить его в этот чат с помощью команды <code>.ulf {fname}</code>.')
else:
ext = reply.file.ext
fname = f'{name or message.id+reply.id}{ext}'
await message.client.download_media(reply, fname)
await message.edit(f'Этот файл сохранён как: <code>{fname}</code>.\n\nВы можете отправить его в этот чат с помощью команды <code>.ulf {fname}</code>.')
else:
return await message.edit('Нет реплая.')
async def ulfcmd(self, message):
"""Команда .ulf <d>* <название файла> отправляет файл в чат.\n* - удалить файл после отправки."""
name = utils.get_args_raw(message)
d = False
if('d ' in name):
d = True
if name:
try:
name = name.replace('d ', '')
await message.edit(f'Отправляем <code>{name}</code>...')
if d == True:
await message.client.send_file(message.to_id, f'{name}')
await message.edit(f'Отправляем <code>{name}</code>... Успешно!\nУдаляем <code>{name}</code>...')
os.remove(name)
await message.edit(f'Отправляем <code>{name}</code>... Успешно!\nУдаляем <code>{name}</code>... Успешно!')
await sleep(0.5)
else:
await message.client.send_file(message.to_id, name)
except:
return await message.edit('Такой файл не существует.')
await message.delete()
else:
return await message.edit('Нет аргументов.')