From 519eb018f10aa0475f21b22d7c14b6f26829816e Mon Sep 17 00:00:00 2001 From: Santiago Ramirez Date: Tue, 10 Oct 2023 03:35:36 +0000 Subject: [PATCH] Fixed bugs --- Makefile | 2 +- bot/helpers/queues.py | 4 ++-- bot/plugins/commands/leave.py | 2 +- bot/plugins/commands/play_book.py | 2 +- bot/plugins/commands/play_song.py | 6 +++--- bot/plugins/commands/play_video.py | 6 +++--- bot/plugins/commands/streaming.py | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index f715a3f..ad2fb34 100755 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ docker-down: docker-compose down --volumes install: - pip install --no-deps -U pytgcalls==3.0.0.dev24 tgcalls==3.0.0.dev6 + pip install --no-deps pytgcalls==3.0.0.dev24 tgcalls==3.0.0.dev6 pip install -r requirements-dev.txt pip install -r requirements.txt diff --git a/bot/helpers/queues.py b/bot/helpers/queues.py index 5664147..f9e4183 100644 --- a/bot/helpers/queues.py +++ b/bot/helpers/queues.py @@ -25,8 +25,8 @@ def add_or_create_queue( ] values: bytes = pickle.dumps(kw) queue: dict = r.hgetall("queues") - giq: list = pickle.loads(queue[group_id]) - if group_id in queue: + if group_id in queue: + giq: list = pickle.loads(queue[group_id]) giq.append(values) hset = r.hset("queues", group_id, pickle.dumps(giq)) if hset == 0: diff --git a/bot/plugins/commands/leave.py b/bot/plugins/commands/leave.py index 691b272..217d06b 100755 --- a/bot/plugins/commands/leave.py +++ b/bot/plugins/commands/leave.py @@ -12,7 +12,7 @@ async def _(client: Client, message: Message): try: if VOICE_CHATS.get(message.chat.id) is None: - raise Exception("No streams") + raise Exception("no streams") await VOICE_CHATS[message.chat.id].leave_current_group_call() VOICE_CHATS.pop(message.chat.id) remove_queue(str(message.chat.id)) diff --git a/bot/plugins/commands/play_book.py b/bot/plugins/commands/play_book.py index 7f7ef53..002211b 100755 --- a/bot/plugins/commands/play_book.py +++ b/bot/plugins/commands/play_book.py @@ -91,7 +91,7 @@ async def _(client: Client, message: Message): await on_call.start(message.chat.id) VOICE_CHATS[message.chat.id] = on_call await sleep(2) - await on_call.start_audio(audiobook, repeat=False) + await VOICE_CHATS[message.chat.id].start_audio(audiobook, repeat=False) if "epub" in file_type: epub = epublib.read_epub(f) for item in epub.get_items_of_type(ITEM_IMAGE): diff --git a/bot/plugins/commands/play_song.py b/bot/plugins/commands/play_song.py index 547f803..5e9946a 100755 --- a/bot/plugins/commands/play_song.py +++ b/bot/plugins/commands/play_song.py @@ -79,7 +79,7 @@ async def _(client: Client, message: Message): name = search[0] ref = search[1] duration = search[2] - fmt = "best[height<=?720][width<=?1280]" + fmt = "bestaudio/best" _, url = await ytdl(fmt, ref) if search == 0: return await msg.edit( @@ -115,7 +115,7 @@ async def _(client: Client, message: Message): await on_call.start(message.chat.id) VOICE_CHATS[message.chat.id] = on_call await sleep(2) - await on_call.start_audio(url, repeat=False) + await VOICE_CHATS[message.chat.id].start_audio(url, repeat=False) await msg.edit( f"**__Started Streaming__**\n\n **Title**: [{name}]({url})\n **Duration:** {duration} **Minutes\n Requested by:** [{data['first_name']}]({data['mention']})", # file=thumb, @@ -186,7 +186,7 @@ async def _(client: Client, message: Message): await on_call.start(message.chat.id) VOICE_CHATS[message.chat.id] = on_call await sleep(2) - await on_call.start_audio(media, repeat=False) + await VOICE_CHATS[message.chat.id].start_audio(media, repeat=False) await msg.delete() await kreacher.send_photo( message.chat.id, diff --git a/bot/plugins/commands/play_video.py b/bot/plugins/commands/play_video.py index 4d59ca7..0de8bc0 100755 --- a/bot/plugins/commands/play_video.py +++ b/bot/plugins/commands/play_video.py @@ -74,7 +74,7 @@ async def _(client: Client, message: Message): ) await msg.edit("🔄 **__Starting live video stream...__**") await sleep(2) - await on_call.start_video( + await VOICE_CHATS[message.chat.id].start_video( query, enable_experimental_lip_sync=True, repeat=False, @@ -145,7 +145,7 @@ async def _(client: Client, message: Message): await on_call.start(message.chat.id) VOICE_CHATS[message.chat.id] = on_call await sleep(2) - await on_call.start_video( + await VOICE_CHATS[message.chat.id].start_video( url, enable_experimental_lip_sync=True, repeat=False, @@ -208,7 +208,7 @@ async def _(client: Client, message: Message): await on_call.start(message.chat.id) VOICE_CHATS[message.chat.id] = on_call await sleep(2) - await on_call.start_video( + await VOICE_CHATS[message.chat.id].start_video( media, enable_experimental_lip_sync=True, repeat=False ) # await msg.delete() diff --git a/bot/plugins/commands/streaming.py b/bot/plugins/commands/streaming.py index 58283a3..b250c6d 100755 --- a/bot/plugins/commands/streaming.py +++ b/bot/plugins/commands/streaming.py @@ -97,7 +97,7 @@ async def _(client: Client, message: Message): await on_call.start(message.chat.id) VOICE_CHATS[message.chat.id] = on_call await sleep(2) - await on_call.start_video( + await VOICE_CHATS[message.chat.id].start_video( video, enable_experimental_lip_sync=True, repeat=False,