\n"
- "Licensed under the terms of the GNU Lesser "
- "General Public License v3 or later (LGPLv3+)\n",
- )
- try:
- remote_stable_ver = await self._remote_version("master")
- remote_dev_ver = await self._remote_version("dev")
- remote_test_ver = remote_stable_ver + ".99"
- if VersionManager.version_tuple(__version__) > VersionManager.version_tuple(
- remote_test_ver
- ):
- remote_ver = remote_readable_ver = remote_dev_ver
- my_ver = __version__
- else:
- remote_readable_ver = remote_stable_ver
- remote_ver = remote_test_ver
- my_ver = __version__ + ".99"
- if VersionManager.version_tuple(remote_ver) > VersionManager.version_tuple(my_ver):
- text = (
- f"Update Available!\n"
- f"New PyTgCalls v{remote_readable_ver} "
- f"is now available!\n"
- )
- if not sys.platform.startswith("win"):
- print(f"\033[93m{text}\033[0m")
- else:
- print(text)
- except asyncio.exceptions.TimeoutError:
- pass
- except ClientConnectionError:
- pass
-
- @staticmethod
- async def _remote_version(branch: str):
- async def get_async(url) -> str:
- session = ClientSession()
- try:
- response: ClientResponse = await session.get(url, timeout=5)
- result_text = await response.text()
- response.close()
- return result_text
- finally:
- await session.close()
-
- result = re.findall(
- "__version__ = '(.*?)'",
- (
- await get_async(
- f"https://raw.githubusercontent.com/"
- f"pytgcalls/pytgcalls/{branch}"
- f"/pytgcalls/__version__.py",
- )
- ),
- )
- return result[0] if len(result) > 0 else __version__
From 15cc78d16f790a2c6aacbb1bf715e25b8825858d Mon Sep 17 00:00:00 2001
From: Randy Dev <90479255+xtsea@users.noreply.github.com>
Date: Wed, 21 Aug 2024 17:36:22 +0700
Subject: [PATCH 075/152] _
---
RyuzakiLib/stream_type.py | 37 -------------------------------------
1 file changed, 37 deletions(-)
delete mode 100644 RyuzakiLib/stream_type.py
diff --git a/RyuzakiLib/stream_type.py b/RyuzakiLib/stream_type.py
deleted file mode 100644
index 86931357..00000000
--- a/RyuzakiLib/stream_type.py
+++ /dev/null
@@ -1,37 +0,0 @@
-from deprecation import deprecated
-
-
-@deprecated(
- deprecated_in="1.0.0.dev1",
- details="This enum is no longer supported.",
-)
-class StreamType:
- def __init__(self):
- self._stream_type = 0
-
- @property
- def live_stream(self):
- self._stream_type = 3
- return self
-
- @property
- def local_stream(self):
- self._stream_type = 10
- return self
-
- """
- *** Pulse Stream ***
- Send bytes like a pulsation, and this reduce the slice,
- because the slice is too heavy
-
- Support: LiveStream, LocalStream
- """
-
- @property
- def pulse_stream(self):
- self._stream_type = 4
- return self
-
- @property
- def stream_mode(self):
- return self._stream_type
From ad270f28be72adf25dcd8e171ad545d2084d1f0f Mon Sep 17 00:00:00 2001
From: Randy Dev <90479255+xtsea@users.noreply.github.com>
Date: Wed, 21 Aug 2024 17:37:20 +0700
Subject: [PATCH 076/152] _
---
RyuzakiLib/sync.py | 108 ---------------------------------------------
1 file changed, 108 deletions(-)
delete mode 100644 RyuzakiLib/sync.py
diff --git a/RyuzakiLib/sync.py b/RyuzakiLib/sync.py
deleted file mode 100644
index 6de9514f..00000000
--- a/RyuzakiLib/sync.py
+++ /dev/null
@@ -1,108 +0,0 @@
-import asyncio
-import functools
-import inspect
-import threading
-
-from .custom_api import CustomApi
-from .media_devices import MediaDevices
-from .methods import Methods
-from .methods.utilities import idle as idle_module
-from .mtproto import MtProtoClient
-
-
-def async_to_sync(obj, name):
- function = getattr(obj, name)
- main_loop = asyncio.get_event_loop()
-
- def async_to_sync_gen(agen, loop, is_main_thread):
- async def a_next(a):
- try:
- return await a.__anext__(), False
- except StopAsyncIteration:
- return None, True
-
- while True:
- if is_main_thread:
- item, done = loop.run_until_complete(
- a_next(agen),
- )
- else:
- item, done = asyncio.run_coroutine_threadsafe(
- a_next(agen),
- loop,
- ).result()
- if done:
- break
- yield item
-
- @functools.wraps(function)
- def async_to_sync_wrap(*args, **kwargs):
- coroutine = function(*args, **kwargs)
-
- try:
- loop = asyncio.get_event_loop()
- except RuntimeError:
- loop = asyncio.new_event_loop()
- asyncio.set_event_loop(loop)
-
- if threading.current_thread() is threading.main_thread() or not main_loop.is_running():
- if loop.is_running():
- return coroutine
- else:
- if inspect.iscoroutine(coroutine):
- return loop.run_until_complete(coroutine)
-
- if inspect.isasyncgen(coroutine):
- return async_to_sync_gen(
- coroutine,
- loop,
- True,
- )
- else:
- if inspect.iscoroutine(coroutine):
- if loop.is_running():
-
- async def coro_wrapper():
- return await asyncio.wrap_future(
- asyncio.run_coroutine_threadsafe(
- coroutine,
- main_loop,
- ),
- )
-
- return coro_wrapper()
- else:
- return asyncio.run_coroutine_threadsafe(
- coroutine,
- main_loop,
- ).result()
-
- if inspect.isasyncgen(coroutine):
- if loop.is_running():
- return coroutine
- else:
- return async_to_sync_gen(
- coroutine,
- main_loop,
- False,
- )
-
- setattr(obj, name, async_to_sync_wrap)
-
-
-def wrap(source):
- for name in dir(source):
- method = getattr(source, name)
-
- if not name.startswith("_"):
- if inspect.iscoroutinefunction(method) or inspect.isasyncgenfunction(method):
- async_to_sync(source, name)
-
-
-# Wrap all Client's relevant methods
-wrap(Methods)
-wrap(CustomApi)
-wrap(MtProtoClient)
-wrap(MediaDevices)
-async_to_sync(idle_module, "idle")
-idle = getattr(idle_module, "idle")
From ce3a7044e3471212ade7ee7f3f8dfd69c053ca0a Mon Sep 17 00:00:00 2001
From: Randy Dev <90479255+xtsea@users.noreply.github.com>
Date: Wed, 21 Aug 2024 17:37:44 +0700
Subject: [PATCH 077/152] _
---
RyuzakiLib/exceptions.py | 153 ---------------------------------------
1 file changed, 153 deletions(-)
delete mode 100644 RyuzakiLib/exceptions.py
diff --git a/RyuzakiLib/exceptions.py b/RyuzakiLib/exceptions.py
deleted file mode 100644
index 472d5071..00000000
--- a/RyuzakiLib/exceptions.py
+++ /dev/null
@@ -1,153 +0,0 @@
-class TooOldPyrogramVersion(Exception):
- def __init__(
- self,
- version_needed: str,
- pyrogram_version: str,
- ):
- super().__init__(
- f"Needed pyrogram {version_needed}+, " "actually installed is " f"{pyrogram_version}",
- )
-
-
-class TooOldTelethonVersion(Exception):
- def __init__(
- self,
- version_needed: str,
- telethon_version: str,
- ):
- super().__init__(
- f"Needed telethon {version_needed}+, " "actually installed is " f"{telethon_version}",
- )
-
-
-class TooOldHydrogramVersion(Exception):
- def __init__(
- self,
- version_needed: str,
- hydrogram_version: str,
- ):
- super().__init__(
- f"Needed hydrogram {version_needed}+, "
- "actually installed is "
- f"{hydrogram_version}",
- )
-
-
-class InvalidStreamMode(Exception):
- def __init__(self):
- super().__init__(
- "Invalid stream mode",
- )
-
-
-class NoMTProtoClientSet(Exception):
- def __init__(self):
- super().__init__(
- "No MTProto client set",
- )
-
-
-class NoActiveGroupCall(Exception):
- def __init__(self):
- super().__init__(
- "No active group call",
- )
-
-
-class NotInGroupCallError(Exception):
- def __init__(self):
- super().__init__(
- "The userbot there isn't in a group call",
- )
-
-
-class AlreadyJoinedError(Exception):
- def __init__(self):
- super().__init__(
- "Already joined into group call",
- )
-
-
-class TelegramServerError(Exception):
- def __init__(self):
- super().__init__(
- "Telegram Server is having some " "internal problems",
- )
-
-
-class ClientNotStarted(Exception):
- def __init__(self):
- super().__init__(
- "Ensure you have started the process with start() " "before calling this method",
- )
-
-
-class PyTgCallsAlreadyRunning(Exception):
- def __init__(self):
- super().__init__(
- "PyTgCalls client is already running",
- )
-
-
-class TooManyCustomApiDecorators(Exception):
- def __init__(self):
- super().__init__(
- "Too Many Custom Api Decorators",
- )
-
-
-class GroupCallNotFound(Exception):
- def __init__(
- self,
- chat_id: int,
- ):
- super().__init__(
- f"Group call not found with the chat id {chat_id}",
- )
-
-
-class InvalidMTProtoClient(Exception):
- def __init__(self):
- super().__init__(
- "Invalid MTProto Client",
- )
-
-
-class NoVideoSourceFound(Exception):
- def __init__(self, path: str):
- super().__init__(
- f'No video source found on "{path}"',
- )
-
-
-class InvalidVideoProportion(Exception):
- def __init__(self, message: str):
- super().__init__(
- message,
- )
-
-
-class NoAudioSourceFound(Exception):
- def __init__(self, path: str):
- super().__init__(
- f'No audio source found on "{path}"',
- )
-
-
-class UnMuteNeeded(Exception):
- def __init__(self):
- super().__init__(
- "Needed to unmute the userbot",
- )
-
-
-class GpytranslateException(Exception):
- pass
-
-
-class TranslationError(GpytranslateException):
- def __init__(self, exception: Exception):
- self.args = (exception,)
-
- def __str__(self) -> str:
- return f"An error occurred while trying to translate/tts: {self.args[0]!r}"
From b69c0430e0f289056750d5888c41a17d57074f11 Mon Sep 17 00:00:00 2001
From: Randy Dev <90479255+xtsea@users.noreply.github.com>
Date: Wed, 21 Aug 2024 17:38:07 +0700
Subject: [PATCH 078/152] _
---
RyuzakiLib/mtproto/__init__.py | 4 -
RyuzakiLib/mtproto/bridged_client.py | 117 -------
RyuzakiLib/mtproto/client_cache.py | 168 ----------
RyuzakiLib/mtproto/hydrogram_client.py | 430 ------------------------
RyuzakiLib/mtproto/mtproto_client.py | 186 -----------
RyuzakiLib/mtproto/nothing | 0
RyuzakiLib/mtproto/pyrogram_client.py | 438 -------------------------
RyuzakiLib/mtproto/telethon_client.py | 407 -----------------------
8 files changed, 1750 deletions(-)
delete mode 100644 RyuzakiLib/mtproto/__init__.py
delete mode 100644 RyuzakiLib/mtproto/bridged_client.py
delete mode 100644 RyuzakiLib/mtproto/client_cache.py
delete mode 100644 RyuzakiLib/mtproto/hydrogram_client.py
delete mode 100644 RyuzakiLib/mtproto/mtproto_client.py
delete mode 100644 RyuzakiLib/mtproto/nothing
delete mode 100644 RyuzakiLib/mtproto/pyrogram_client.py
delete mode 100644 RyuzakiLib/mtproto/telethon_client.py
diff --git a/RyuzakiLib/mtproto/__init__.py b/RyuzakiLib/mtproto/__init__.py
deleted file mode 100644
index d224dd9f..00000000
--- a/RyuzakiLib/mtproto/__init__.py
+++ /dev/null
@@ -1,4 +0,0 @@
-from .bridged_client import BridgedClient
-from .mtproto_client import MtProtoClient
-
-__all__ = ("MtProtoClient", "BridgedClient")
diff --git a/RyuzakiLib/mtproto/bridged_client.py b/RyuzakiLib/mtproto/bridged_client.py
deleted file mode 100644
index 6b45ecda..00000000
--- a/RyuzakiLib/mtproto/bridged_client.py
+++ /dev/null
@@ -1,117 +0,0 @@
-from typing import Any, Callable, Dict, List, Optional
-
-
-class BridgedClient:
- HANDLERS_LIST: Dict[str, List[Callable]] = {
- "CLOSED_HANDLER": [],
- "KICK_HANDLER": [],
- "INVITE_HANDLER": [],
- "LEFT_HANDLER": [],
- "PARTICIPANTS_HANDLER": [],
- }
-
- async def get_call(
- self,
- chat_id: int,
- ):
- pass
-
- async def join_group_call(
- self,
- chat_id: int,
- json_join: str,
- invite_hash: str,
- have_video: bool,
- join_as: Any,
- ) -> str:
- pass
-
- async def leave_group_call(
- self,
- chat_id: int,
- ):
- pass
-
- async def get_group_call_participants(
- self,
- chat_id: int,
- ):
- pass
-
- async def change_volume(
- self,
- chat_id: int,
- volume: int,
- participant: Any,
- ):
- pass
-
- async def set_call_status(
- self,
- chat_id: int,
- muted_status: Optional[bool],
- paused_status: Optional[bool],
- stopped_status: Optional[bool],
- participant: Any,
- ):
- pass
-
- async def get_participants(
- self,
- input_call: Any,
- ):
- pass
-
- async def resolve_peer(
- self,
- user_id: int,
- ):
- pass
-
- def is_connected(self) -> bool:
- pass
-
- async def start(self):
- pass
-
- @staticmethod
- def chat_id(input_peer) -> int:
- is_channel = hasattr(input_peer, "channel_id")
- is_channel_update = input_peer.__class__.__name__ == "Channel"
- is_chat = input_peer.__class__.__name__ == "Chat"
- is_user = (
- input_peer.__class__.__name__ == "PeerUser"
- or input_peer.__class__.__name__ == "InputPeerUser"
- )
- is_forbidden = input_peer.__class__.__name__ == "ChannelForbidden"
- if is_user:
- return input_peer.user_id
- elif is_channel:
- return -1000000000000 - input_peer.channel_id
- elif is_channel_update or is_forbidden:
- return -1000000000000 - input_peer.id
- elif is_chat:
- return -input_peer.id
- else:
- return -input_peer.chat_id
-
- def on_closed_voice_chat(self) -> Callable:
- pass
-
- def on_kicked(self) -> Callable:
- pass
-
- def on_receive_invite(self) -> Callable:
- pass
-
- async def get_id(self) -> int:
- pass
-
- def on_left_group(self) -> Callable:
- pass
-
- def on_participants_change(self) -> Callable:
- pass
-
- async def get_full_chat(self, chat_id: int):
- pass
diff --git a/RyuzakiLib/mtproto/client_cache.py b/RyuzakiLib/mtproto/client_cache.py
deleted file mode 100644
index ad196a14..00000000
--- a/RyuzakiLib/mtproto/client_cache.py
+++ /dev/null
@@ -1,168 +0,0 @@
-import logging
-from math import floor
-from time import time
-from typing import Any, List, Optional
-
-from ..types import Cache
-from ..types.groups import GroupCallParticipant
-from ..types.participant_list import ParticipantList
-from .bridged_client import BridgedClient
-
-py_logger = logging.getLogger("pytgcalls")
-
-
-class ClientCache:
- def __init__(
- self,
- cache_duration: int,
- app: BridgedClient,
- ):
- self._app: BridgedClient = app
- self._cache_duration = cache_duration
- self._full_chat_cache = Cache()
- self._call_participants_cache = Cache()
-
- async def get_full_chat(
- self,
- chat_id: int,
- ) -> Optional[Any]:
- full_chat = self._full_chat_cache.get(chat_id)
- if full_chat is not None:
- py_logger.debug("FullChat cache hit for %d", chat_id)
- return full_chat
- else:
- # noinspection PyBroadException
- try:
- py_logger.debug("FullChat cache miss for %d", chat_id)
- full_chat = await self._app.get_call(chat_id)
- self.set_cache(
- chat_id,
- full_chat,
- )
- return full_chat
- except Exception:
- pass
- return None
-
- def set_participants_cache(
- self,
- input_id: int,
- user_id: int,
- muted: Optional[bool],
- volume: Optional[int],
- can_self_unmute: Optional[bool],
- video: Optional[bool],
- screen_sharing: Optional[bool],
- video_camera: Optional[bool],
- raised_hand: Optional[int],
- left: Optional[int],
- ) -> Optional[GroupCallParticipant]:
- chat_id = self.get_chat_id(input_id)
- if chat_id is not None:
- participants: Optional[ParticipantList] = self._call_participants_cache.get(
- chat_id,
- )
- if participants is not None:
- if not left:
- return participants.set_participant(
- user_id,
- muted if muted is not None else False,
- muted != can_self_unmute,
- video if video is not None else False,
- screen_sharing if screen_sharing is not None else False,
- video_camera if video_camera is not None else False,
- raised_hand is not None,
- floor(volume / 100) if volume is not None else 100,
- )
- else:
- return participants.remove_participant(
- user_id,
- muted if muted is not None else False,
- muted != can_self_unmute,
- video if video is not None else False,
- screen_sharing if screen_sharing is not None else False,
- video_camera if video_camera is not None else False,
- raised_hand is not None,
- floor(volume / 100) if volume is not None else 100,
- )
- return None
-
- async def get_participant_list(
- self,
- chat_id: int,
- ) -> Optional[List[GroupCallParticipant]]:
- input_call = await self.get_full_chat(
- chat_id,
- )
- if input_call is not None:
- participants: Optional[ParticipantList] = self._call_participants_cache.get(
- chat_id,
- )
- if participants is not None:
- last_update = participants.last_mtproto_update
- curr_time = int(time())
- if not (last_update - curr_time > 0):
- py_logger.debug(
- "GetParticipant cache miss for %d",
- chat_id,
- )
- try:
- list_participants = await self._app.get_participants(
- input_call,
- )
- for participant in list_participants:
- self.set_participants_cache(
- input_call.id,
- participant["user_id"],
- participant["muted"],
- participant["volume"],
- participant["can_self_unmute"],
- participant["video"] is not None
- or participant["presentation"] is not None,
- participant["presentation"] is not None,
- participant["video"] is not None,
- participant["raise_hand_rating"],
- participant["left"],
- )
- participants.last_mtproto_update = curr_time + self._cache_duration
- except Exception as e:
- py_logger.error("Error for %s in %d", e, chat_id)
- else:
- py_logger.debug("GetParticipant cache hit for %d", chat_id)
- return participants.get_participants()
- return []
-
- def get_chat_id(
- self,
- input_group_call_id: int,
- ) -> Optional[int]:
- for key in self._call_participants_cache.keys():
- participants = self._call_participants_cache.get(key)
- if participants is not None:
- if participants.input_id == input_group_call_id:
- return key
- return None
-
- def set_cache(
- self,
- chat_id: int,
- input_call: Any,
- ) -> None:
- self._full_chat_cache.put(
- chat_id,
- input_call,
- self._cache_duration,
- )
- self._call_participants_cache.put(
- chat_id,
- ParticipantList(
- input_call.id,
- ),
- )
-
- def drop_cache(
- self,
- chat_id,
- ) -> None:
- self._full_chat_cache.pop(chat_id)
- self._call_participants_cache.pop(chat_id)
diff --git a/RyuzakiLib/mtproto/hydrogram_client.py b/RyuzakiLib/mtproto/hydrogram_client.py
deleted file mode 100644
index ee3afaa1..00000000
--- a/RyuzakiLib/mtproto/hydrogram_client.py
+++ /dev/null
@@ -1,430 +0,0 @@
-import asyncio
-import json
-from typing import Callable, Dict, Optional, Union
-
-from hydrogram import Client, ContinuePropagation
-from hydrogram.raw.base import InputPeer
-from hydrogram.raw.functions.channels import GetFullChannel
-from hydrogram.raw.functions.messages import GetFullChat
-from hydrogram.raw.functions.phone import (
- EditGroupCallParticipant,
- GetGroupCall,
- GetGroupParticipants,
- JoinGroupCall,
- LeaveGroupCall,
-)
-from hydrogram.raw.types import (
- Channel,
- ChannelForbidden,
- Chat,
- ChatForbidden,
- DataJSON,
- GroupCall,
- GroupCallDiscarded,
- InputChannel,
- InputGroupCall,
- InputPeerChannel,
- MessageActionChatDeleteUser,
- MessageActionInviteToGroupCall,
- MessageService,
- PeerChat,
- UpdateChannel,
- UpdateGroupCall,
- UpdateGroupCallConnection,
- UpdateGroupCallParticipants,
- UpdateNewChannelMessage,
- UpdateNewMessage,
- Updates,
-)
-
-from .bridged_client import BridgedClient
-from .client_cache import ClientCache
-
-
-class HydrogramClient(BridgedClient):
- def __init__(
- self,
- cache_duration: int,
- client: Client,
- ):
- self._app: Client = client
- self._cache: ClientCache = ClientCache(
- cache_duration,
- self,
- )
-
- @self._app.on_raw_update()
- async def on_update(_, update, __, data2):
- if isinstance(
- update,
- UpdateGroupCallParticipants,
- ):
- participants = update.participants
- for participant in participants:
- result = self._cache.set_participants_cache(
- update.call.id,
- self.chat_id(participant.peer),
- participant.muted,
- participant.volume,
- participant.can_self_unmute,
- participant.video is not None or participant.presentation is not None,
- participant.presentation is not None,
- participant.video is not None,
- participant.raise_hand_rating,
- participant.left,
- )
- if result is not None:
- if "PARTICIPANTS_HANDLER" in self.HANDLERS_LIST:
- await self._propagate(
- "PARTICIPANTS_HANDLER",
- self._cache.get_chat_id(update.call.id),
- result,
- participant.just_joined,
- participant.left,
- )
- if isinstance(
- update,
- UpdateGroupCall,
- ):
- chat_id = self.chat_id(data2[update.chat_id])
- if isinstance(
- update.call,
- GroupCall,
- ):
- if update.call.schedule_date is None:
- self._cache.set_cache(
- chat_id,
- InputGroupCall(
- access_hash=update.call.access_hash,
- id=update.call.id,
- ),
- )
- if isinstance(
- update.call,
- GroupCallDiscarded,
- ):
- self._cache.drop_cache(chat_id)
- if "CLOSED_HANDLER" in self.HANDLERS_LIST:
- await self._propagate(
- "CLOSED_HANDLER",
- chat_id,
- )
- if isinstance(
- update,
- UpdateChannel,
- ):
- chat_id = self.chat_id(update)
- if len(data2) > 0:
- if isinstance(
- data2[update.channel_id],
- ChannelForbidden,
- ):
- self._cache.drop_cache(chat_id)
- if "KICK_HANDLER" in self.HANDLERS_LIST:
- await self._propagate(
- "KICK_HANDLER",
- chat_id,
- )
- if isinstance(
- update,
- UpdateNewChannelMessage,
- ) or isinstance(
- update,
- UpdateNewMessage,
- ):
- if isinstance(
- update.message,
- MessageService,
- ):
- if isinstance(
- update.message.action,
- MessageActionInviteToGroupCall,
- ):
- if "INVITE_HANDLER" in self.HANDLERS_LIST:
- await self._propagate(
- "INVITE_HANDLER",
- update.message.action,
- )
- if isinstance(
- update.message.action,
- MessageActionChatDeleteUser,
- ):
- if isinstance(
- update.message.peer_id,
- PeerChat,
- ):
- chat_id = self.chat_id(update.message.peer_id)
- if isinstance(
- data2[update.message.peer_id.chat_id],
- ChatForbidden,
- ):
- self._cache.drop_cache(chat_id)
- if "KICK_HANDLER" in self.HANDLERS_LIST:
- await self._propagate(
- "KICK_HANDLER",
- chat_id,
- )
- if isinstance(
- data2,
- Dict,
- ):
- for group_id in data2:
- if isinstance(
- update,
- UpdateNewChannelMessage,
- ) or isinstance(
- update,
- UpdateNewMessage,
- ):
- if isinstance(
- update.message,
- MessageService,
- ):
- if isinstance(
- data2[group_id],
- Channel,
- ) or isinstance(
- data2[group_id],
- Chat,
- ):
- chat_id = self.chat_id(data2[group_id])
- if data2[group_id].left:
- self._cache.drop_cache(
- chat_id,
- )
- if "LEFT_HANDLER" in self.HANDLERS_LIST:
- await self._propagate(
- "LEFT_HANDLER",
- chat_id,
- )
- raise ContinuePropagation()
-
- async def _propagate(self, event_name: str, *args, **kwargs):
- for event in self.HANDLERS_LIST[event_name]:
- asyncio.ensure_future(event(*args, **kwargs))
-
- def on_closed_voice_chat(self) -> Callable:
- def decorator(func: Callable) -> Callable:
- if self is not None:
- self.HANDLERS_LIST["CLOSED_HANDLER"].append(func)
- return func
-
- return decorator
-
- def on_kicked(self) -> Callable:
- def decorator(func: Callable) -> Callable:
- if self is not None:
- self.HANDLERS_LIST["KICK_HANDLER"].append(func)
- return func
-
- return decorator
-
- def on_receive_invite(self) -> Callable:
- def decorator(func: Callable) -> Callable:
- if self is not None:
- self.HANDLERS_LIST["INVITE_HANDLER"].append(func)
- return func
-
- return decorator
-
- def on_left_group(self) -> Callable:
- def decorator(func: Callable) -> Callable:
- if self is not None:
- self.HANDLERS_LIST["LEFT_HANDLER"].append(func)
- return func
-
- return decorator
-
- def on_participants_change(self) -> Callable:
- def decorator(func: Callable) -> Callable:
- if self is not None:
- self.HANDLERS_LIST["PARTICIPANTS_HANDLER"].append(func)
- return func
-
- return decorator
-
- async def get_call(
- self,
- chat_id: int,
- ) -> Optional[InputGroupCall]:
- chat = await self._app.resolve_peer(chat_id)
- if isinstance(chat, InputPeerChannel):
- input_call = (
- await self._app.invoke(
- GetFullChannel(
- channel=InputChannel(
- channel_id=chat.channel_id,
- access_hash=chat.access_hash,
- ),
- ),
- )
- ).full_chat.call
- else:
- input_call = (
- await self._app.invoke(
- GetFullChat(chat_id=chat.chat_id),
- )
- ).full_chat.call
-
- if input_call is not None:
- call: GroupCall = (
- await self._app.invoke(
- GetGroupCall(
- call=input_call,
- limit=-1,
- ),
- )
- ).call
-
- if call.schedule_date is not None:
- return None
-
- return input_call
-
- async def get_group_call_participants(
- self,
- chat_id: int,
- ):
- return await self._cache.get_participant_list(
- chat_id,
- )
-
- async def get_participants(
- self,
- input_call: InputGroupCall,
- ):
- return [
- {
- "user_id": self.chat_id(participant.peer),
- "muted": participant.muted,
- "volume": participant.volume,
- "can_self_unmute": participant.can_self_unmute,
- "video": participant.video,
- "presentation": participant.presentation,
- "raise_hand_rating": participant.raise_hand_rating,
- "left": participant.left,
- }
- for participant in (
- await self._app.invoke(
- GetGroupParticipants(
- call=input_call,
- ids=[],
- sources=[],
- offset="",
- limit=500,
- ),
- )
- ).participants
- ]
-
- async def join_group_call(
- self,
- chat_id: int,
- json_join: str,
- invite_hash: str,
- have_video: bool,
- join_as: InputPeer,
- ) -> str:
- chat_call = await self._cache.get_full_chat(chat_id)
- if chat_call is not None:
- result: Updates = await self._app.invoke(
- JoinGroupCall(
- call=chat_call,
- params=DataJSON(data=json_join),
- muted=False,
- join_as=join_as,
- video_stopped=have_video,
- invite_hash=invite_hash,
- ),
- )
- for update in result.updates:
- if isinstance(
- update,
- UpdateGroupCallParticipants,
- ):
- participants = update.participants
- for participant in participants:
- self._cache.set_participants_cache(
- update.call.id,
- self.chat_id(participant.peer),
- participant.muted,
- participant.volume,
- participant.can_self_unmute,
- participant.video is not None or participant.presentation is not None,
- participant.presentation is not None,
- participant.video is not None,
- participant.raise_hand_rating,
- participant.left,
- )
- if isinstance(update, UpdateGroupCallConnection):
- return update.params.data
-
- return json.dumps({"transport": None})
-
- async def leave_group_call(
- self,
- chat_id: int,
- ):
- chat_call = await self._cache.get_full_chat(chat_id)
- if chat_call is not None:
- await self._app.invoke(
- LeaveGroupCall(
- call=chat_call,
- source=0,
- ),
- )
-
- async def change_volume(
- self,
- chat_id: int,
- volume: int,
- participant: InputPeer,
- ):
- chat_call = await self._cache.get_full_chat(chat_id)
- if chat_call is not None:
- await self._app.invoke(
- EditGroupCallParticipant(
- call=chat_call,
- participant=participant,
- muted=False,
- volume=volume * 100,
- ),
- )
-
- async def set_call_status(
- self,
- chat_id: int,
- muted_status: Optional[bool],
- paused_status: Optional[bool],
- stopped_status: Optional[bool],
- participant: InputPeer,
- ):
- chat_call = await self._cache.get_full_chat(chat_id)
- if chat_call is not None:
- await self._app.invoke(
- EditGroupCallParticipant(
- call=chat_call,
- participant=participant,
- muted=muted_status,
- video_stopped=stopped_status,
- video_paused=paused_status,
- ),
- )
-
- async def get_full_chat(self, chat_id: int):
- return await self._cache.get_full_chat(chat_id)
-
- async def resolve_peer(
- self,
- user_id: Union[int, str],
- ) -> InputPeer:
- return await self._app.resolve_peer(user_id)
-
- async def get_id(self) -> int:
- return (await self._app.get_me()).id
-
- def is_connected(self) -> bool:
- return self._app.is_connected
-
- async def start(self):
- await self._app.start()
diff --git a/RyuzakiLib/mtproto/mtproto_client.py b/RyuzakiLib/mtproto/mtproto_client.py
deleted file mode 100644
index b426e05f..00000000
--- a/RyuzakiLib/mtproto/mtproto_client.py
+++ /dev/null
@@ -1,186 +0,0 @@
-from typing import Any, Callable, List, Optional
-
-from ..exceptions import InvalidMTProtoClient
-from ..types.groups.group_call_participant import GroupCallParticipant
-from .bridged_client import BridgedClient
-
-
-class MtProtoClient:
- def __init__(
- self,
- cache_duration: int,
- client: Any,
- ):
- self._bind_client: Optional[BridgedClient] = None
- if client.__class__.__module__ == "pyrogram.client":
- from .pyrogram_client import PyrogramClient
-
- self._bind_client = PyrogramClient(
- cache_duration,
- client,
- )
- elif client.__class__.__module__ == "telethon.client.telegramclient":
- from .telethon_client import TelethonClient
-
- self._bind_client = TelethonClient(
- cache_duration,
- client,
- )
- elif client.__class__.__module__ == "hydrogram.client":
- from .hydrogram_client import HydrogramClient
-
- self._bind_client = HydrogramClient(
- cache_duration,
- client,
- )
- else:
- raise InvalidMTProtoClient()
-
- @property
- def client(self):
- client_name = self._bind_client.__class__.__name__
- if client_name == "PyrogramClient":
- return "pyrogram"
- elif client_name == "TelethonClient":
- return "telethon"
- elif client_name == "HydrogramClient":
- return "hydrogram"
- else:
- return "unknown"
-
- async def get_group_call_participants(
- self,
- chat_id: int,
- ) -> Optional[List[GroupCallParticipant]]:
- if self._bind_client is not None:
- return await self._bind_client.get_group_call_participants(
- chat_id,
- )
- else:
- raise InvalidMTProtoClient()
-
- async def join_group_call(
- self,
- chat_id: int,
- json_join: str,
- invite_hash: str,
- have_video: bool,
- join_as: Any,
- ) -> str:
- if self._bind_client is not None:
- return await self._bind_client.join_group_call(
- chat_id,
- json_join,
- invite_hash,
- have_video,
- join_as,
- )
- else:
- raise InvalidMTProtoClient()
-
- async def leave_group_call(
- self,
- chat_id: int,
- ):
- if self._bind_client is not None:
- await self._bind_client.leave_group_call(
- chat_id,
- )
- else:
- raise InvalidMTProtoClient()
-
- async def change_volume(
- self,
- chat_id: int,
- volume: int,
- participant: Any,
- ):
- if self._bind_client is not None:
- await self._bind_client.change_volume(
- chat_id,
- volume,
- participant,
- )
- else:
- raise InvalidMTProtoClient()
-
- async def set_call_status(
- self,
- chat_id: int,
- muted_status: Optional[bool],
- paused_status: Optional[bool],
- stopped_status: Optional[bool],
- participant: Any,
- ):
- if self._bind_client is not None:
- await self._bind_client.set_call_status(
- chat_id,
- muted_status,
- paused_status,
- stopped_status,
- participant,
- )
- else:
- raise InvalidMTProtoClient()
-
- async def get_full_chat(
- self,
- chat_id: int,
- ):
- if self._bind_client is not None:
- return await self._bind_client.get_full_chat(
- chat_id,
- )
- raise InvalidMTProtoClient()
-
- async def resolve_peer(
- self,
- user_id: int,
- ):
- if self._bind_client is not None:
- return await self._bind_client.resolve_peer(
- user_id,
- )
- raise InvalidMTProtoClient()
-
- async def get_id(self) -> int:
- if self._bind_client is not None:
- return await self._bind_client.get_id()
- raise InvalidMTProtoClient()
-
- @property
- def is_connected(self) -> bool:
- if self._bind_client is not None:
- return self._bind_client.is_connected()
- raise InvalidMTProtoClient()
-
- async def start(self):
- if self._bind_client is not None:
- await self._bind_client.start()
- else:
- raise InvalidMTProtoClient()
-
- def on_closed_voice_chat(self) -> Callable:
- if self._bind_client is not None:
- return self._bind_client.on_closed_voice_chat()
- raise InvalidMTProtoClient()
-
- def on_kicked(self) -> Callable:
- if self._bind_client is not None:
- return self._bind_client.on_kicked()
- raise InvalidMTProtoClient()
-
- def on_receive_invite(self) -> Callable:
- if self._bind_client is not None:
- return self._bind_client.on_receive_invite()
- raise InvalidMTProtoClient()
-
- def on_left_group(self) -> Callable:
- if self._bind_client is not None:
- return self._bind_client.on_left_group()
- raise InvalidMTProtoClient()
-
- def on_participants_change(self) -> Callable:
- if self._bind_client is not None:
- return self._bind_client.on_participants_change()
- raise InvalidMTProtoClient()
diff --git a/RyuzakiLib/mtproto/nothing b/RyuzakiLib/mtproto/nothing
deleted file mode 100644
index e69de29b..00000000
diff --git a/RyuzakiLib/mtproto/pyrogram_client.py b/RyuzakiLib/mtproto/pyrogram_client.py
deleted file mode 100644
index 6660d244..00000000
--- a/RyuzakiLib/mtproto/pyrogram_client.py
+++ /dev/null
@@ -1,438 +0,0 @@
-import asyncio
-import json
-from typing import Callable, Dict, Optional, Union
-
-import pyrogram
-from pyrogram import Client, ContinuePropagation
-from pyrogram.raw.base import InputPeer
-from pyrogram.raw.functions.channels import GetFullChannel
-from pyrogram.raw.functions.messages import GetFullChat
-from pyrogram.raw.functions.phone import (
- EditGroupCallParticipant,
- GetGroupCall,
- GetGroupParticipants,
- JoinGroupCall,
- LeaveGroupCall,
-)
-from pyrogram.raw.types import (
- Channel,
- ChannelForbidden,
- Chat,
- ChatForbidden,
- DataJSON,
- GroupCall,
- GroupCallDiscarded,
- InputChannel,
- InputGroupCall,
- InputPeerChannel,
- MessageActionChatDeleteUser,
- MessageActionInviteToGroupCall,
- MessageService,
- PeerChat,
- UpdateChannel,
- UpdateGroupCall,
- UpdateGroupCallConnection,
- UpdateGroupCallParticipants,
- UpdateNewChannelMessage,
- UpdateNewMessage,
- Updates,
-)
-
-from ..version_manager import VersionManager
-from .bridged_client import BridgedClient
-from .client_cache import ClientCache
-
-
-class PyrogramClient(BridgedClient):
- def __init__(
- self,
- cache_duration: int,
- client: Client,
- ):
- self._app: Client = client
- if VersionManager.version_tuple(
- pyrogram.__version__,
- ) > VersionManager.version_tuple(
- "2.0.0",
- ):
- self._app.send = self._app.invoke
- self._cache: ClientCache = ClientCache(
- cache_duration,
- self,
- )
-
- @self._app.on_raw_update()
- async def on_update(_, update, __, data2):
- if isinstance(
- update,
- UpdateGroupCallParticipants,
- ):
- participants = update.participants
- for participant in participants:
- result = self._cache.set_participants_cache(
- update.call.id,
- self.chat_id(participant.peer),
- participant.muted,
- participant.volume,
- participant.can_self_unmute,
- participant.video is not None or participant.presentation is not None,
- participant.presentation is not None,
- participant.video is not None,
- participant.raise_hand_rating,
- participant.left,
- )
- if result is not None:
- if "PARTICIPANTS_HANDLER" in self.HANDLERS_LIST:
- await self._propagate(
- "PARTICIPANTS_HANDLER",
- self._cache.get_chat_id(update.call.id),
- result,
- participant.just_joined,
- participant.left,
- )
- if isinstance(
- update,
- UpdateGroupCall,
- ):
- chat_id = self.chat_id(data2[update.chat_id])
- if isinstance(
- update.call,
- GroupCall,
- ):
- if update.call.schedule_date is None:
- self._cache.set_cache(
- chat_id,
- InputGroupCall(
- access_hash=update.call.access_hash,
- id=update.call.id,
- ),
- )
- if isinstance(
- update.call,
- GroupCallDiscarded,
- ):
- self._cache.drop_cache(chat_id)
- if "CLOSED_HANDLER" in self.HANDLERS_LIST:
- await self._propagate(
- "CLOSED_HANDLER",
- chat_id,
- )
- if isinstance(
- update,
- UpdateChannel,
- ):
- chat_id = self.chat_id(update)
- if len(data2) > 0:
- if isinstance(
- data2[update.channel_id],
- ChannelForbidden,
- ):
- self._cache.drop_cache(chat_id)
- if "KICK_HANDLER" in self.HANDLERS_LIST:
- await self._propagate(
- "KICK_HANDLER",
- chat_id,
- )
- if isinstance(
- update,
- UpdateNewChannelMessage,
- ) or isinstance(
- update,
- UpdateNewMessage,
- ):
- if isinstance(
- update.message,
- MessageService,
- ):
- if isinstance(
- update.message.action,
- MessageActionInviteToGroupCall,
- ):
- if "INVITE_HANDLER" in self.HANDLERS_LIST:
- await self._propagate(
- "INVITE_HANDLER",
- update.message.action,
- )
- if isinstance(
- update.message.action,
- MessageActionChatDeleteUser,
- ):
- if isinstance(
- update.message.peer_id,
- PeerChat,
- ):
- chat_id = self.chat_id(update.message.peer_id)
- if isinstance(
- data2[update.message.peer_id.chat_id],
- ChatForbidden,
- ):
- self._cache.drop_cache(chat_id)
- if "KICK_HANDLER" in self.HANDLERS_LIST:
- await self._propagate(
- "KICK_HANDLER",
- chat_id,
- )
- if isinstance(
- data2,
- Dict,
- ):
- for group_id in data2:
- if isinstance(
- update,
- UpdateNewChannelMessage,
- ) or isinstance(
- update,
- UpdateNewMessage,
- ):
- if isinstance(
- update.message,
- MessageService,
- ):
- if isinstance(
- data2[group_id],
- Channel,
- ) or isinstance(
- data2[group_id],
- Chat,
- ):
- chat_id = self.chat_id(data2[group_id])
- if data2[group_id].left:
- self._cache.drop_cache(
- chat_id,
- )
- if "LEFT_HANDLER" in self.HANDLERS_LIST:
- await self._propagate(
- "LEFT_HANDLER",
- chat_id,
- )
- raise ContinuePropagation()
-
- async def _propagate(self, event_name: str, *args, **kwargs):
- for event in self.HANDLERS_LIST[event_name]:
- asyncio.ensure_future(event(*args, **kwargs))
-
- def on_closed_voice_chat(self) -> Callable:
- def decorator(func: Callable) -> Callable:
- if self is not None:
- self.HANDLERS_LIST["CLOSED_HANDLER"].append(func)
- return func
-
- return decorator
-
- def on_kicked(self) -> Callable:
- def decorator(func: Callable) -> Callable:
- if self is not None:
- self.HANDLERS_LIST["KICK_HANDLER"].append(func)
- return func
-
- return decorator
-
- def on_receive_invite(self) -> Callable:
- def decorator(func: Callable) -> Callable:
- if self is not None:
- self.HANDLERS_LIST["INVITE_HANDLER"].append(func)
- return func
-
- return decorator
-
- def on_left_group(self) -> Callable:
- def decorator(func: Callable) -> Callable:
- if self is not None:
- self.HANDLERS_LIST["LEFT_HANDLER"].append(func)
- return func
-
- return decorator
-
- def on_participants_change(self) -> Callable:
- def decorator(func: Callable) -> Callable:
- if self is not None:
- self.HANDLERS_LIST["PARTICIPANTS_HANDLER"].append(func)
- return func
-
- return decorator
-
- async def get_call(
- self,
- chat_id: int,
- ) -> Optional[InputGroupCall]:
- chat = await self._app.resolve_peer(chat_id)
- if isinstance(chat, InputPeerChannel):
- input_call = (
- await self._app.send(
- GetFullChannel(
- channel=InputChannel(
- channel_id=chat.channel_id,
- access_hash=chat.access_hash,
- ),
- ),
- )
- ).full_chat.call
- else:
- input_call = (
- await self._app.send(
- GetFullChat(chat_id=chat.chat_id),
- )
- ).full_chat.call
-
- if input_call is not None:
- call: GroupCall = (
- await self._app.send(
- GetGroupCall(
- call=input_call,
- limit=-1,
- ),
- )
- ).call
-
- if call.schedule_date is not None:
- return None
-
- return input_call
-
- async def get_group_call_participants(
- self,
- chat_id: int,
- ):
- return await self._cache.get_participant_list(
- chat_id,
- )
-
- async def get_participants(
- self,
- input_call: InputGroupCall,
- ):
- return [
- {
- "user_id": self.chat_id(participant.peer),
- "muted": participant.muted,
- "volume": participant.volume,
- "can_self_unmute": participant.can_self_unmute,
- "video": participant.video,
- "presentation": participant.presentation,
- "raise_hand_rating": participant.raise_hand_rating,
- "left": participant.left,
- }
- for participant in (
- await self._app.send(
- GetGroupParticipants(
- call=input_call,
- ids=[],
- sources=[],
- offset="",
- limit=500,
- ),
- )
- ).participants
- ]
-
- async def join_group_call(
- self,
- chat_id: int,
- json_join: str,
- invite_hash: str,
- have_video: bool,
- join_as: InputPeer,
- ) -> str:
- chat_call = await self._cache.get_full_chat(chat_id)
- if chat_call is not None:
- result: Updates = await self._app.send(
- JoinGroupCall(
- call=chat_call,
- params=DataJSON(data=json_join),
- muted=False,
- join_as=join_as,
- video_stopped=have_video,
- invite_hash=invite_hash,
- ),
- )
- for update in result.updates:
- if isinstance(
- update,
- UpdateGroupCallParticipants,
- ):
- participants = update.participants
- for participant in participants:
- self._cache.set_participants_cache(
- update.call.id,
- self.chat_id(participant.peer),
- participant.muted,
- participant.volume,
- participant.can_self_unmute,
- participant.video is not None or participant.presentation is not None,
- participant.presentation is not None,
- participant.video is not None,
- participant.raise_hand_rating,
- participant.left,
- )
- if isinstance(update, UpdateGroupCallConnection):
- return update.params.data
-
- return json.dumps({"transport": None})
-
- async def leave_group_call(
- self,
- chat_id: int,
- ):
- chat_call = await self._cache.get_full_chat(chat_id)
- if chat_call is not None:
- await self._app.send(
- LeaveGroupCall(
- call=chat_call,
- source=0,
- ),
- )
-
- async def change_volume(
- self,
- chat_id: int,
- volume: int,
- participant: InputPeer,
- ):
- chat_call = await self._cache.get_full_chat(chat_id)
- if chat_call is not None:
- await self._app.send(
- EditGroupCallParticipant(
- call=chat_call,
- participant=participant,
- muted=False,
- volume=volume * 100,
- ),
- )
-
- async def set_call_status(
- self,
- chat_id: int,
- muted_status: Optional[bool],
- paused_status: Optional[bool],
- stopped_status: Optional[bool],
- participant: InputPeer,
- ):
- chat_call = await self._cache.get_full_chat(chat_id)
- if chat_call is not None:
- await self._app.send(
- EditGroupCallParticipant(
- call=chat_call,
- participant=participant,
- muted=muted_status,
- video_stopped=stopped_status,
- video_paused=paused_status,
- ),
- )
-
- async def get_full_chat(self, chat_id: int):
- return await self._cache.get_full_chat(chat_id)
-
- async def resolve_peer(
- self,
- user_id: Union[int, str],
- ) -> InputPeer:
- return await self._app.resolve_peer(user_id)
-
- async def get_id(self) -> int:
- return (await self._app.get_me()).id
-
- def is_connected(self) -> bool:
- return self._app.is_connected
-
- async def start(self):
- await self._app.start()
diff --git a/RyuzakiLib/mtproto/telethon_client.py b/RyuzakiLib/mtproto/telethon_client.py
deleted file mode 100644
index 6926b19b..00000000
--- a/RyuzakiLib/mtproto/telethon_client.py
+++ /dev/null
@@ -1,407 +0,0 @@
-import asyncio
-import json
-from typing import Callable, Optional, Union
-
-from telethon import TelegramClient
-from telethon.errors import ChannelPrivateError
-from telethon.events import Raw
-from telethon.tl.functions.channels import GetFullChannelRequest
-from telethon.tl.functions.messages import GetFullChatRequest
-from telethon.tl.functions.phone import (
- EditGroupCallParticipantRequest,
- GetGroupCallRequest,
- GetGroupParticipantsRequest,
- JoinGroupCallRequest,
- LeaveGroupCallRequest,
-)
-from telethon.tl.types import (
- ChatForbidden,
- DataJSON,
- GroupCall,
- GroupCallDiscarded,
- InputChannel,
- InputGroupCall,
- InputPeerChannel,
- MessageActionChatDeleteUser,
- MessageActionInviteToGroupCall,
- MessageService,
- PeerChat,
- TypeInputPeer,
- UpdateChannel,
- UpdateGroupCall,
- UpdateGroupCallConnection,
- UpdateGroupCallParticipants,
- UpdateNewChannelMessage,
- UpdateNewMessage,
- Updates,
-)
-
-from .bridged_client import BridgedClient
-from .client_cache import ClientCache
-
-
-class TelethonClient(BridgedClient):
- def __init__(
- self,
- cache_duration: int,
- client: TelegramClient,
- ):
- self._app: TelegramClient = client
- self._cache: ClientCache = ClientCache(
- cache_duration,
- self,
- )
-
- @self._app.on(Raw())
- async def on_update(update):
- if isinstance(
- update,
- UpdateGroupCallParticipants,
- ):
- participants = update.participants
- for participant in participants:
- result = self._cache.set_participants_cache(
- update.call.id,
- self.chat_id(participant.peer),
- participant.muted,
- participant.volume,
- participant.can_self_unmute,
- participant.video is not None or participant.presentation is not None,
- participant.presentation is not None,
- participant.video is not None,
- participant.raise_hand_rating,
- participant.left,
- )
- if result is not None:
- if "PARTICIPANTS_HANDLER" in self.HANDLERS_LIST:
- await self._propagate(
- "PARTICIPANTS_HANDLER",
- self._cache.get_chat_id(update.call.id),
- result,
- participant.just_joined,
- participant.left,
- )
- if isinstance(
- update,
- UpdateGroupCall,
- ):
- chat_id = self.chat_id(
- await self._app.get_entity(update.chat_id),
- )
- if isinstance(
- update.call,
- GroupCall,
- ):
- if update.call.schedule_date is None:
- self._cache.set_cache(
- chat_id,
- InputGroupCall(
- access_hash=update.call.access_hash,
- id=update.call.id,
- ),
- )
- if isinstance(
- update.call,
- GroupCallDiscarded,
- ):
- self._cache.drop_cache(
- chat_id,
- )
- if "CLOSED_HANDLER" in self.HANDLERS_LIST:
- await self._propagate(
- "CLOSED_HANDLER",
- chat_id,
- )
- if isinstance(
- update,
- UpdateChannel,
- ):
- chat_id = self.chat_id(update)
- try:
- await self._app.get_entity(chat_id)
- except ChannelPrivateError:
- self._cache.drop_cache(chat_id)
- if "KICK_HANDLER" in self.HANDLERS_LIST:
- await self._propagate(
- "KICK_HANDLER",
- chat_id,
- )
-
- if isinstance(
- update,
- UpdateNewChannelMessage,
- ) or isinstance(
- update,
- UpdateNewMessage,
- ):
- if isinstance(
- update.message,
- MessageService,
- ):
- if isinstance(
- update.message.action,
- MessageActionInviteToGroupCall,
- ):
- if "INVITE_HANDLER" in self.HANDLERS_LIST:
- await self._propagate(
- "INVITE_HANDLER",
- update.message.action,
- )
- if isinstance(update.message.out, bool):
- if update.message.out:
- chat_id = self.chat_id(update.message.peer_id)
- self._cache.drop_cache(chat_id)
- if "LEFT_HANDLER" in self.HANDLERS_LIST:
- await self._propagate(
- "LEFT_HANDLER",
- chat_id,
- )
- if isinstance(
- update.message.action,
- MessageActionChatDeleteUser,
- ):
- if isinstance(
- update.message.peer_id,
- PeerChat,
- ):
- chat_id = self.chat_id(update.message.peer_id)
- if isinstance(
- await self._app.get_entity(chat_id),
- ChatForbidden,
- ):
- self._cache.drop_cache(chat_id)
- if "KICK_HANDLER" in self.HANDLERS_LIST:
- await self._propagate(
- "KICK_HANDLER",
- chat_id,
- )
-
- async def get_call(
- self,
- chat_id: int,
- ) -> Optional[InputGroupCall]:
- chat = await self._app.get_input_entity(chat_id)
- if isinstance(chat, InputPeerChannel):
- input_call = (
- await self._app(
- GetFullChannelRequest(
- InputChannel(
- chat.channel_id,
- chat.access_hash,
- ),
- ),
- )
- ).full_chat.call
- else:
- input_call = (
- await self._app(
- GetFullChatRequest(chat_id),
- )
- ).full_chat.call
- if input_call is not None:
- try:
- call: GroupCall = (
- await self._app(
- GetGroupCallRequest(
- call=input_call,
- limit=-1,
- ),
- )
- ).call
- if call.schedule_date is not None:
- return None
- except Exception as e:
- print(e)
- return input_call
-
- async def get_group_call_participants(
- self,
- chat_id: int,
- ):
- return await self._cache.get_participant_list(
- chat_id,
- )
-
- async def get_participants(
- self,
- input_call: InputGroupCall,
- ):
- return [
- {
- "user_id": self.chat_id(participant.peer),
- "muted": participant.muted,
- "volume": participant.volume,
- "can_self_unmute": participant.can_self_unmute,
- "video": participant.video,
- "presentation": participant.presentation,
- "raise_hand_rating": participant.raise_hand_rating,
- "left": participant.left,
- }
- for participant in (
- await self._app(
- GetGroupParticipantsRequest(
- call=input_call,
- ids=[],
- sources=[],
- offset="",
- limit=500,
- ),
- )
- ).participants
- ]
-
- async def join_group_call(
- self,
- chat_id: int,
- json_join: str,
- invite_hash: str,
- have_video: bool,
- join_as: TypeInputPeer,
- ) -> str:
- chat_call = await self._cache.get_full_chat(chat_id)
- if chat_call is not None:
- result: Updates = await self._app(
- JoinGroupCallRequest(
- call=chat_call,
- params=DataJSON(data=json_join),
- muted=False,
- join_as=join_as,
- video_stopped=have_video,
- invite_hash=invite_hash,
- ),
- )
- for update in result.updates:
- if isinstance(
- update,
- UpdateGroupCallParticipants,
- ):
- participants = update.participants
- for participant in participants:
- self._cache.set_participants_cache(
- update.call.id,
- self.chat_id(participant.peer),
- participant.muted,
- participant.volume,
- participant.can_self_unmute,
- participant.video is not None or participant.presentation is not None,
- participant.presentation is not None,
- participant.video is not None,
- participant.raise_hand_rating,
- participant.left,
- )
- if isinstance(update, UpdateGroupCallConnection):
- return update.params.data
-
- return json.dumps({"transport": None})
-
- async def _propagate(self, event_name: str, *args, **kwargs):
- for event in self.HANDLERS_LIST[event_name]:
- asyncio.ensure_future(event(*args, **kwargs))
-
- def on_closed_voice_chat(self) -> Callable:
- def decorator(func: Callable) -> Callable:
- if self is not None:
- self.HANDLERS_LIST["CLOSED_HANDLER"].append(func)
- return func
-
- return decorator
-
- def on_kicked(self) -> Callable:
- def decorator(func: Callable) -> Callable:
- if self is not None:
- self.HANDLERS_LIST["KICK_HANDLER"].append(func)
- return func
-
- return decorator
-
- def on_receive_invite(self) -> Callable:
- def decorator(func: Callable) -> Callable:
- if self is not None:
- self.HANDLERS_LIST["INVITE_HANDLER"].append(func)
- return func
-
- return decorator
-
- def on_left_group(self) -> Callable:
- def decorator(func: Callable) -> Callable:
- if self is not None:
- self.HANDLERS_LIST["LEFT_HANDLER"].append(func)
- return func
-
- return decorator
-
- def on_participants_change(self) -> Callable:
- def decorator(func: Callable) -> Callable:
- if self is not None:
- self.HANDLERS_LIST["PARTICIPANTS_HANDLER"].append(func)
- return func
-
- return decorator
-
- async def leave_group_call(
- self,
- chat_id: int,
- ):
- chat_call = await self._cache.get_full_chat(chat_id)
- if chat_call is not None:
- await self._app(
- LeaveGroupCallRequest(
- call=chat_call,
- source=0,
- ),
- )
-
- async def change_volume(
- self,
- chat_id: int,
- volume: int,
- participant: TypeInputPeer,
- ):
- chat_call = await self._cache.get_full_chat(chat_id)
- if chat_call is not None:
- await self._app(
- EditGroupCallParticipantRequest(
- call=chat_call,
- participant=participant,
- muted=False,
- volume=volume * 100,
- ),
- )
-
- async def set_call_status(
- self,
- chat_id: int,
- muted_status: Optional[bool],
- paused_status: Optional[bool],
- stopped_status: Optional[bool],
- participant: TypeInputPeer,
- ):
- chat_call = await self._cache.get_full_chat(chat_id)
- if chat_call is not None:
- await self._app(
- EditGroupCallParticipantRequest(
- call=chat_call,
- participant=participant,
- muted=muted_status,
- video_stopped=stopped_status,
- video_paused=paused_status,
- ),
- )
-
- async def get_full_chat(self, chat_id: int):
- return await self._cache.get_full_chat(chat_id)
-
- async def resolve_peer(
- self,
- user_id: Union[int, str],
- ) -> TypeInputPeer:
- return await self._app.get_input_entity(user_id)
-
- async def get_id(self) -> int:
- return (await self._app.get_me()).id
-
- def is_connected(self) -> bool:
- return self._app.is_connected()
-
- async def start(self):
- await self._app.start()
From ff47c23871a510b1a1acbed07e47b60c4814dc3c Mon Sep 17 00:00:00 2001
From: Randy Dev <90479255+xtsea@users.noreply.github.com>
Date: Wed, 21 Aug 2024 17:39:27 +0700
Subject: [PATCH 079/152] _
---
RyuzakiLib/__init__.py | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/RyuzakiLib/__init__.py b/RyuzakiLib/__init__.py
index 7f462b7b..7128f9b7 100644
--- a/RyuzakiLib/__init__.py
+++ b/RyuzakiLib/__init__.py
@@ -56,14 +56,11 @@
from .mental import *
from .profile.user import Clone
from .pushdb import *
-from .py_tgcalls import PyTgCalls
from .pyrogramMod import PyrogramMod
from .quote import *
from .reminder import *
from .spamwatch.clients import SibylBan
from .story import *
-from .stream_type import StreamType
-from .sync import idle
from .system.read import System
from .tr import *
@@ -84,9 +81,8 @@ class AwesomeCoding(BaseModel):
__all__ = [
- "__version__" "CustomApi",
- "PyTgCalls",
- "StreamType",
+ "__version__"
+ "CustomApi",
"RendyDevChat",
"GeminiLatest",
"Github",
From 31d4318554ae4c3e7316dbdbff1be9b323395c68 Mon Sep 17 00:00:00 2001
From: Randy Dev <90479255+xtsea@users.noreply.github.com>
Date: Wed, 21 Aug 2024 17:40:42 +0700
Subject: [PATCH 080/152] _
---
RyuzakiLib/types/input_stream/__init__.py | 41 ----------
.../types/input_stream/audio_image_piped.py | 81 -------------------
.../types/input_stream/audio_parameters.py | 17 ----
RyuzakiLib/types/input_stream/audio_piped.py | 43 ----------
.../types/input_stream/audio_quality.py | 8 --
RyuzakiLib/types/input_stream/audio_stream.py | 16 ----
.../types/input_stream/audio_video_piped.py | 72 -----------------
.../input_stream/capture_audio_device.py | 31 -------
.../types/input_stream/capture_av_desktop.py | 64 ---------------
.../input_stream/capture_av_device_desktop.py | 55 -------------
.../input_stream/capture_video_desktop.py | 32 --------
.../types/input_stream/input_audio_stream.py | 20 -----
RyuzakiLib/types/input_stream/input_stream.py | 22 -----
.../types/input_stream/input_video_stream.py | 20 -----
.../types/input_stream/quality/__init__.py | 15 ----
.../quality/high_quality_audio.py | 14 ----
.../quality/high_quality_video.py | 14 ----
.../input_stream/quality/low_quality_audio.py | 14 ----
.../input_stream/quality/low_quality_video.py | 14 ----
.../quality/medium_quality_audio.py | 14 ----
.../quality/medium_quality_video.py | 14 ----
RyuzakiLib/types/input_stream/smart_stream.py | 27 -------
RyuzakiLib/types/input_stream/stream.py | 15 ----
.../types/input_stream/video_parameters.py | 22 -----
RyuzakiLib/types/input_stream/video_piped.py | 49 -----------
.../types/input_stream/video_quality.py | 10 ---
RyuzakiLib/types/input_stream/video_stream.py | 15 ----
27 files changed, 759 deletions(-)
delete mode 100644 RyuzakiLib/types/input_stream/__init__.py
delete mode 100644 RyuzakiLib/types/input_stream/audio_image_piped.py
delete mode 100644 RyuzakiLib/types/input_stream/audio_parameters.py
delete mode 100644 RyuzakiLib/types/input_stream/audio_piped.py
delete mode 100644 RyuzakiLib/types/input_stream/audio_quality.py
delete mode 100644 RyuzakiLib/types/input_stream/audio_stream.py
delete mode 100644 RyuzakiLib/types/input_stream/audio_video_piped.py
delete mode 100644 RyuzakiLib/types/input_stream/capture_audio_device.py
delete mode 100644 RyuzakiLib/types/input_stream/capture_av_desktop.py
delete mode 100644 RyuzakiLib/types/input_stream/capture_av_device_desktop.py
delete mode 100644 RyuzakiLib/types/input_stream/capture_video_desktop.py
delete mode 100644 RyuzakiLib/types/input_stream/input_audio_stream.py
delete mode 100644 RyuzakiLib/types/input_stream/input_stream.py
delete mode 100644 RyuzakiLib/types/input_stream/input_video_stream.py
delete mode 100644 RyuzakiLib/types/input_stream/quality/__init__.py
delete mode 100644 RyuzakiLib/types/input_stream/quality/high_quality_audio.py
delete mode 100644 RyuzakiLib/types/input_stream/quality/high_quality_video.py
delete mode 100644 RyuzakiLib/types/input_stream/quality/low_quality_audio.py
delete mode 100644 RyuzakiLib/types/input_stream/quality/low_quality_video.py
delete mode 100644 RyuzakiLib/types/input_stream/quality/medium_quality_audio.py
delete mode 100644 RyuzakiLib/types/input_stream/quality/medium_quality_video.py
delete mode 100644 RyuzakiLib/types/input_stream/smart_stream.py
delete mode 100644 RyuzakiLib/types/input_stream/stream.py
delete mode 100644 RyuzakiLib/types/input_stream/video_parameters.py
delete mode 100644 RyuzakiLib/types/input_stream/video_piped.py
delete mode 100644 RyuzakiLib/types/input_stream/video_quality.py
delete mode 100644 RyuzakiLib/types/input_stream/video_stream.py
diff --git a/RyuzakiLib/types/input_stream/__init__.py b/RyuzakiLib/types/input_stream/__init__.py
deleted file mode 100644
index 4805d9f5..00000000
--- a/RyuzakiLib/types/input_stream/__init__.py
+++ /dev/null
@@ -1,41 +0,0 @@
-from .audio_image_piped import AudioImagePiped
-from .audio_parameters import AudioParameters
-from .audio_piped import AudioPiped
-from .audio_quality import AudioQuality
-from .audio_stream import AudioStream
-from .audio_video_piped import AudioVideoPiped
-from .capture_audio_device import CaptureAudioDevice
-from .capture_av_desktop import CaptureAVDesktop
-from .capture_av_device_desktop import CaptureAVDeviceDesktop
-from .capture_video_desktop import CaptureVideoDesktop
-from .input_audio_stream import InputAudioStream
-from .input_stream import InputStream
-from .input_video_stream import InputVideoStream
-from .smart_stream import SmartStream
-from .stream import Stream
-from .video_parameters import VideoParameters
-from .video_piped import VideoPiped
-from .video_quality import VideoQuality
-from .video_stream import VideoStream
-
-__all__ = (
- "AudioParameters",
- "AudioImagePiped",
- "AudioPiped",
- "AudioQuality",
- "AudioVideoPiped",
- "InputAudioStream",
- "Stream",
- "InputStream",
- "InputVideoStream",
- "SmartStream",
- "VideoStream",
- "AudioStream",
- "CaptureAudioDevice",
- "CaptureAVDesktop",
- "CaptureAVDeviceDesktop",
- "CaptureVideoDesktop",
- "VideoParameters",
- "VideoPiped",
- "VideoQuality",
-)
diff --git a/RyuzakiLib/types/input_stream/audio_image_piped.py b/RyuzakiLib/types/input_stream/audio_image_piped.py
deleted file mode 100644
index 1ad6b950..00000000
--- a/RyuzakiLib/types/input_stream/audio_image_piped.py
+++ /dev/null
@@ -1,81 +0,0 @@
-from typing import Dict, Optional
-
-from ntgcalls import InputMode
-
-from ...ffmpeg import build_command, check_stream
-from .audio_parameters import AudioParameters
-from .audio_stream import AudioStream
-from .smart_stream import SmartStream
-from .video_parameters import VideoParameters
-from .video_stream import VideoStream
-
-
-class AudioImagePiped(SmartStream):
- def __init__(
- self,
- audio_path: str,
- image_path: str,
- audio_parameters: AudioParameters = AudioParameters(),
- video_parameters: VideoParameters = VideoParameters(),
- headers: Optional[Dict[str, str]] = None,
- additional_ffmpeg_parameters: str = "",
- ):
- self._image_path = image_path
- self._audio_path = audio_path
- video_parameters.frame_rate = 1
- self._audio_data = (
- additional_ffmpeg_parameters,
- self._audio_path,
- audio_parameters,
- [],
- headers,
- )
- self._video_data = (
- additional_ffmpeg_parameters,
- self._image_path,
- video_parameters,
- [
- "-loop",
- "1",
- "-framerate",
- str(video_parameters.frame_rate),
- ],
- headers,
- )
- super().__init__(
- AudioStream(
- InputMode.Shell,
- " ".join(
- build_command(
- "ffmpeg",
- *self._audio_data,
- ),
- ),
- audio_parameters,
- ),
- VideoStream(
- InputMode.Shell,
- " ".join(
- build_command(
- "ffmpeg",
- *self._video_data,
- ),
- ),
- video_parameters,
- ),
- )
-
- async def check_stream(self):
- await check_stream(
- *self._audio_data,
- )
- await check_stream(
- *self._video_data,
- need_image=True,
- )
- self.stream_video.path = " ".join(
- build_command(
- "ffmpeg",
- *self._video_data,
- ),
- )
diff --git a/RyuzakiLib/types/input_stream/audio_parameters.py b/RyuzakiLib/types/input_stream/audio_parameters.py
deleted file mode 100644
index 789dc1e8..00000000
--- a/RyuzakiLib/types/input_stream/audio_parameters.py
+++ /dev/null
@@ -1,17 +0,0 @@
-from ..py_object import PyObject
-from .audio_quality import AudioQuality
-
-
-class AudioParameters(PyObject):
- def __init__(
- self,
- bitrate: int = 48000,
- channels: int = 1,
- ):
- max_bit, max_chan = max(AudioQuality, key=lambda x: x.value[0]).value
- self.bitrate: int = min(bitrate, max_bit)
- self.channels: int = min(channels, max_chan)
-
- @staticmethod
- def from_quality(quality: AudioQuality):
- return AudioParameters(*quality.value)
diff --git a/RyuzakiLib/types/input_stream/audio_piped.py b/RyuzakiLib/types/input_stream/audio_piped.py
deleted file mode 100644
index b3370b54..00000000
--- a/RyuzakiLib/types/input_stream/audio_piped.py
+++ /dev/null
@@ -1,43 +0,0 @@
-from typing import Dict, Optional
-
-from ntgcalls import InputMode
-
-from ...ffmpeg import build_command, check_stream
-from .audio_parameters import AudioParameters
-from .audio_stream import AudioStream
-from .smart_stream import SmartStream
-
-
-class AudioPiped(SmartStream):
- def __init__(
- self,
- path: str,
- audio_parameters: AudioParameters = AudioParameters(),
- headers: Optional[Dict[str, str]] = None,
- additional_ffmpeg_parameters: str = "",
- ):
- self._path = path
- self._audio_data = (
- additional_ffmpeg_parameters,
- self._path,
- audio_parameters,
- [],
- headers,
- )
- super().__init__(
- AudioStream(
- InputMode.Shell,
- " ".join(
- build_command(
- "ffmpeg",
- *self._audio_data,
- ),
- ),
- audio_parameters,
- ),
- )
-
- async def check_stream(self):
- await check_stream(
- *self._audio_data,
- )
diff --git a/RyuzakiLib/types/input_stream/audio_quality.py b/RyuzakiLib/types/input_stream/audio_quality.py
deleted file mode 100644
index d5db11a8..00000000
--- a/RyuzakiLib/types/input_stream/audio_quality.py
+++ /dev/null
@@ -1,8 +0,0 @@
-from enum import Enum
-
-
-class AudioQuality(Enum):
- STUDIO = (96000, 2)
- HIGH = (48000, 2)
- MEDIUM = (36000, 1)
- LOW = (24000, 1)
diff --git a/RyuzakiLib/types/input_stream/audio_stream.py b/RyuzakiLib/types/input_stream/audio_stream.py
deleted file mode 100644
index f95beb90..00000000
--- a/RyuzakiLib/types/input_stream/audio_stream.py
+++ /dev/null
@@ -1,16 +0,0 @@
-from ntgcalls import InputMode
-
-from ..py_object import PyObject
-from .audio_parameters import AudioParameters
-
-
-class AudioStream(PyObject):
- def __init__(
- self,
- input_mode: InputMode,
- path: str,
- parameters: AudioParameters = AudioParameters(),
- ):
- self.input_mode: InputMode = input_mode
- self.path: str = path
- self.parameters: AudioParameters = parameters
diff --git a/RyuzakiLib/types/input_stream/audio_video_piped.py b/RyuzakiLib/types/input_stream/audio_video_piped.py
deleted file mode 100644
index f811b89a..00000000
--- a/RyuzakiLib/types/input_stream/audio_video_piped.py
+++ /dev/null
@@ -1,72 +0,0 @@
-from typing import Dict, Optional
-
-from ntgcalls import InputMode
-
-from ...ffmpeg import build_command, check_stream
-from .audio_parameters import AudioParameters
-from .audio_stream import AudioStream
-from .smart_stream import SmartStream
-from .video_parameters import VideoParameters
-from .video_stream import VideoStream
-
-
-class AudioVideoPiped(SmartStream):
- def __init__(
- self,
- path: str,
- audio_parameters: AudioParameters = AudioParameters(),
- video_parameters: VideoParameters = VideoParameters(),
- headers: Optional[Dict[str, str]] = None,
- additional_ffmpeg_parameters: str = "",
- ):
- self._path = path
- self._audio_data = (
- additional_ffmpeg_parameters,
- self._path,
- audio_parameters,
- [],
- headers,
- )
- self._video_data = (
- additional_ffmpeg_parameters,
- self._path,
- video_parameters,
- [],
- headers,
- )
- super().__init__(
- AudioStream(
- InputMode.Shell,
- " ".join(
- build_command(
- "ffmpeg",
- *self._audio_data,
- ),
- ),
- audio_parameters,
- ),
- VideoStream(
- InputMode.Shell,
- " ".join(
- build_command(
- "ffmpeg",
- *self._video_data,
- ),
- ),
- video_parameters,
- ),
- )
-
- async def check_stream(self):
- await check_stream(
- *self._audio_data,
- )
- await check_stream(
- *self._video_data,
- )
- self.stream_video.path = " ".join(
- build_command(
- "ffmpeg",
- *self._video_data,
- ),
- )
diff --git a/RyuzakiLib/types/input_stream/capture_audio_device.py b/RyuzakiLib/types/input_stream/capture_audio_device.py
deleted file mode 100644
index 4926be5c..00000000
--- a/RyuzakiLib/types/input_stream/capture_audio_device.py
+++ /dev/null
@@ -1,31 +0,0 @@
-from ntgcalls import InputMode
-
-from ...ffmpeg import build_command
-from ...media_devices.device_info import DeviceInfo
-from .audio_parameters import AudioParameters
-from .audio_stream import AudioStream
-from .smart_stream import SmartStream
-
-
-class CaptureAudioDevice(SmartStream):
- def __init__(
- self,
- audio_info: DeviceInfo,
- audio_parameters: AudioParameters = AudioParameters(),
- ):
- self._audio_path: str = audio_info.build_ffmpeg_command()
- super().__init__(
- AudioStream(
- InputMode.Shell,
- " ".join(
- build_command(
- "ffmpeg",
- "",
- self._audio_path,
- audio_parameters,
- audio_info.ffmpeg_parameters,
- ),
- ),
- audio_parameters,
- ),
- )
diff --git a/RyuzakiLib/types/input_stream/capture_av_desktop.py b/RyuzakiLib/types/input_stream/capture_av_desktop.py
deleted file mode 100644
index 5e7191cc..00000000
--- a/RyuzakiLib/types/input_stream/capture_av_desktop.py
+++ /dev/null
@@ -1,64 +0,0 @@
-from typing import Dict, Optional
-
-from ntgcalls import InputMode
-
-from ...ffmpeg import build_command, check_stream
-from ...media_devices.screen_info import ScreenInfo
-from .audio_parameters import AudioParameters
-from .audio_stream import AudioStream
-from .smart_stream import SmartStream
-from .video_parameters import VideoParameters
-from .video_stream import VideoStream
-
-
-class CaptureAVDesktop(SmartStream):
- def __init__(
- self,
- audio_path: str,
- screen_info: ScreenInfo,
- headers: Optional[Dict[str, str]] = None,
- additional_ffmpeg_parameters: str = "",
- audio_parameters: AudioParameters = AudioParameters(),
- video_parameters: VideoParameters = VideoParameters(),
- ):
- self._audio_path = audio_path
- self._video_path = screen_info.build_ffmpeg_command(
- video_parameters.frame_rate,
- )
- self._audio_data = (
- additional_ffmpeg_parameters,
- self._audio_path,
- audio_parameters,
- [],
- headers,
- )
- super().__init__(
- AudioStream(
- InputMode.Shell,
- " ".join(
- build_command(
- "ffmpeg",
- *self._audio_data,
- ),
- ),
- audio_parameters,
- ),
- VideoStream(
- InputMode.Shell,
- " ".join(
- build_command(
- "ffmpeg",
- "",
- self._video_path,
- video_parameters,
- screen_info.ffmpeg_parameters,
- ),
- ),
- video_parameters,
- ),
- )
-
- async def check_stream(self):
- await check_stream(
- *self._audio_data,
- )
diff --git a/RyuzakiLib/types/input_stream/capture_av_device_desktop.py b/RyuzakiLib/types/input_stream/capture_av_device_desktop.py
deleted file mode 100644
index e464614b..00000000
--- a/RyuzakiLib/types/input_stream/capture_av_device_desktop.py
+++ /dev/null
@@ -1,55 +0,0 @@
-from ntgcalls import InputMode
-
-from ...ffmpeg import build_command
-from ...media_devices.device_info import DeviceInfo
-from ...media_devices.screen_info import ScreenInfo
-from .audio_parameters import AudioParameters
-from .audio_stream import AudioStream
-from .smart_stream import SmartStream
-from .video_parameters import VideoParameters
-from .video_stream import VideoStream
-
-
-class CaptureAVDeviceDesktop(SmartStream):
- def __init__(
- self,
- audio_info: DeviceInfo,
- screen_info: ScreenInfo,
- audio_parameters: AudioParameters = AudioParameters(),
- video_parameters: VideoParameters = VideoParameters(),
- ):
- self._audio_path = audio_info.build_ffmpeg_command()
- self._video_path = screen_info.build_ffmpeg_command(
- video_parameters.frame_rate,
- )
- audio_data = (
- "",
- self._audio_path,
- audio_parameters,
- audio_info.ffmpeg_parameters,
- )
- super().__init__(
- AudioStream(
- InputMode.Shell,
- " ".join(
- build_command(
- "ffmpeg",
- *audio_data,
- ),
- ),
- audio_parameters,
- ),
- VideoStream(
- InputMode.Shell,
- " ".join(
- build_command(
- "ffmpeg",
- "",
- self._video_path,
- video_parameters,
- screen_info.ffmpeg_parameters,
- ),
- ),
- video_parameters,
- ),
- )
diff --git a/RyuzakiLib/types/input_stream/capture_video_desktop.py b/RyuzakiLib/types/input_stream/capture_video_desktop.py
deleted file mode 100644
index 115c3d0b..00000000
--- a/RyuzakiLib/types/input_stream/capture_video_desktop.py
+++ /dev/null
@@ -1,32 +0,0 @@
-from ntgcalls import InputMode
-
-from ...ffmpeg import build_command
-from ...media_devices.screen_info import ScreenInfo
-from .smart_stream import SmartStream
-from .video_parameters import VideoParameters
-from .video_stream import VideoStream
-
-
-class CaptureVideoDesktop(SmartStream):
- def __init__(
- self,
- screen_info: ScreenInfo,
- video_parameters: VideoParameters = VideoParameters(),
- ):
- self._path = screen_info.build_ffmpeg_command(
- video_parameters.frame_rate,
- )
- super().__init__(
- stream_video=VideoStream(
- InputMode.Shell,
- " ".join(
- build_command(
- "ffmpeg",
- "",
- self._path,
- video_parameters,
- screen_info.ffmpeg_parameters,
- ),
- ),
- ),
- )
diff --git a/RyuzakiLib/types/input_stream/input_audio_stream.py b/RyuzakiLib/types/input_stream/input_audio_stream.py
deleted file mode 100644
index b628ec68..00000000
--- a/RyuzakiLib/types/input_stream/input_audio_stream.py
+++ /dev/null
@@ -1,20 +0,0 @@
-from deprecation import deprecated
-from ntgcalls import InputMode
-
-from .audio_parameters import AudioParameters
-from .audio_stream import AudioStream
-
-
-@deprecated(
- deprecated_in="1.0.0.dev1",
- details="Use pytgcalls.types.AudioStream instead.",
-)
-class InputAudioStream(AudioStream):
- def __init__(
- self,
- path: str,
- parameters: AudioParameters = AudioParameters(),
- header_enabled: bool = False,
- ):
- super().__init__(InputMode.File, path, parameters)
- self.header_enabled = header_enabled
diff --git a/RyuzakiLib/types/input_stream/input_stream.py b/RyuzakiLib/types/input_stream/input_stream.py
deleted file mode 100644
index a33416b7..00000000
--- a/RyuzakiLib/types/input_stream/input_stream.py
+++ /dev/null
@@ -1,22 +0,0 @@
-from typing import Optional
-
-from deprecation import deprecated
-
-from .input_audio_stream import InputAudioStream
-from .input_video_stream import InputVideoStream
-from .stream import Stream
-
-
-@deprecated(
- deprecated_in="1.0.0.dev1",
- details="This class is no longer supported." "Use pytgcalls.types.Stream instead.",
-)
-class InputStream(Stream):
- def __init__(
- self,
- stream_audio: Optional[InputAudioStream] = None,
- stream_video: Optional[InputVideoStream] = None,
- lip_sync: bool = False,
- ):
- super().__init__(stream_audio, stream_video)
- self.lip_sync = lip_sync
diff --git a/RyuzakiLib/types/input_stream/input_video_stream.py b/RyuzakiLib/types/input_stream/input_video_stream.py
deleted file mode 100644
index 77724512..00000000
--- a/RyuzakiLib/types/input_stream/input_video_stream.py
+++ /dev/null
@@ -1,20 +0,0 @@
-from deprecation import deprecated
-from ntgcalls import InputMode
-
-from .video_parameters import VideoParameters
-from .video_stream import VideoStream
-
-
-@deprecated(
- deprecated_in="1.0.0.dev1",
- details="Use pytgcalls.VideoStream instead.",
-)
-class InputVideoStream(VideoStream):
- def __init__(
- self,
- path: str,
- parameters: VideoParameters = VideoParameters(),
- header_enabled: bool = False,
- ):
- super().__init__(InputMode.File, path, parameters)
- self.header_enabled = header_enabled
diff --git a/RyuzakiLib/types/input_stream/quality/__init__.py b/RyuzakiLib/types/input_stream/quality/__init__.py
deleted file mode 100644
index ee789b21..00000000
--- a/RyuzakiLib/types/input_stream/quality/__init__.py
+++ /dev/null
@@ -1,15 +0,0 @@
-from .high_quality_audio import HighQualityAudio
-from .high_quality_video import HighQualityVideo
-from .low_quality_audio import LowQualityAudio
-from .low_quality_video import LowQualityVideo
-from .medium_quality_audio import MediumQualityAudio
-from .medium_quality_video import MediumQualityVideo
-
-__all__ = (
- "HighQualityAudio",
- "HighQualityVideo",
- "LowQualityAudio",
- "LowQualityVideo",
- "MediumQualityAudio",
- "MediumQualityVideo",
-)
diff --git a/RyuzakiLib/types/input_stream/quality/high_quality_audio.py b/RyuzakiLib/types/input_stream/quality/high_quality_audio.py
deleted file mode 100644
index 4bb2dcd1..00000000
--- a/RyuzakiLib/types/input_stream/quality/high_quality_audio.py
+++ /dev/null
@@ -1,14 +0,0 @@
-from deprecation import deprecated
-
-from ..audio_parameters import AudioParameters
-from ..audio_quality import AudioQuality
-
-
-@deprecated(
- deprecated_in="1.0.0.dev6",
- details="This class is no longer supported."
- "Use pytgcalls.types.AudioParameters.from_quality instead.",
-)
-class HighQualityAudio(AudioParameters):
- def __init__(self):
- super().__init__(*AudioQuality.HIGH.value)
diff --git a/RyuzakiLib/types/input_stream/quality/high_quality_video.py b/RyuzakiLib/types/input_stream/quality/high_quality_video.py
deleted file mode 100644
index 01495373..00000000
--- a/RyuzakiLib/types/input_stream/quality/high_quality_video.py
+++ /dev/null
@@ -1,14 +0,0 @@
-from deprecation import deprecated
-
-from ..video_parameters import VideoParameters
-from ..video_quality import VideoQuality
-
-
-@deprecated(
- deprecated_in="1.0.0.dev6",
- details="This class is no longer supported."
- "Use pytgcalls.types.VideoParameters.from_quality instead.",
-)
-class HighQualityVideo(VideoParameters):
- def __init__(self):
- super().__init__(*VideoQuality.HD_720p.value)
diff --git a/RyuzakiLib/types/input_stream/quality/low_quality_audio.py b/RyuzakiLib/types/input_stream/quality/low_quality_audio.py
deleted file mode 100644
index b8d7ac2d..00000000
--- a/RyuzakiLib/types/input_stream/quality/low_quality_audio.py
+++ /dev/null
@@ -1,14 +0,0 @@
-from deprecation import deprecated
-
-from ..audio_parameters import AudioParameters
-from ..audio_quality import AudioQuality
-
-
-@deprecated(
- deprecated_in="1.0.0.dev6",
- details="This class is no longer supported."
- "Use pytgcalls.types.AudioParameters.from_quality instead.",
-)
-class LowQualityAudio(AudioParameters):
- def __init__(self):
- super().__init__(*AudioQuality.LOW.value)
diff --git a/RyuzakiLib/types/input_stream/quality/low_quality_video.py b/RyuzakiLib/types/input_stream/quality/low_quality_video.py
deleted file mode 100644
index 17d56e44..00000000
--- a/RyuzakiLib/types/input_stream/quality/low_quality_video.py
+++ /dev/null
@@ -1,14 +0,0 @@
-from deprecation import deprecated
-
-from ..video_parameters import VideoParameters
-from ..video_quality import VideoQuality
-
-
-@deprecated(
- deprecated_in="1.0.0.dev6",
- details="This class is no longer supported."
- "Use pytgcalls.types.VideoParameters.from_quality instead.",
-)
-class LowQualityVideo(VideoParameters):
- def __init__(self):
- super().__init__(*VideoQuality.SD_480p.value)
diff --git a/RyuzakiLib/types/input_stream/quality/medium_quality_audio.py b/RyuzakiLib/types/input_stream/quality/medium_quality_audio.py
deleted file mode 100644
index 5f34cd6f..00000000
--- a/RyuzakiLib/types/input_stream/quality/medium_quality_audio.py
+++ /dev/null
@@ -1,14 +0,0 @@
-from deprecation import deprecated
-
-from ..audio_parameters import AudioParameters
-from ..audio_quality import AudioQuality
-
-
-@deprecated(
- deprecated_in="1.0.0.dev6",
- details="This class is no longer supported."
- "Use pytgcalls.types.AudioParameters.from_quality instead.",
-)
-class MediumQualityAudio(AudioParameters):
- def __init__(self):
- super().__init__(*AudioQuality.MEDIUM.value)
diff --git a/RyuzakiLib/types/input_stream/quality/medium_quality_video.py b/RyuzakiLib/types/input_stream/quality/medium_quality_video.py
deleted file mode 100644
index 717804c3..00000000
--- a/RyuzakiLib/types/input_stream/quality/medium_quality_video.py
+++ /dev/null
@@ -1,14 +0,0 @@
-from deprecation import deprecated
-
-from ..video_parameters import VideoParameters
-from ..video_quality import VideoQuality
-
-
-@deprecated(
- deprecated_in="1.0.0.dev6",
- details="This class is no longer supported."
- "Use pytgcalls.types.VideoParameters.from_quality instead.",
-)
-class MediumQualityVideo(VideoParameters):
- def __init__(self):
- super().__init__(*VideoQuality.SD_360p.value)
diff --git a/RyuzakiLib/types/input_stream/smart_stream.py b/RyuzakiLib/types/input_stream/smart_stream.py
deleted file mode 100644
index 1377f0ae..00000000
--- a/RyuzakiLib/types/input_stream/smart_stream.py
+++ /dev/null
@@ -1,27 +0,0 @@
-from typing import Dict, List, Optional, Tuple
-
-from .audio_parameters import AudioParameters
-from .stream import Stream
-from .video_parameters import VideoParameters
-
-
-class SmartStream(Stream):
- def __init(self):
- self._audio_data: Tuple[
- str,
- str,
- AudioParameters,
- List[str],
- Optional[Dict[str, str]],
- ]
- self._video_data: Tuple[
- str,
- str,
- VideoParameters,
- List[str],
- Optional[Dict[str, str]],
- ]
- pass
-
- async def check_stream(self):
- pass
diff --git a/RyuzakiLib/types/input_stream/stream.py b/RyuzakiLib/types/input_stream/stream.py
deleted file mode 100644
index 0352e774..00000000
--- a/RyuzakiLib/types/input_stream/stream.py
+++ /dev/null
@@ -1,15 +0,0 @@
-from typing import Optional
-
-from ..py_object import PyObject
-from .audio_stream import AudioStream
-from .video_stream import VideoStream
-
-
-class Stream(PyObject):
- def __init__(
- self,
- stream_audio: Optional[AudioStream] = None,
- stream_video: Optional[VideoStream] = None,
- ):
- self.stream_audio: Optional[AudioStream] = stream_audio
- self.stream_video: Optional[VideoStream] = stream_video
diff --git a/RyuzakiLib/types/input_stream/video_parameters.py b/RyuzakiLib/types/input_stream/video_parameters.py
deleted file mode 100644
index 3bcaa220..00000000
--- a/RyuzakiLib/types/input_stream/video_parameters.py
+++ /dev/null
@@ -1,22 +0,0 @@
-from ..py_object import PyObject
-from .video_quality import VideoQuality
-
-
-class VideoParameters(PyObject):
- def __init__(
- self,
- width: int = 640,
- height: int = 360,
- frame_rate: int = 20,
- ):
- max_w, max_h, max_fps = max(
- VideoQuality,
- key=lambda x: x.value[0],
- ).value
- self.width: int = min(width, max_w)
- self.height: int = min(height, max_h)
- self.frame_rate: int = min(frame_rate, max_fps)
-
- @staticmethod
- def from_quality(quality: VideoQuality):
- return VideoParameters(*quality.value)
diff --git a/RyuzakiLib/types/input_stream/video_piped.py b/RyuzakiLib/types/input_stream/video_piped.py
deleted file mode 100644
index 0d17007e..00000000
--- a/RyuzakiLib/types/input_stream/video_piped.py
+++ /dev/null
@@ -1,49 +0,0 @@
-from typing import Dict, Optional
-
-from ntgcalls import InputMode
-
-from ...ffmpeg import build_command, check_stream
-from .smart_stream import SmartStream
-from .video_parameters import VideoParameters
-from .video_stream import VideoStream
-
-
-class VideoPiped(SmartStream):
- def __init__(
- self,
- path: str,
- video_parameters: VideoParameters = VideoParameters(),
- headers: Optional[Dict[str, str]] = None,
- additional_ffmpeg_parameters: str = "",
- ):
- self._path = path
- self._video_data = (
- additional_ffmpeg_parameters,
- self._path,
- video_parameters,
- [],
- headers,
- )
- super().__init__(
- stream_video=VideoStream(
- InputMode.Shell,
- " ".join(
- build_command(
- "ffmpeg",
- *self._video_data,
- ),
- ),
- video_parameters,
- ),
- )
-
- async def check_stream(self):
- await check_stream(
- *self._video_data,
- )
- self.stream_video.path = " ".join(
- build_command(
- "ffmpeg",
- *self._video_data,
- ),
- )
diff --git a/RyuzakiLib/types/input_stream/video_quality.py b/RyuzakiLib/types/input_stream/video_quality.py
deleted file mode 100644
index 21bc01a1..00000000
--- a/RyuzakiLib/types/input_stream/video_quality.py
+++ /dev/null
@@ -1,10 +0,0 @@
-from enum import Enum
-
-
-class VideoQuality(Enum):
- UHD_4K = (3840, 2160, 60)
- QHD_2K = (2560, 1440, 60)
- FHD_1080p = (1920, 1080, 60)
- HD_720p = (1280, 720, 30)
- SD_480p = (854, 480, 30)
- SD_360p = (640, 360, 30)
diff --git a/RyuzakiLib/types/input_stream/video_stream.py b/RyuzakiLib/types/input_stream/video_stream.py
deleted file mode 100644
index fb62f3b0..00000000
--- a/RyuzakiLib/types/input_stream/video_stream.py
+++ /dev/null
@@ -1,15 +0,0 @@
-from ntgcalls import InputMode
-
-from .video_parameters import VideoParameters
-
-
-class VideoStream:
- def __init__(
- self,
- input_mode: InputMode,
- path: str,
- parameters: VideoParameters = VideoParameters(),
- ):
- self.input_mode: InputMode = input_mode
- self.path: str = path
- self.parameters: VideoParameters = parameters
From 86604127673dc716d593ef5a08f1716b01bcf27f Mon Sep 17 00:00:00 2001
From: Randy Dev <90479255+xtsea@users.noreply.github.com>
Date: Wed, 21 Aug 2024 17:41:01 +0700
Subject: [PATCH 081/152] _
---
RyuzakiLib/types/groups/__init__.py | 27 -------------------
RyuzakiLib/types/groups/already_joined.py | 9 -------
RyuzakiLib/types/groups/error_during_join.py | 9 -------
RyuzakiLib/types/groups/group_call.py | 18 -------------
.../types/groups/group_call_participant.py | 23 ----------------
.../groups/joined_group_call_participant.py | 12 ---------
RyuzakiLib/types/groups/joined_voice_chat.py | 11 --------
.../groups/left_group_call_participant.py | 12 ---------
RyuzakiLib/types/groups/left_voice_chat.py | 11 --------
RyuzakiLib/types/groups/muted_call.py | 9 -------
RyuzakiLib/types/groups/not_in_group_call.py | 9 -------
.../groups/updated_group_call_participant.py | 12 ---------
RyuzakiLib/types/groups/upgrade_needed.py | 9 -------
13 files changed, 171 deletions(-)
delete mode 100644 RyuzakiLib/types/groups/__init__.py
delete mode 100644 RyuzakiLib/types/groups/already_joined.py
delete mode 100644 RyuzakiLib/types/groups/error_during_join.py
delete mode 100644 RyuzakiLib/types/groups/group_call.py
delete mode 100644 RyuzakiLib/types/groups/group_call_participant.py
delete mode 100644 RyuzakiLib/types/groups/joined_group_call_participant.py
delete mode 100644 RyuzakiLib/types/groups/joined_voice_chat.py
delete mode 100644 RyuzakiLib/types/groups/left_group_call_participant.py
delete mode 100644 RyuzakiLib/types/groups/left_voice_chat.py
delete mode 100644 RyuzakiLib/types/groups/muted_call.py
delete mode 100644 RyuzakiLib/types/groups/not_in_group_call.py
delete mode 100644 RyuzakiLib/types/groups/updated_group_call_participant.py
delete mode 100644 RyuzakiLib/types/groups/upgrade_needed.py
diff --git a/RyuzakiLib/types/groups/__init__.py b/RyuzakiLib/types/groups/__init__.py
deleted file mode 100644
index 374fc761..00000000
--- a/RyuzakiLib/types/groups/__init__.py
+++ /dev/null
@@ -1,27 +0,0 @@
-from .already_joined import AlreadyJoined
-from .error_during_join import ErrorDuringJoin
-from .group_call import GroupCall
-from .group_call_participant import GroupCallParticipant
-from .joined_group_call_participant import JoinedGroupCallParticipant
-from .joined_voice_chat import JoinedVoiceChat
-from .left_group_call_participant import LeftGroupCallParticipant
-from .left_voice_chat import LeftVoiceChat
-from .muted_call import MutedCall
-from .not_in_group_call import NotInGroupCall
-from .updated_group_call_participant import UpdatedGroupCallParticipant
-from .upgrade_needed import UpgradeNeeded
-
-__all__ = (
- "AlreadyJoined",
- "ErrorDuringJoin",
- "GroupCall",
- "GroupCallParticipant",
- "JoinedGroupCallParticipant",
- "JoinedVoiceChat",
- "LeftGroupCallParticipant",
- "LeftVoiceChat",
- "NotInGroupCall",
- "UpdatedGroupCallParticipant",
- "UpgradeNeeded",
- "MutedCall",
-)
diff --git a/RyuzakiLib/types/groups/already_joined.py b/RyuzakiLib/types/groups/already_joined.py
deleted file mode 100644
index 4c48c134..00000000
--- a/RyuzakiLib/types/groups/already_joined.py
+++ /dev/null
@@ -1,9 +0,0 @@
-from ...types.update import Update
-
-
-class AlreadyJoined(Update):
- def __init__(
- self,
- chat_id: int,
- ):
- super().__init__(chat_id)
diff --git a/RyuzakiLib/types/groups/error_during_join.py b/RyuzakiLib/types/groups/error_during_join.py
deleted file mode 100644
index 4ac176c1..00000000
--- a/RyuzakiLib/types/groups/error_during_join.py
+++ /dev/null
@@ -1,9 +0,0 @@
-from ...types.update import Update
-
-
-class ErrorDuringJoin(Update):
- def __init__(
- self,
- chat_id: int,
- ):
- super().__init__(chat_id)
diff --git a/RyuzakiLib/types/groups/group_call.py b/RyuzakiLib/types/groups/group_call.py
deleted file mode 100644
index 142cead8..00000000
--- a/RyuzakiLib/types/groups/group_call.py
+++ /dev/null
@@ -1,18 +0,0 @@
-from RyuzakiLib.types.py_object import PyObject
-
-
-class GroupCall(PyObject):
- def __init__(
- self,
- chat_id: int,
- binary_status: int,
- ):
- self.chat_id: int = chat_id
- self.is_playing: bool = binary_status != 3
- self.status: str = "unknown"
- if binary_status == 1:
- self.status = "playing"
- elif binary_status == 2:
- self.status = "paused"
- elif binary_status == 3:
- self.status = "not_playing"
diff --git a/RyuzakiLib/types/groups/group_call_participant.py b/RyuzakiLib/types/groups/group_call_participant.py
deleted file mode 100644
index 1567b719..00000000
--- a/RyuzakiLib/types/groups/group_call_participant.py
+++ /dev/null
@@ -1,23 +0,0 @@
-from RyuzakiLib.types.py_object import PyObject
-
-
-class GroupCallParticipant(PyObject):
- def __init__(
- self,
- user_id: int,
- muted: bool,
- muted_by_admin: bool,
- video: bool,
- screen_sharing: bool,
- video_camera: bool,
- raised_hand: bool,
- volume: int,
- ):
- self.user_id: int = user_id
- self.muted: bool = muted
- self.muted_by_admin: bool = muted_by_admin
- self.video: bool = video
- self.screen_sharing: bool = screen_sharing
- self.video_camera: bool = video_camera
- self.raised_hand: bool = raised_hand
- self.volume: int = volume
diff --git a/RyuzakiLib/types/groups/joined_group_call_participant.py b/RyuzakiLib/types/groups/joined_group_call_participant.py
deleted file mode 100644
index 92e0bb46..00000000
--- a/RyuzakiLib/types/groups/joined_group_call_participant.py
+++ /dev/null
@@ -1,12 +0,0 @@
-from ...types.groups.group_call_participant import GroupCallParticipant
-from ...types.update import Update
-
-
-class JoinedGroupCallParticipant(Update):
- def __init__(
- self,
- chat_id: int,
- participant: GroupCallParticipant,
- ):
- super().__init__(chat_id)
- self.participant = participant
diff --git a/RyuzakiLib/types/groups/joined_voice_chat.py b/RyuzakiLib/types/groups/joined_voice_chat.py
deleted file mode 100644
index cf645650..00000000
--- a/RyuzakiLib/types/groups/joined_voice_chat.py
+++ /dev/null
@@ -1,11 +0,0 @@
-from typing import Union
-
-from ...types.update import Update
-
-
-class JoinedVoiceChat(Update):
- def __init__(
- self,
- chat_id: Union[int, str],
- ):
- super().__init__(chat_id)
diff --git a/RyuzakiLib/types/groups/left_group_call_participant.py b/RyuzakiLib/types/groups/left_group_call_participant.py
deleted file mode 100644
index 3fea5b60..00000000
--- a/RyuzakiLib/types/groups/left_group_call_participant.py
+++ /dev/null
@@ -1,12 +0,0 @@
-from ...types.groups.group_call_participant import GroupCallParticipant
-from ...types.update import Update
-
-
-class LeftGroupCallParticipant(Update):
- def __init__(
- self,
- chat_id: int,
- participant: GroupCallParticipant,
- ):
- super().__init__(chat_id)
- self.participant = participant
diff --git a/RyuzakiLib/types/groups/left_voice_chat.py b/RyuzakiLib/types/groups/left_voice_chat.py
deleted file mode 100644
index bd3f38d1..00000000
--- a/RyuzakiLib/types/groups/left_voice_chat.py
+++ /dev/null
@@ -1,11 +0,0 @@
-from typing import Union
-
-from ...types.update import Update
-
-
-class LeftVoiceChat(Update):
- def __init__(
- self,
- chat_id: Union[int, str],
- ):
- super().__init__(chat_id)
diff --git a/RyuzakiLib/types/groups/muted_call.py b/RyuzakiLib/types/groups/muted_call.py
deleted file mode 100644
index 74a2d34a..00000000
--- a/RyuzakiLib/types/groups/muted_call.py
+++ /dev/null
@@ -1,9 +0,0 @@
-from ...types.update import Update
-
-
-class MutedCall(Update):
- def __init__(
- self,
- chat_id: int,
- ):
- super().__init__(chat_id)
diff --git a/RyuzakiLib/types/groups/not_in_group_call.py b/RyuzakiLib/types/groups/not_in_group_call.py
deleted file mode 100644
index dd418096..00000000
--- a/RyuzakiLib/types/groups/not_in_group_call.py
+++ /dev/null
@@ -1,9 +0,0 @@
-from ...types.update import Update
-
-
-class NotInGroupCall(Update):
- def __init__(
- self,
- chat_id: int,
- ):
- super().__init__(chat_id)
diff --git a/RyuzakiLib/types/groups/updated_group_call_participant.py b/RyuzakiLib/types/groups/updated_group_call_participant.py
deleted file mode 100644
index 77b877be..00000000
--- a/RyuzakiLib/types/groups/updated_group_call_participant.py
+++ /dev/null
@@ -1,12 +0,0 @@
-from ...types.groups.group_call_participant import GroupCallParticipant
-from ...types.update import Update
-
-
-class UpdatedGroupCallParticipant(Update):
- def __init__(
- self,
- chat_id: int,
- participant: GroupCallParticipant,
- ):
- super().__init__(chat_id)
- self.participant = participant
diff --git a/RyuzakiLib/types/groups/upgrade_needed.py b/RyuzakiLib/types/groups/upgrade_needed.py
deleted file mode 100644
index 0e6546f5..00000000
--- a/RyuzakiLib/types/groups/upgrade_needed.py
+++ /dev/null
@@ -1,9 +0,0 @@
-from ...types.update import Update
-
-
-class UpgradeNeeded(Update):
- def __init__(
- self,
- chat_id: int,
- ):
- super().__init__(chat_id)
From 974fc380c313197494bcdd597432887d05e387dc Mon Sep 17 00:00:00 2001
From: Randy Dev <90479255+xtsea@users.noreply.github.com>
Date: Wed, 21 Aug 2024 17:41:16 +0700
Subject: [PATCH 082/152] _
---
RyuzakiLib/types/stream/__init__.py | 21 -------------------
RyuzakiLib/types/stream/changed_stream.py | 11 ----------
RyuzakiLib/types/stream/muted_stream.py | 9 --------
RyuzakiLib/types/stream/paused_stream.py | 11 ----------
RyuzakiLib/types/stream/resumed_stream.py | 11 ----------
RyuzakiLib/types/stream/stream_audio_ended.py | 9 --------
RyuzakiLib/types/stream/stream_deleted.py | 16 --------------
RyuzakiLib/types/stream/stream_time.py | 6 ------
RyuzakiLib/types/stream/stream_video_ended.py | 9 --------
RyuzakiLib/types/stream/unmuted_stream.py | 9 --------
10 files changed, 112 deletions(-)
delete mode 100644 RyuzakiLib/types/stream/__init__.py
delete mode 100644 RyuzakiLib/types/stream/changed_stream.py
delete mode 100644 RyuzakiLib/types/stream/muted_stream.py
delete mode 100644 RyuzakiLib/types/stream/paused_stream.py
delete mode 100644 RyuzakiLib/types/stream/resumed_stream.py
delete mode 100644 RyuzakiLib/types/stream/stream_audio_ended.py
delete mode 100644 RyuzakiLib/types/stream/stream_deleted.py
delete mode 100644 RyuzakiLib/types/stream/stream_time.py
delete mode 100644 RyuzakiLib/types/stream/stream_video_ended.py
delete mode 100644 RyuzakiLib/types/stream/unmuted_stream.py
diff --git a/RyuzakiLib/types/stream/__init__.py b/RyuzakiLib/types/stream/__init__.py
deleted file mode 100644
index 70ae24f0..00000000
--- a/RyuzakiLib/types/stream/__init__.py
+++ /dev/null
@@ -1,21 +0,0 @@
-from .changed_stream import ChangedStream
-from .muted_stream import MutedStream
-from .paused_stream import PausedStream
-from .resumed_stream import ResumedStream
-from .stream_audio_ended import StreamAudioEnded
-from .stream_deleted import StreamDeleted
-from .stream_time import StreamTime
-from .stream_video_ended import StreamVideoEnded
-from .unmuted_stream import UnMutedStream
-
-__all__ = (
- "ChangedStream",
- "MutedStream",
- "PausedStream",
- "ResumedStream",
- "StreamAudioEnded",
- "StreamDeleted",
- "StreamVideoEnded",
- "UnMutedStream",
- "StreamTime",
-)
diff --git a/RyuzakiLib/types/stream/changed_stream.py b/RyuzakiLib/types/stream/changed_stream.py
deleted file mode 100644
index 3c13df37..00000000
--- a/RyuzakiLib/types/stream/changed_stream.py
+++ /dev/null
@@ -1,11 +0,0 @@
-from typing import Union
-
-from ...types.update import Update
-
-
-class ChangedStream(Update):
- def __init__(
- self,
- chat_id: Union[int, str],
- ):
- super().__init__(chat_id)
diff --git a/RyuzakiLib/types/stream/muted_stream.py b/RyuzakiLib/types/stream/muted_stream.py
deleted file mode 100644
index 23531d80..00000000
--- a/RyuzakiLib/types/stream/muted_stream.py
+++ /dev/null
@@ -1,9 +0,0 @@
-from ...types.update import Update
-
-
-class MutedStream(Update):
- def __init__(
- self,
- chat_id: int,
- ):
- super().__init__(chat_id)
diff --git a/RyuzakiLib/types/stream/paused_stream.py b/RyuzakiLib/types/stream/paused_stream.py
deleted file mode 100644
index d0308bbc..00000000
--- a/RyuzakiLib/types/stream/paused_stream.py
+++ /dev/null
@@ -1,11 +0,0 @@
-from typing import Union
-
-from ...types.update import Update
-
-
-class PausedStream(Update):
- def __init__(
- self,
- chat_id: Union[int, str],
- ):
- super().__init__(chat_id)
diff --git a/RyuzakiLib/types/stream/resumed_stream.py b/RyuzakiLib/types/stream/resumed_stream.py
deleted file mode 100644
index d5b02b68..00000000
--- a/RyuzakiLib/types/stream/resumed_stream.py
+++ /dev/null
@@ -1,11 +0,0 @@
-from typing import Union
-
-from ...types.update import Update
-
-
-class ResumedStream(Update):
- def __init__(
- self,
- chat_id: Union[int, str],
- ):
- super().__init__(chat_id)
diff --git a/RyuzakiLib/types/stream/stream_audio_ended.py b/RyuzakiLib/types/stream/stream_audio_ended.py
deleted file mode 100644
index e5b1bd34..00000000
--- a/RyuzakiLib/types/stream/stream_audio_ended.py
+++ /dev/null
@@ -1,9 +0,0 @@
-from ...types.update import Update
-
-
-class StreamAudioEnded(Update):
- def __init__(
- self,
- chat_id: int,
- ):
- super().__init__(chat_id)
diff --git a/RyuzakiLib/types/stream/stream_deleted.py b/RyuzakiLib/types/stream/stream_deleted.py
deleted file mode 100644
index c63f563d..00000000
--- a/RyuzakiLib/types/stream/stream_deleted.py
+++ /dev/null
@@ -1,16 +0,0 @@
-from deprecation import deprecated
-
-from ...types.update import Update
-
-
-@deprecated(
- deprecated_in="1.0.0.dev1",
- removed_in="1.0.0.dev1",
- details="This method is no longer supported.",
-)
-class StreamDeleted(Update):
- def __init__(
- self,
- chat_id: int,
- ):
- super().__init__(chat_id)
diff --git a/RyuzakiLib/types/stream/stream_time.py b/RyuzakiLib/types/stream/stream_time.py
deleted file mode 100644
index 8614e934..00000000
--- a/RyuzakiLib/types/stream/stream_time.py
+++ /dev/null
@@ -1,6 +0,0 @@
-class StreamTime:
- def __init__(
- self,
- time: int,
- ):
- self.time = time
diff --git a/RyuzakiLib/types/stream/stream_video_ended.py b/RyuzakiLib/types/stream/stream_video_ended.py
deleted file mode 100644
index 07a4ab0d..00000000
--- a/RyuzakiLib/types/stream/stream_video_ended.py
+++ /dev/null
@@ -1,9 +0,0 @@
-from ...types.update import Update
-
-
-class StreamVideoEnded(Update):
- def __init__(
- self,
- chat_id: int,
- ):
- super().__init__(chat_id)
diff --git a/RyuzakiLib/types/stream/unmuted_stream.py b/RyuzakiLib/types/stream/unmuted_stream.py
deleted file mode 100644
index fea23763..00000000
--- a/RyuzakiLib/types/stream/unmuted_stream.py
+++ /dev/null
@@ -1,9 +0,0 @@
-from ...types.update import Update
-
-
-class UnMutedStream(Update):
- def __init__(
- self,
- chat_id: int,
- ):
- super().__init__(chat_id)
From cd9f8a50b96549f6b62a55363325dbf6a1d43fd8 Mon Sep 17 00:00:00 2001
From: Randy Dev <90479255+xtsea@users.noreply.github.com>
Date: Wed, 21 Aug 2024 17:42:40 +0700
Subject: [PATCH 083/152] _
---
RyuzakiLib/types/participant_list.py | 68 ----------------------------
1 file changed, 68 deletions(-)
delete mode 100644 RyuzakiLib/types/participant_list.py
diff --git a/RyuzakiLib/types/participant_list.py b/RyuzakiLib/types/participant_list.py
deleted file mode 100644
index e10f8a45..00000000
--- a/RyuzakiLib/types/participant_list.py
+++ /dev/null
@@ -1,68 +0,0 @@
-from typing import Dict
-
-from RyuzakiLib.types.groups import GroupCallParticipant
-from RyuzakiLib.types.list import List
-
-
-class ParticipantList:
- def __init__(
- self,
- input_id: int,
- ):
- self._list_participants: Dict[int, GroupCallParticipant] = {}
- self.last_mtproto_update: int = 0
- self.input_id: int = input_id
-
- def set_participant(
- self,
- user_id: int,
- muted: bool,
- muted_by_admin: bool,
- video: bool,
- screen_sharing: bool,
- video_camera: bool,
- raised_hand: bool,
- volume: int,
- ):
- participant = GroupCallParticipant(
- user_id,
- muted,
- muted_by_admin,
- video,
- screen_sharing,
- video_camera,
- raised_hand,
- volume,
- )
- self._list_participants[user_id] = participant
- return participant
-
- def remove_participant(
- self,
- user_id: int,
- muted: bool,
- muted_by_admin: bool,
- video: bool,
- screen_sharing: bool,
- video_camera: bool,
- raised_hand: bool,
- volume: int,
- ):
- participant = GroupCallParticipant(
- user_id,
- muted,
- muted_by_admin,
- video,
- screen_sharing,
- video_camera,
- raised_hand,
- volume,
- )
- if user_id in self._list_participants:
- del self._list_participants[user_id]
- return participant
-
- def get_participants(
- self,
- ):
- return List([self._list_participants[user_id] for user_id in self._list_participants])
From 24c86e012e5d2f4c794d6f0f5a928f24b1b5eeed Mon Sep 17 00:00:00 2001
From: Randy Dev <90479255+xtsea@users.noreply.github.com>
Date: Wed, 21 Aug 2024 17:44:03 +0700
Subject: [PATCH 084/152] _
---
RyuzakiLib/types/__init__.py | 96 ------------------------------------
1 file changed, 96 deletions(-)
diff --git a/RyuzakiLib/types/__init__.py b/RyuzakiLib/types/__init__.py
index 3cb53752..d3130738 100644
--- a/RyuzakiLib/types/__init__.py
+++ b/RyuzakiLib/types/__init__.py
@@ -3,101 +3,5 @@
from .anime import *
from .browsers import Browsers
from .cache import Cache
-from .groups import (
- AlreadyJoined,
- ErrorDuringJoin,
- GroupCall,
- GroupCallParticipant,
- JoinedGroupCallParticipant,
- JoinedVoiceChat,
- LeftGroupCallParticipant,
- LeftVoiceChat,
- MutedCall,
- NotInGroupCall,
- UpdatedGroupCallParticipant,
- UpgradeNeeded,
-)
-from .input_stream import (
- AudioImagePiped,
- AudioParameters,
- AudioPiped,
- AudioQuality,
- AudioVideoPiped,
- CaptureAudioDevice,
- CaptureAVDesktop,
- CaptureAVDeviceDesktop,
- CaptureVideoDesktop,
- InputAudioStream,
- InputStream,
- InputVideoStream,
- VideoParameters,
- VideoPiped,
- VideoQuality,
-)
-from .input_stream.quality import (
- HighQualityAudio,
- HighQualityVideo,
- LowQualityAudio,
- LowQualityVideo,
- MediumQualityAudio,
- MediumQualityVideo,
-)
-from .stream import (
- ChangedStream,
- MutedStream,
- PausedStream,
- ResumedStream,
- StreamAudioEnded,
- StreamDeleted,
- StreamVideoEnded,
- UnMutedStream,
-)
from .update import Update
from .waifu import *
-
-__all__ = [
- "AlreadyJoined",
- "AudioParameters",
- "AudioImagePiped",
- "AudioPiped",
- "AudioQuality",
- "AudioVideoPiped",
- "Browsers",
- "Cache",
- "ChangedStream",
- "ErrorDuringJoin",
- "GroupCall",
- "GroupCallParticipant",
- "HighQualityAudio",
- "HighQualityVideo",
- "InputAudioStream",
- "InputStream",
- "InputVideoStream",
- "JoinedGroupCallParticipant",
- "JoinedVoiceChat",
- "LowQualityAudio",
- "LowQualityVideo",
- "LeftGroupCallParticipant",
- "LeftVoiceChat",
- "MutedStream",
- "MediumQualityAudio",
- "MediumQualityVideo",
- "NotInGroupCall",
- "PausedStream",
- "ResumedStream",
- "StreamAudioEnded",
- "StreamDeleted",
- "StreamVideoEnded",
- "UnMutedStream",
- "UpdatedGroupCallParticipant",
- "Update",
- "CaptureAudioDevice",
- "CaptureAVDesktop",
- "CaptureAVDeviceDesktop",
- "CaptureVideoDesktop",
- "VideoParameters",
- "VideoPiped",
- "VideoQuality",
- "UpgradeNeeded",
- "MutedCall",
-]
From d1f388aaf2553f668389e7cc6bf251038392021b Mon Sep 17 00:00:00 2001
From: Randy Dev <90479255+xtsea@users.noreply.github.com>
Date: Wed, 21 Aug 2024 17:45:29 +0700
Subject: [PATCH 085/152] _
---
RyuzakiLib/scaffold.py | 38 --------------------------------------
1 file changed, 38 deletions(-)
delete mode 100644 RyuzakiLib/scaffold.py
diff --git a/RyuzakiLib/scaffold.py b/RyuzakiLib/scaffold.py
deleted file mode 100644
index 4773be3a..00000000
--- a/RyuzakiLib/scaffold.py
+++ /dev/null
@@ -1,38 +0,0 @@
-from typing import Dict, Union
-
-from ntgcalls import NTgCalls
-
-
-class Scaffold:
- _REQUIRED_PYROGRAM_VERSION = "1.2.20"
- _REQUIRED_TELETHON_VERSION = "1.24.0"
- _REQUIRED_HYDROGRAM_VERSION = "0.1.4"
-
- def __init__(self):
- self._app = None
- self._async_core = None
- self._is_running = None
- self._my_id = None
- self._env_checker = None
- self._cache_user_peer = None
- self._wait_result = None
- self._cache_local_peer = None
- self._on_event_update = None
- # noinspection PyTypeChecker
- self._binding: NTgCalls = None
- self._need_unmute: Dict[int, bool] = {}
-
- def _handle_mtproto(self):
- pass
-
- async def _init_mtproto(self):
- pass
-
- async def _resolve_chat_id(self, chat_id: Union[int, str]) -> int:
- pass
-
- async def get_call(self, chat_id: int):
- pass
-
- async def start(self):
- pass
From ba414a3a615f8a46157f605bab34d95e73e445b6 Mon Sep 17 00:00:00 2001
From: Randy Dev <90479255+xtsea@users.noreply.github.com>
Date: Wed, 21 Aug 2024 17:46:01 +0700
Subject: [PATCH 086/152] _
---
RyuzakiLib/__version__.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/RyuzakiLib/__version__.py b/RyuzakiLib/__version__.py
index b3f9ac7f..7f647d06 100644
--- a/RyuzakiLib/__version__.py
+++ b/RyuzakiLib/__version__.py
@@ -1 +1 @@
-__version__ = "1.2.4"
+__version__ = "1.2.7"
From eca37fa2aee92ef957f3bc54415b0930bf92748a Mon Sep 17 00:00:00 2001
From: Randy Dev <90479255+xtsea@users.noreply.github.com>
Date: Wed, 21 Aug 2024 18:07:16 +0700
Subject: [PATCH 087/152] _
---
RyuzakiLib/custom_api/__init__.py | 3 --
RyuzakiLib/custom_api/custom_api.py | 66 -----------------------------
RyuzakiLib/custom_api/nothing | 0
3 files changed, 69 deletions(-)
delete mode 100644 RyuzakiLib/custom_api/__init__.py
delete mode 100644 RyuzakiLib/custom_api/custom_api.py
delete mode 100644 RyuzakiLib/custom_api/nothing
diff --git a/RyuzakiLib/custom_api/__init__.py b/RyuzakiLib/custom_api/__init__.py
deleted file mode 100644
index 769d6fec..00000000
--- a/RyuzakiLib/custom_api/__init__.py
+++ /dev/null
@@ -1,3 +0,0 @@
-from .custom_api import CustomApi
-
-__all__ = ("CustomApi",)
diff --git a/RyuzakiLib/custom_api/custom_api.py b/RyuzakiLib/custom_api/custom_api.py
deleted file mode 100644
index a92c7b4b..00000000
--- a/RyuzakiLib/custom_api/custom_api.py
+++ /dev/null
@@ -1,66 +0,0 @@
-from json import JSONDecodeError
-from typing import Callable, Optional
-
-from aiohttp import web
-from aiohttp.web_request import BaseRequest
-
-from ..exceptions import TooManyCustomApiDecorators
-
-
-class CustomApi:
- def __init__(
- self,
- port: int = 24859,
- ):
- self._handler: Optional[Callable] = None
- self._app: web.Application = web.Application()
- self._runner: Optional[web.AppRunner] = None
- self._port = port
-
- def on_update_custom_api(self) -> Callable:
- if self._handler is None:
-
- def decorator(func: Callable) -> Callable:
- if self is not None:
- self._handler = func
- return func
-
- return decorator
- else:
- raise TooManyCustomApiDecorators()
-
- async def start(self):
- async def on_update(request: BaseRequest):
- try:
- params = await request.json()
- except JSONDecodeError:
- return web.json_response(
- {
- "result": "INVALID_JSON_FORMAT_REQUEST",
- }
- )
- if self._handler is not None:
- result = await self._handler(params)
- if isinstance(result, dict) or isinstance(result, list):
- return web.json_response(result)
- else:
- return web.json_response(
- {
- "result": "INVALID_RESPONSE",
- }
- )
- else:
- return web.json_response(
- {
- "result": "NO_CUSTOM_API_DECORATOR",
- }
- )
-
- self._app.router.add_post(
- "/",
- on_update,
- )
- runner = web.AppRunner(self._app)
- await runner.setup()
- site = web.TCPSite(runner, "localhost", self._port)
- await site.start()
diff --git a/RyuzakiLib/custom_api/nothing b/RyuzakiLib/custom_api/nothing
deleted file mode 100644
index e69de29b..00000000
From 36deaf7b0e43483d36ec7485d36be6f79c944a25 Mon Sep 17 00:00:00 2001
From: Randy Dev <90479255+xtsea@users.noreply.github.com>
Date: Wed, 21 Aug 2024 18:12:01 +0700
Subject: [PATCH 088/152] _
---
RyuzakiLib/__init__.py | 2 --
1 file changed, 2 deletions(-)
diff --git a/RyuzakiLib/__init__.py b/RyuzakiLib/__init__.py
index 7128f9b7..bc7e97f6 100644
--- a/RyuzakiLib/__init__.py
+++ b/RyuzakiLib/__init__.py
@@ -32,7 +32,6 @@
from .api.yohasakura import SearchAPI
from .bot import *
from .channels import *
-from .custom_api import CustomApi
from .decorator import *
from .extreme.carbon import Carbon
from .extreme.quotestk import QouteSticker
@@ -82,7 +81,6 @@ class AwesomeCoding(BaseModel):
__all__ = [
"__version__"
- "CustomApi",
"RendyDevChat",
"GeminiLatest",
"Github",
From 8f74a562ca47c9cc77b84eda58febc164d84a30a Mon Sep 17 00:00:00 2001
From: Randy Dev <90479255+xtsea@users.noreply.github.com>
Date: Fri, 23 Aug 2024 00:03:48 +0700
Subject: [PATCH 089/152] _
---
RyuzakiLib/api/reqs.py | 32 +++++++++++++++++++++++++++++++-
1 file changed, 31 insertions(+), 1 deletion(-)
diff --git a/RyuzakiLib/api/reqs.py b/RyuzakiLib/api/reqs.py
index 966857f8..d80489e0 100644
--- a/RyuzakiLib/api/reqs.py
+++ b/RyuzakiLib/api/reqs.py
@@ -1,6 +1,5 @@
import aiohttp
-
class AsyicXSearcher:
"""
A class to handle asynchronous HTTP requests using aiohttp.
@@ -62,3 +61,34 @@ async def search(
return await response.text()
else:
raise DependencyMissingError("Install 'aiohttp' to use this.")
+
+async def async_search(
+ url: str,
+ post: bool = False,
+ head: bool = False,
+ headers: dict = None,
+ evaluate=None,
+ object: bool = False,
+ re_json: bool = False,
+ re_content: bool = False,
+ *args,
+ **kwargs,
+):
+
+ if aiohttp:
+ async with aiohttp.ClientSession(headers=headers) as session:
+ method = (
+ session.head if head else (session.post if post else session.get)
+ )
+ async with method(url, *args, **kwargs) as response:
+ if evaluate:
+ return await evaluate(response)
+ if re_json:
+ return await response.json()
+ if re_content:
+ return await response.read()
+ if head or object:
+ return response
+ return await response.text()
+ else:
+ raise DependencyMissingError("Install 'aiohttp' to use this.")
From b33267100bc84e2c8ef07971d3abf0bad13b5c13 Mon Sep 17 00:00:00 2001
From: Randy Dev <90479255+xtsea@users.noreply.github.com>
Date: Fri, 23 Aug 2024 00:06:38 +0700
Subject: [PATCH 090/152] _
---
RyuzakiLib/__init__.py | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/RyuzakiLib/__init__.py b/RyuzakiLib/__init__.py
index bc7e97f6..55efc1c6 100644
--- a/RyuzakiLib/__init__.py
+++ b/RyuzakiLib/__init__.py
@@ -28,7 +28,7 @@
from .api.fullstack import FullStackDev
from .api.jiosaavn import Jiosaavn
from .api.private import PrivateApiUrl
-from .api.reqs import AsyicXSearcher
+from .api.reqs import AsyicXSearcher, async_search
from .api.yohasakura import SearchAPI
from .bot import *
from .channels import *
@@ -113,4 +113,5 @@ class AwesomeCoding(BaseModel):
"FluxAi",
"CloudFlare",
"PyrogramMod",
+ "async_search",
]
From e2bf25150b21f5e25a279c32f75f964e65ec34c5 Mon Sep 17 00:00:00 2001
From: Randy Dev <90479255+xtsea@users.noreply.github.com>
Date: Fri, 23 Aug 2024 00:20:41 +0700
Subject: [PATCH 091/152] Create xnxx.py
---
RyuzakiLib/hackertools/xnxx.py | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
create mode 100644 RyuzakiLib/hackertools/xnxx.py
diff --git a/RyuzakiLib/hackertools/xnxx.py b/RyuzakiLib/hackertools/xnxx.py
new file mode 100644
index 00000000..b2055227
--- /dev/null
+++ b/RyuzakiLib/hackertools/xnxx.py
@@ -0,0 +1,23 @@
+from RyuzakiLib.api.reqs import async_search
+import wget
+
+class PornoHub:
+ def __init__(self):
+ pass
+
+ async def x_search(self, query=None):
+ url = f"https://randydev-ryuzaki-api.hf.space/akeno/xnxxsearch?query={query}"
+ res = await async_search(url, re_json=True)
+ results = res["randydev"]["results"]
+ y = res["randydev"]["results"][0]
+ link = y["link"]
+ title = y["title"]
+ return [link, title, results]
+
+ async def x_download(self, query=None):
+ schub = await self.x_search(query=query)
+ url_dl = f"https://randydev-ryuzaki-api.hf.space/akeno/xnxx-dl?link={schub[0]}"
+ response = await async_search(url_dl, re_json=True)
+ file_path = wget.download(response["randydev"]["results"]["url"])
+ thumb = wget.download(response["randydev"]["results"]["thumb"])
+ return file_path, thumb
From 86220cda3564c1157222976b8005b047a81c9427 Mon Sep 17 00:00:00 2001
From: Randy Dev <90479255+xtsea@users.noreply.github.com>
Date: Fri, 23 Aug 2024 00:21:27 +0700
Subject: [PATCH 092/152] _
---
RyuzakiLib/hackertools/__init__.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/RyuzakiLib/hackertools/__init__.py b/RyuzakiLib/hackertools/__init__.py
index c9465b46..18c13ccd 100644
--- a/RyuzakiLib/hackertools/__init__.py
+++ b/RyuzakiLib/hackertools/__init__.py
@@ -13,3 +13,4 @@
from .reverse import *
from .rmbg import *
from .tiktok import *
+from .xnxx import *
From 48ab1d0162f14099b321d018b98edd22c8ff4dc0 Mon Sep 17 00:00:00 2001
From: Randy Dev <90479255+xtsea@users.noreply.github.com>
Date: Fri, 23 Aug 2024 00:23:57 +0700
Subject: [PATCH 093/152] _
---
RyuzakiLib/__init__.py | 2 ++
1 file changed, 2 insertions(+)
diff --git a/RyuzakiLib/__init__.py b/RyuzakiLib/__init__.py
index 55efc1c6..9f473b29 100644
--- a/RyuzakiLib/__init__.py
+++ b/RyuzakiLib/__init__.py
@@ -52,6 +52,7 @@
from .hackertools.reverse import GoogleReverseImage
from .hackertools.rmbg import Background
from .hackertools.tiktok import Tiktok
+from .hackertools.xnxx import PornoHub
from .mental import *
from .profile.user import Clone
from .pushdb import *
@@ -114,4 +115,5 @@ class AwesomeCoding(BaseModel):
"CloudFlare",
"PyrogramMod",
"async_search",
+ "PornoHub",
]
From 8a32dbe1d65ca4fecee702c18d64e9730e07af68 Mon Sep 17 00:00:00 2001
From: Randy Dev <90479255+xtsea@users.noreply.github.com>
Date: Fri, 23 Aug 2024 01:18:29 +0700
Subject: [PATCH 094/152] _
---
requirements.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/requirements.txt b/requirements.txt
index 7576bfd3..4795d027 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -29,3 +29,4 @@ gradio
huggingface-hub>=0.23.2
motor
nest-asyncio
+wget
From 26b5049802eb747680062dd57622c2dd2ddae953 Mon Sep 17 00:00:00 2001
From: Randy Dev <90479255+xtsea@users.noreply.github.com>
Date: Fri, 23 Aug 2024 01:19:25 +0700
Subject: [PATCH 095/152] Update setup.py
---
setup.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/setup.py b/setup.py
index 310e79db..1073555b 100644
--- a/setup.py
+++ b/setup.py
@@ -55,6 +55,7 @@ def read(fname, version=False):
"gradio",
"huggingface-hub>=0.23.2",
"motor",
+ "wget",
],
classifiers=[
"Programming Language :: Python :: 3",
From 9b366a724dc4fac7132e56a51c1280806643b4b5 Mon Sep 17 00:00:00 2001
From: "pre-commit-ci[bot]"
<66853113+pre-commit-ci[bot]@users.noreply.github.com>
Date: Thu, 22 Aug 2024 18:35:36 +0000
Subject: [PATCH 096/152] [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
---
RyuzakiLib/api/reqs.py | 3 ++-
RyuzakiLib/hackertools/xnxx.py | 4 +++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/RyuzakiLib/api/reqs.py b/RyuzakiLib/api/reqs.py
index d80489e0..18e49970 100644
--- a/RyuzakiLib/api/reqs.py
+++ b/RyuzakiLib/api/reqs.py
@@ -1,5 +1,6 @@
import aiohttp
+
class AsyicXSearcher:
"""
A class to handle asynchronous HTTP requests using aiohttp.
@@ -74,7 +75,7 @@ async def async_search(
*args,
**kwargs,
):
-
+
if aiohttp:
async with aiohttp.ClientSession(headers=headers) as session:
method = (
diff --git a/RyuzakiLib/hackertools/xnxx.py b/RyuzakiLib/hackertools/xnxx.py
index b2055227..fe1af798 100644
--- a/RyuzakiLib/hackertools/xnxx.py
+++ b/RyuzakiLib/hackertools/xnxx.py
@@ -1,6 +1,8 @@
-from RyuzakiLib.api.reqs import async_search
import wget
+from RyuzakiLib.api.reqs import async_search
+
+
class PornoHub:
def __init__(self):
pass
From e80d4cf2a062ffdb5980ca84fd4bd8bb4698c1f3 Mon Sep 17 00:00:00 2001
From: Randy Dev <90479255+xtsea@users.noreply.github.com>
Date: Fri, 23 Aug 2024 07:17:49 +0700
Subject: [PATCH 097/152] _
---
RyuzakiLib/hackertools/xnxx.py | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/RyuzakiLib/hackertools/xnxx.py b/RyuzakiLib/hackertools/xnxx.py
index fe1af798..e7849a56 100644
--- a/RyuzakiLib/hackertools/xnxx.py
+++ b/RyuzakiLib/hackertools/xnxx.py
@@ -16,10 +16,17 @@ async def x_search(self, query=None):
title = y["title"]
return [link, title, results]
- async def x_download(self, query=None):
- schub = await self.x_search(query=query)
- url_dl = f"https://randydev-ryuzaki-api.hf.space/akeno/xnxx-dl?link={schub[0]}"
- response = await async_search(url_dl, re_json=True)
- file_path = wget.download(response["randydev"]["results"]["url"])
- thumb = wget.download(response["randydev"]["results"]["thumb"])
- return file_path, thumb
+ async def x_download(self, query=None, url=None, is_stream=False):
+ if is_stream and url:
+ url_ = f"https://randydev-ryuzaki-api.hf.space/akeno/xnxx-dl?link={url}"
+ response = await async_search(url_, re_json=True)
+ file_path = wget.download(response["randydev"]["results"]["url"])
+ thumb = wget.download(response["randydev"]["results"]["thumb"])
+ return file_path, thumb
+ else:
+ schub = await self.x_search(query=query)
+ url_dl = f"https://randydev-ryuzaki-api.hf.space/akeno/xnxx-dl?link={schub[0]}"
+ response = await async_search(url_dl, re_json=True)
+ file_path = wget.download(response["randydev"]["results"]["url"])
+ thumb = wget.download(response["randydev"]["results"]["thumb"])
+ return file_path, thumb
From d63ff426c9c98f5acc7632bec09c59aa02014706 Mon Sep 17 00:00:00 2001
From: Randy Dev <90479255+xtsea@users.noreply.github.com>
Date: Fri, 23 Aug 2024 15:12:48 +0700
Subject: [PATCH 098/152] _
---
RyuzakiLib/hackertools/xnxx.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/RyuzakiLib/hackertools/xnxx.py b/RyuzakiLib/hackertools/xnxx.py
index e7849a56..496289c2 100644
--- a/RyuzakiLib/hackertools/xnxx.py
+++ b/RyuzakiLib/hackertools/xnxx.py
@@ -22,11 +22,13 @@ async def x_download(self, query=None, url=None, is_stream=False):
response = await async_search(url_, re_json=True)
file_path = wget.download(response["randydev"]["results"]["url"])
thumb = wget.download(response["randydev"]["results"]["thumb"])
- return file_path, thumb
+ title = response["randydev"]["results"].get("title", "Powered by Randydev")
+ return file_path, thumb, title
else:
schub = await self.x_search(query=query)
url_dl = f"https://randydev-ryuzaki-api.hf.space/akeno/xnxx-dl?link={schub[0]}"
response = await async_search(url_dl, re_json=True)
file_path = wget.download(response["randydev"]["results"]["url"])
thumb = wget.download(response["randydev"]["results"]["thumb"])
- return file_path, thumb
+ title = response["randydev"]["results"].get("title", "Powered by Randydev")
+ return file_path, thumb, title
From 9a6a82fcdb20071e1f54820cbb8711ebffdde5e7 Mon Sep 17 00:00:00 2001
From: Randy Dev <90479255+xtsea@users.noreply.github.com>
Date: Sat, 24 Aug 2024 14:54:02 +0700
Subject: [PATCH 099/152] _
---
index.html | 4 ----
1 file changed, 4 deletions(-)
diff --git a/index.html b/index.html
index fc7423c4..a8cc36c8 100644
--- a/index.html
+++ b/index.html
@@ -20,9 +20,5 @@
-