This commit is contained in:
levina 2021-10-11 10:14:44 +07:00 committed by GitHub
parent 79b3b9a63b
commit ba6b2b6d68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 0 additions and 152 deletions

View File

@ -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)

View File

@ -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"

View File

@ -1,8 +0,0 @@
# Copyright (C) 2021 By VeezMusicProject
class DurationLimitError(Exception):
pass
class FFmpegReturnCodeError(Exception):
pass

View File

@ -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)

View File

@ -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