From 56b0eba90d88d8a36c4914d4fb196bfa58fbd705 Mon Sep 17 00:00:00 2001 From: Santiago Ramirez Date: Thu, 12 Oct 2023 06:57:25 +0000 Subject: [PATCH] chore: small changes --- bot/__init__.py | 6 +++--- bot/__main__.py | 6 +++--- bot/commands/play_video.py | 5 ++--- bot/commands/streaming.py | 13 ++++++------- 4 files changed, 14 insertions(+), 16 deletions(-) diff --git a/bot/__init__.py b/bot/__init__.py index 88045ed..80a1c82 100755 --- a/bot/__init__.py +++ b/bot/__init__.py @@ -61,7 +61,7 @@ bot_token=_BOT_TOKEN, ) -assistant = Client( +userbot = Client( "userbot.assistant", api_id=_API_ID, api_hash=_API_HASH, @@ -87,13 +87,13 @@ # ------------------------------------------------------------------------------ tgcalls = GroupCallFactory( - assistant, GroupCallFactory.MTPROTO_CLIENT_TYPE.PYROGRAM + userbot, GroupCallFactory.MTPROTO_CLIENT_TYPE.PYROGRAM ).get_group_call() # ------------------------------------------------------------------------------ kreacher.start() -assistant.start() +userbot.start() driver = get_driver() START_TIME = datetime.utcnow() diff --git a/bot/__main__.py b/bot/__main__.py index 1826335..7fe2631 100755 --- a/bot/__main__.py +++ b/bot/__main__.py @@ -4,7 +4,7 @@ from pyrogram.types import BotCommand from bot.setup import setup_plugins -from bot import kreacher, assistant +from bot import kreacher, userbot ay = asyncio.get_event_loop() @@ -18,7 +18,7 @@ async def start_bot(): BotCommand("help", "How to use this one"), BotCommand("leave", "Leave the voice chat"), BotCommand("ping", "Check server latency"), - BotCommand("play_book", "Play pdf file as audiobook"), + BotCommand("play_book", "Play pdf or epub file as audiobook"), BotCommand("play_song", "Play audio in voice chat"), BotCommand("play_video", "Play video in voice chat"), BotCommand("speedtest", "Run server speed test"), @@ -35,5 +35,5 @@ async def start_bot(): idle() except KeyboardInterrupt: kreacher.disconnect() - assistant.disconnect() + userbot.disconnect() print(f'{colored("[INFO]:", "blue")} CLIENTS DISCONNECTED') diff --git a/bot/commands/play_video.py b/bot/commands/play_video.py index 787df56..dd22e63 100755 --- a/bot/commands/play_video.py +++ b/bot/commands/play_video.py @@ -11,7 +11,7 @@ from bot.helpers.progress import progress from bot.helpers.yt import ytdl, ytsearch from bot.helpers.user_info import user_info -from bot import assistant, kreacher, tgcalls, VOICE_CHATS +from bot import kreacher, tgcalls, userbot, VOICE_CHATS from bot.helpers.queues import ( add_or_create_queue, get_queues, @@ -201,7 +201,7 @@ async def _(client: Client, message: Message): type_of="video_media", ) await _message.edit("💾 **__Downloading...__**") - media = await assistant.download_media( + media = await userbot.download_media( message.reply_to_message, file_name=file_name, progress=progress, @@ -216,7 +216,6 @@ async def _(client: Client, message: Message): media, enable_experimental_lip_sync=True, repeat=False, - with_audio=True, ) # await _message.delete() await _message.edit( diff --git a/bot/commands/streaming.py b/bot/commands/streaming.py index 32ecc5a..0e7151f 100755 --- a/bot/commands/streaming.py +++ b/bot/commands/streaming.py @@ -8,7 +8,7 @@ from pyrogram.enums import MessagesFilter from bot.helpers.progress import progress from bot.scrapers.images import ImageScraper -from bot import assistant, kreacher, tgcalls, VOICE_CHATS +from bot import userbot, kreacher, tgcalls, VOICE_CHATS from bot.decorators.sides import only_groups_or_channels from bot.helpers.queues import ( remove_queue, @@ -27,9 +27,9 @@ async def _(client: Client, message: Message): _message = await message.reply("🔎 **__Searching...__**") await sleep(2) search = message.text.split(maxsplit=1)[1] - series_channel = await assistant.get_chat(config.ES_SERIES_CHANNEL) - movies_channel = await assistant.get_chat(config.ES_MOVIES_CHANNEL) - async for serie in assistant.search_messages( + series_channel = await userbot.get_chat(config.ES_SERIES_CHANNEL) + movies_channel = await userbot.get_chat(config.ES_MOVIES_CHANNEL) + async for serie in userbot.search_messages( chat_id=series_channel.id, query=search, limit=1000, @@ -42,7 +42,7 @@ async def _(client: Client, message: Message): "file_id": serie.video.file_id, } ) - async for movie in assistant.search_messages( + async for movie in userbot.search_messages( chat_id=movies_channel.id, query=search, limit=1000, @@ -74,7 +74,7 @@ async def _(client: Client, message: Message): else message.reply_to_message.file.mime_type.split("/", 1)[1] ) file_name = f"/tmp/{str(uuid.uuid4())}.{mime_type}" - video = await assistant.download_media( + video = await userbot.download_media( media["file_id"], file_name=file_name, progress=progress, @@ -89,7 +89,6 @@ async def _(client: Client, message: Message): video, enable_experimental_lip_sync=True, repeat=False, - with_audio=True, ) await _message.delete() await client.send_photo(