From 3aae5538c2ed8d309572c19ee7774e842bf9009b Mon Sep 17 00:00:00 2001
From: Santiago Ramirez <94815926+SantiiRepair@users.noreply.github.com>
Date: Sat, 5 Aug 2023 18:11:08 +0000
Subject: [PATCH] Update callbacks.py and play_video.py
---
tlg_bot/kreacher/plugins/callbacks.py | 10 +++-------
tlg_bot/kreacher/plugins/play_video.py | 3 ++-
2 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/tlg_bot/kreacher/plugins/callbacks.py b/tlg_bot/kreacher/plugins/callbacks.py
index 11f8b6b..f59928e 100644
--- a/tlg_bot/kreacher/plugins/callbacks.py
+++ b/tlg_bot/kreacher/plugins/callbacks.py
@@ -11,20 +11,16 @@ async def _(event):
@kreacher.on(events.callbackquery.CallbackQuery(data="pause_callback"))
async def _(event):
chat = await event.get_chat()
- proto = VOICE_CHATS[chat.id]
- await proto.set_pause(True)
+ await VOICE_CHATS[chat.id].set_pause(True)
@kreacher.on(events.callbackquery.CallbackQuery(data="resume_callback"))
async def _(event):
chat = await event.get_chat()
- proto = VOICE_CHATS[chat.id]
- await proto.set_pause(False)
+ await VOICE_CHATS[chat.id].set_pause(False)
@kreacher.on(events.callbackquery.CallbackQuery(data="end_callback"))
async def _(event):
chat = await event.get_chat()
- proto = VOICE_CHATS[chat.id]
- await proto.stop_media()
- VOICE_CHATS.pop(chat.id)
+ await VOICE_CHATS[chat.id].stop_media()
diff --git a/tlg_bot/kreacher/plugins/play_video.py b/tlg_bot/kreacher/plugins/play_video.py
index 29a0bc3..07ff31d 100644
--- a/tlg_bot/kreacher/plugins/play_video.py
+++ b/tlg_bot/kreacher/plugins/play_video.py
@@ -39,8 +39,9 @@ async def play_video(event):
VOICE_CHATS[chat.id] = ins
except Exception as e:
await msg.edit(f"Oops master, something wrong has happened. \n\nError: {e}
", parse_mode="HTML")
+ await VOICE_CHATS[chat.id].stop()
VOICE_CHATS.pop(chat.id)
- return await VOICE_CHATS[chat.id].stop()
+ return await sleep(3)
if match:
await msg.edit("🔄 Starting YouTube Video Stream...", parse_mode="HTML")
try: