Commited backup
BIN
fajox1/famods/assets/banners/CodeBase64.png
Normal file
|
After Width: | Height: | Size: 176 KiB |
BIN
fajox1/famods/assets/banners/anonsms.png
Normal file
|
After Width: | Height: | Size: 583 KiB |
BIN
fajox1/famods/assets/banners/autogh.png
Normal file
|
After Width: | Height: | Size: 621 KiB |
BIN
fajox1/famods/assets/banners/avachanger.png
Normal file
|
After Width: | Height: | Size: 587 KiB |
BIN
fajox1/famods/assets/banners/banforaskmod.png
Normal file
|
After Width: | Height: | Size: 581 KiB |
BIN
fajox1/famods/assets/banners/bigmac.png
Normal file
|
After Width: | Height: | Size: 613 KiB |
BIN
fajox1/famods/assets/banners/checkhost.png
Normal file
|
After Width: | Height: | Size: 648 KiB |
BIN
fajox1/famods/assets/banners/chmodslist.png
Normal file
|
After Width: | Height: | Size: 588 KiB |
BIN
fajox1/famods/assets/banners/cryptoqr.png
Normal file
|
After Width: | Height: | Size: 589 KiB |
BIN
fajox1/famods/assets/banners/edmes.png
Normal file
|
After Width: | Height: | Size: 163 KiB |
BIN
fajox1/famods/assets/banners/epsilion.png
Normal file
|
After Width: | Height: | Size: 624 KiB |
BIN
fajox1/famods/assets/banners/evalaliases.png
Normal file
|
After Width: | Height: | Size: 582 KiB |
BIN
fajox1/famods/assets/banners/executor.png
Normal file
|
After Width: | Height: | Size: 585 KiB |
BIN
fajox1/famods/assets/banners/fabrika.png
Normal file
|
After Width: | Height: | Size: 172 KiB |
BIN
fajox1/famods/assets/banners/fabusiness.png
Normal file
|
After Width: | Height: | Size: 584 KiB |
BIN
fajox1/famods/assets/banners/faker.png
Normal file
|
After Width: | Height: | Size: 164 KiB |
BIN
fajox1/famods/assets/banners/famod.png
Normal file
|
After Width: | Height: | Size: 591 KiB |
BIN
fajox1/famods/assets/banners/freegpt.png
Normal file
|
After Width: | Height: | Size: 587 KiB |
BIN
fajox1/famods/assets/banners/fun.png
Normal file
|
After Width: | Height: | Size: 155 KiB |
BIN
fajox1/famods/assets/banners/gemini.png
Normal file
|
After Width: | Height: | Size: 588 KiB |
BIN
fajox1/famods/assets/banners/gigachat.png
Normal file
|
After Width: | Height: | Size: 584 KiB |
BIN
fajox1/famods/assets/banners/giveaways.png
Normal file
|
After Width: | Height: | Size: 591 KiB |
BIN
fajox1/famods/assets/banners/grokai.png
Normal file
|
After Width: | Height: | Size: 588 KiB |
BIN
fajox1/famods/assets/banners/gsearch.png
Normal file
|
After Width: | Height: | Size: 634 KiB |
BIN
fajox1/famods/assets/banners/hbotcommand.png
Normal file
|
After Width: | Height: | Size: 626 KiB |
BIN
fajox1/famods/assets/banners/hetalib.png
Normal file
|
After Width: | Height: | Size: 634 KiB |
BIN
fajox1/famods/assets/banners/hetsu.png
Normal file
|
After Width: | Height: | Size: 1.4 MiB |
BIN
fajox1/famods/assets/banners/infoip.png
Normal file
|
After Width: | Height: | Size: 632 KiB |
BIN
fajox1/famods/assets/banners/phoneinfo.png
Normal file
|
After Width: | Height: | Size: 635 KiB |
BIN
fajox1/famods/assets/banners/picme.png
Normal file
|
After Width: | Height: | Size: 585 KiB |
BIN
fajox1/famods/assets/banners/pricefreedom.png
Normal file
|
After Width: | Height: | Size: 642 KiB |
BIN
fajox1/famods/assets/banners/proxy.png
Normal file
|
After Width: | Height: | Size: 588 KiB |
BIN
fajox1/famods/assets/banners/removebg.png
Normal file
|
After Width: | Height: | Size: 638 KiB |
BIN
fajox1/famods/assets/banners/requirements.png
Normal file
|
After Width: | Height: | Size: 626 KiB |
BIN
fajox1/famods/assets/banners/spotify4ik.png
Normal file
|
After Width: | Height: | Size: 585 KiB |
BIN
fajox1/famods/assets/banners/stats.png
Normal file
|
After Width: | Height: | Size: 167 KiB |
BIN
fajox1/famods/assets/banners/telegrapher.png
Normal file
|
After Width: | Height: | Size: 171 KiB |
BIN
fajox1/famods/assets/banners/timer.png
Normal file
|
After Width: | Height: | Size: 159 KiB |
BIN
fajox1/famods/assets/banners/tondns.png
Normal file
|
After Width: | Height: | Size: 169 KiB |
BIN
fajox1/famods/assets/banners/tonscan.png
Normal file
|
After Width: | Height: | Size: 175 KiB |
BIN
fajox1/famods/assets/banners/vaper.png
Normal file
|
After Width: | Height: | Size: 591 KiB |
BIN
fajox1/famods/assets/banners/wakatime.png
Normal file
|
After Width: | Height: | Size: 171 KiB |
BIN
fajox1/famods/assets/banners/xrocket.png
Normal file
|
After Width: | Height: | Size: 594 KiB |
BIN
fajox1/famods/assets/banners/ytsearch.png
Normal file
|
After Width: | Height: | Size: 634 KiB |
BIN
fajox1/famods/assets/buckshot-roulette-buckshot.gif
Normal file
|
After Width: | Height: | Size: 2.1 MiB |
BIN
fajox1/famods/assets/buckshot-roulette-dealer.gif
Normal file
|
After Width: | Height: | Size: 1.3 MiB |
BIN
fajox1/famods/assets/buckshot-roulette.gif
Normal file
|
After Width: | Height: | Size: 2.3 MiB |
BIN
fajox1/famods/assets/buckshotroulette-shotgun.gif
Normal file
|
After Width: | Height: | Size: 7.4 MiB |
BIN
fajox1/famods/assets/famods_banner.png
Normal file
|
After Width: | Height: | Size: 672 KiB |
166
fajox1/famods/assets/musicdl.py
Normal file
@@ -0,0 +1,166 @@
|
||||
# █ █ ▀ █▄▀ ▄▀█ █▀█ ▀
|
||||
# █▀█ █ █ █ █▀█ █▀▄ █
|
||||
# © Copyright 2022
|
||||
# https://t.me/hikariatama
|
||||
#
|
||||
# 🔒 Licensed under the GNU AGPLv3
|
||||
# 🌐 https://www.gnu.org/licenses/agpl-3.0.html
|
||||
|
||||
import asyncio
|
||||
import io
|
||||
import logging
|
||||
import typing
|
||||
|
||||
import requests
|
||||
from telethon.errors.rpcerrorlist import BotResponseTimeoutError
|
||||
from telethon.events import MessageEdited, StopPropagation
|
||||
from telethon.tl.types import Document
|
||||
|
||||
from .. import loader, utils
|
||||
|
||||
|
||||
class MusicDLLib(loader.Library):
|
||||
developer = "@hikariatama"
|
||||
version = (1, 0, 19)
|
||||
|
||||
def __init__(self):
|
||||
self.config = loader.LibraryConfig(
|
||||
loader.ConfigValue(
|
||||
"timeout",
|
||||
40,
|
||||
"Timeout for downloading",
|
||||
validator=loader.validators.Integer(minimum=5),
|
||||
),
|
||||
loader.ConfigValue(
|
||||
"retries",
|
||||
3,
|
||||
"Number of retries for downloading",
|
||||
validator=loader.validators.Integer(minimum=0),
|
||||
),
|
||||
loader.ConfigValue(
|
||||
"lossless_priority",
|
||||
False,
|
||||
"If True, lossless music will be downloaded first",
|
||||
validator=loader.validators.Boolean(),
|
||||
),
|
||||
)
|
||||
|
||||
async def _dl(self, bot: str, full_name: str):
|
||||
try:
|
||||
return (await self._client.inline_query(bot, full_name))[0].document
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
async def _legacy(self, full_name: str):
|
||||
document = await self._dl("@vkm4bot", full_name)
|
||||
document = (
|
||||
await self._dl("@spotifysavebot", full_name) if not document else document
|
||||
)
|
||||
document = await self._dl("@lybot", full_name) if not document else document
|
||||
return document
|
||||
|
||||
async def dl(
|
||||
self,
|
||||
full_name: str,
|
||||
only_document: bool = False,
|
||||
retries: int = 0,
|
||||
) -> typing.Union[Document, str]:
|
||||
try:
|
||||
if not self.config["lossless_priority"]:
|
||||
document = await self._legacy(full_name)
|
||||
|
||||
if self.config["lossless_priority"] or not document:
|
||||
try:
|
||||
q = await self._client.inline_query("@losslessrobot", full_name)
|
||||
except BotResponseTimeoutError:
|
||||
if retries >= self.config["retries"]:
|
||||
raise Exception("Failed to download")
|
||||
|
||||
await asyncio.sleep(3)
|
||||
return await self.dl(full_name, only_document, retries + 1)
|
||||
|
||||
result = q.result.results[0]
|
||||
if not getattr(
|
||||
getattr(result, "send_message", None), "reply_markup", None
|
||||
):
|
||||
document = result.document
|
||||
if text := getattr(
|
||||
getattr(result, "send_message", None), "message", None
|
||||
):
|
||||
if "FLAC" in text:
|
||||
document.is_flac = True
|
||||
else:
|
||||
m = await q[0].click("me")
|
||||
|
||||
dl_event = asyncio.Event()
|
||||
document = None
|
||||
|
||||
@self._client.on(MessageEdited(chats=utils.get_chat_id(m)))
|
||||
async def handler(event: MessageEdited):
|
||||
nonlocal document
|
||||
try:
|
||||
if (
|
||||
event.message.id == m.id
|
||||
and (
|
||||
not getattr(event.message, "reply_markup", None)
|
||||
or all(
|
||||
button.text
|
||||
!= "Подождите, трек скоро скачается."
|
||||
for button in utils.array_sum(
|
||||
[
|
||||
row.buttons
|
||||
for row in event.message.reply_markup.rows
|
||||
]
|
||||
)
|
||||
)
|
||||
)
|
||||
and event.message.document
|
||||
):
|
||||
document = event.message.document
|
||||
if text := getattr(event.message, "message", None):
|
||||
if "FLAC" in text:
|
||||
document.is_flac = True
|
||||
dl_event.set()
|
||||
|
||||
raise StopPropagation
|
||||
except StopPropagation:
|
||||
raise
|
||||
except Exception:
|
||||
logging.exception("Failed to download")
|
||||
|
||||
try:
|
||||
await asyncio.wait_for(
|
||||
dl_event.wait(),
|
||||
timeout=self.config["timeout"],
|
||||
)
|
||||
except Exception:
|
||||
await m.delete()
|
||||
document = None
|
||||
else:
|
||||
await m.delete()
|
||||
except Exception:
|
||||
logging.debug("Can't download", exc_info=True)
|
||||
document = None
|
||||
|
||||
if not document:
|
||||
document = await self._legacy(full_name)
|
||||
|
||||
if not document:
|
||||
return None
|
||||
|
||||
if only_document:
|
||||
return document
|
||||
|
||||
file = io.BytesIO(await self._client.download_file(document, bytes))
|
||||
file.name = "audio.mp3"
|
||||
|
||||
try:
|
||||
skynet = await utils.run_sync(
|
||||
requests.post,
|
||||
"https://siasky.net/skynet/skyfile",
|
||||
files={"file": file},
|
||||
)
|
||||
except ConnectionError:
|
||||
return None
|
||||
|
||||
return f"https://siasky.net/{skynet.json()['skylink']}"
|
||||
BIN
fajox1/famods/assets/photo_2025-03-26_17-03-56.jpg
Normal file
|
After Width: | Height: | Size: 26 KiB |
BIN
fajox1/famods/assets/start.jpg
Normal file
|
After Width: | Height: | Size: 512 KiB |