Skip to content

Commit

Permalink
Update play_video.py
Browse files Browse the repository at this point in the history
  • Loading branch information
SantiiRepair committed Aug 5, 2023
1 parent 4c688d8 commit b300a22
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions tlg_bot/kreacher/plugins/play_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ async def play_video(event):
return await msg.edit("❗ __Send Me An Live Stream Link / YouTube Video Link / Reply To An Video To Start Video Streaming!__")
regex = r"^(https?\:\/\/)?(www\.youtube\.com|youtu\.?be)\/.+"
match = re.match(regex, url)
if VOICE_CHATS[chat.id] is None:
if chat.id not in VOICE_CHATS[chat.id]:
await msg.edit("<i>Joining the voice chat...</i>", parse_mode="HTML")
await ins.start(chat.id)
VOICE_CHATS[chat.id] = ins
if match:
await msg.edit("🔄 <i>Starting YouTube Video Stream...</i>", parse_mode="HTML")
try:
Expand Down Expand Up @@ -61,8 +63,6 @@ async def play_video(event):

try:
await sleep(2)
await ins.start(chat.id)
VOICE_CHATS[chat.id] = ins
await ins.start_video(link, with_audio=True, repeat=False)
await msg.delete()
await event.reply(
Expand Down Expand Up @@ -93,8 +93,6 @@ async def play_video(event):

try:
await sleep(2)
await ins.start(chat.id)
VOICE_CHATS[chat.id] = ins
await ins.start_video(video, with_audio=True, repeat=False)
await msg.delete()
await event.reply(
Expand Down

0 comments on commit b300a22

Please sign in to comment.