Skip to content

Commit

Permalink
Update callbacks.py and play_video.py
Browse files Browse the repository at this point in the history
  • Loading branch information
SantiiRepair committed Aug 5, 2023
1 parent ce0687e commit 3aae553
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
10 changes: 3 additions & 7 deletions tlg_bot/kreacher/plugins/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
3 changes: 2 additions & 1 deletion tlg_bot/kreacher/plugins/play_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ async def play_video(event):
VOICE_CHATS[chat.id] = ins
except Exception as e:
await msg.edit(f"<i>Oops master, something wrong has happened. \n\nError:</i> <code>{e}</code>", 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("🔄 <i>Starting YouTube Video Stream...</i>", parse_mode="HTML")
try:
Expand Down

0 comments on commit 3aae553

Please sign in to comment.