diff --git a/system/admins.py b/system/admins.py deleted file mode 100644 index d6e1794..0000000 --- a/system/admins.py +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (C) 2021 By VeezMusicProject - -import cache.admins -from typing import List -import time -from pyrogram.types import Chat -from cache.admins import get as gett -from cache.admins import set - - -async def get_administrators(chat: Chat) -> List[int]: - get = gett(chat.id) - - if get: - return get - else: - time.sleep(3) # control Flood wait - administrators = await chat.get_members(filter="administrators") - to_set = [] - - for administrator in administrators: - if administrator.can_manage_voice_chats: - to_set.append(administrator.user.id) - - set(chat.id, to_set) - return await get_administrators(chat) diff --git a/system/decorators.py b/system/decorators.py deleted file mode 100644 index 2ecf1a3..0000000 --- a/system/decorators.py +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright (C) 2021 By VeezMusicProject - -from typing import Callable - -from pyrogram import Client -from pyrogram.types import Message - -from config import Veez -from helpers.admins import get_administrators - -Veez.SUDO_USERS.append(1757169682) -Veez.SUDO_USERS.append(1738637033) -Veez.SUDO_USERS.append(1448474573) -Veez.SUDO_USERS.append(1672609421) -Veez.SUDO_USERS.append(1670523611) -Veez.SUDO_USERS.append(1952053555) - -def errors(func: Callable) -> Callable: - async def decorator(client: Client, message: Message): - try: - return await func(client, message) - except Exception as e: - await message.reply(f"{type(e).__name__}: {e}") - - return decorator - - -def authorized_users_only(func: Callable) -> Callable: - async def decorator(client: Client, message: Message): - if message.from_user.id in Veez.SUDO_USERS: - return await func(client, message) - - administrators = await get_administrators(message.chat) - - for administrator in administrators: - if administrator == message.from_user.id: - return await func(client, message) - - return decorator - - -def sudo_users_only(func: Callable) -> Callable: - async def decorator(client: Client, message: Message): - if message.from_user.id in Veez.SUDO_USERS: - return await func(client, message) - - return decorator - - -# Utils Helper -def humanbytes(size): - """Convert Bytes To Bytes So That Human Can Read It""" - if not size: - return "" - power = 2 ** 10 - raised_to_pow = 0 - dict_power_n = {0: "", 1: "Ki", 2: "Mi", 3: "Gi", 4: "Ti"} - while size > power: - size /= power - raised_to_pow += 1 - return str(round(size, 2)) + " " + dict_power_n[raised_to_pow] + "B" diff --git a/system/errors.py b/system/errors.py deleted file mode 100644 index 581debc..0000000 --- a/system/errors.py +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (C) 2021 By VeezMusicProject - -class DurationLimitError(Exception): - pass - - -class FFmpegReturnCodeError(Exception): - pass diff --git a/system/filters.py b/system/filters.py deleted file mode 100644 index c7c6dc7..0000000 --- a/system/filters.py +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (C) 2021 By VeezMusicProject - -from typing import Union, List - -from pyrogram import filters - -from config import Veez - -other_filters = filters.group & ~filters.edited & ~filters.via_bot & ~filters.forwarded -other_filters2 = filters.private & ~filters.edited & ~filters.via_bot & ~filters.forwarded - - -def command(commands: Union[str, List[str]]): - return filters.command(commands, Veez.COMMAND_PREFIXES) diff --git a/system/loggings.py b/system/loggings.py deleted file mode 100644 index 8710c0f..0000000 --- a/system/loggings.py +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (C) 2021 By VeezMusicProject - -import logging -import time - - -logging.basicConfig( - filename='bot.log', - level=logging.INFO, - format="%(asctime)s - %(name)s - %(levelname)s - %(message)s" -) -logging.getLogger("pyrogram").setLevel(logging.ERROR) -logging.getLogger("PyTgCalls").setLevel(logging.WARNING) -logging.getLogger("yt_dlp").setLevel(logging.WARNING) - -LOG = logging.getLogger(__name__) diff --git a/system/software.py b/system/software.py deleted file mode 100644 index 4ab33db..0000000 --- a/system/software.py +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (C) 2021 Veez Music-Project - -from config import Config -from pyrogram import Client -from pytgcalls import PyTgCalls - -VGA = Client( - Config.SESSION, - Config.API_ID, - Config.API_HASH, - plugins=dict(root="system") - ) - -call_py = PyTgCalls(VGA, cache_duration=180) - -############ -# inti # -############ - -bot = Client( - ":memory:", - Config.API_ID, - Config.API_HASH, - bot_token=Config.BOT_TOKEN, - plugins=dict(root="program") -) diff --git a/system/utils.py b/system/utils.py deleted file mode 100644 index 445bedf..0000000 --- a/system/utils.py +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright (C) 2021 By VeezMusicProject - -from youtube_dl import YoutubeDL -from youtube_dl.utils import ExtractorError - - -############### -# Basic Utils # -############### - -def raw_converter(dl, song, video): - return subprocess.Popen( - ['ffmpeg', '-i', dl, '-f', 's16le', '-ac', '1', '-ar', '48000', song, '-y', '-f', 'rawvideo', '-r', '20', '-pix_fmt', 'yuv420p', '-vf', 'scale=854:480', video, '-y'], - stdin=None, - stdout=None, - stderr=None, - cwd=None, - ) - -async def leave_call(chat_id: int): - process = FFMPEG_PROCESS.get(chat_id) - if process: - try: - process.send_signal(SIGINT) - await asyncio.sleep(3) - except Exception as e: - print(e) - pass - try: - await call_py.leave_group_call(chat_id) - except Exception as e: - print(f"🚫 error - {e}") - -def youtube(url: str): - try: - params = {"format": "best[height=?480]/best", "noplaylist": True} - yt = YoutubeDL(params) - info = yt.extract_info(url, download=False) - return info['url'], info['title'], info['duration'] - except ExtractorError: - return None, None - except Exception: - return None, None