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: