This commit is contained in:
levina 2022-02-09 09:44:46 +07:00 committed by GitHub
parent c1e811bef2
commit 6bcb2ba7c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,7 +3,6 @@
# Finished On 28/10/2021 # Finished On 28/10/2021
import os import os
# pyrogram stuff # pyrogram stuff
from pyrogram import Client from pyrogram import Client
from pyrogram.errors import UserAlreadyParticipant, UserNotParticipant from pyrogram.errors import UserAlreadyParticipant, UserNotParticipant
@ -23,7 +22,7 @@ from driver.core import calls, user, bot
from driver.utils import bash from driver.utils import bash
from driver.database.dbpunish import is_gbanned_user from driver.database.dbpunish import is_gbanned_user
from driver.database.dblockchat import blacklisted_chats from driver.database.dblockchat import blacklisted_chats
from driver.database.dbqueue import add_active_chat, remove_active_chat, is_active_chat, music_on from driver.database.dbqueue import add_active_chat, remove_active_chat, music_on, music_off
from config import BOT_USERNAME, IMG_5 from config import BOT_USERNAME, IMG_5
# youtube-dl stuff # youtube-dl stuff
from youtubesearchpython import VideosSearch from youtubesearchpython import VideosSearch
@ -177,6 +176,7 @@ async def play(c: Client, m: Message):
image = await thumb(thumbnail, title, userid, ctitle) image = await thumb(thumbnail, title, userid, ctitle)
await suhu.edit("🔄 **Joining vc...**") await suhu.edit("🔄 **Joining vc...**")
await music_on(chat_id) await music_on(chat_id)
await add_active_chat(chat_id)
await calls.join_group_call( await calls.join_group_call(
chat_id, chat_id,
AudioPiped( AudioPiped(
@ -197,10 +197,10 @@ async def play(c: Client, m: Message):
caption=f"🗂 **Name:** [{songname}]({link}) | `music`\n⏱️ **Duration:** `{duration}`\n🧸 **Request by:** {requester}", caption=f"🗂 **Name:** [{songname}]({link}) | `music`\n⏱️ **Duration:** `{duration}`\n🧸 **Request by:** {requester}",
) )
await idle() await idle()
await add_active_chat(chat_id)
os.remove(image) os.remove(image)
except Exception as e: except Exception as e:
await suhu.delete() await suhu.delete()
await music_off(chat_id)
await remove_active_chat(chat_id) await remove_active_chat(chat_id)
await m.reply_text(f"🚫 error:\n\n» {e}") await m.reply_text(f"🚫 error:\n\n» {e}")
else: else:
@ -245,6 +245,7 @@ async def play(c: Client, m: Message):
try: try:
await suhu.edit("🔄 **Joining vc...**") await suhu.edit("🔄 **Joining vc...**")
await music_on(chat_id) await music_on(chat_id)
await add_active_chat(chat_id)
await calls.join_group_call( await calls.join_group_call(
chat_id, chat_id,
AudioPiped( AudioPiped(
@ -265,10 +266,10 @@ async def play(c: Client, m: Message):
caption=f"🗂 **Name:** [{songname}]({url}) | `music`\n**⏱ Duration:** `{duration}`\n🧸 **Request by:** {requester}", caption=f"🗂 **Name:** [{songname}]({url}) | `music`\n**⏱ Duration:** `{duration}`\n🧸 **Request by:** {requester}",
) )
await idle() await idle()
await add_active_chat(chat_id)
os.remove(image) os.remove(image)
except Exception as ep: except Exception as ep:
await suhu.delete() await suhu.delete()
await music_off(chat_id)
await remove_active_chat(chat_id) await remove_active_chat(chat_id)
await m.reply_text(f"🚫 error: `{ep}`") await m.reply_text(f"🚫 error: `{ep}`")
@ -312,6 +313,7 @@ async def play(c: Client, m: Message):
try: try:
await suhu.edit("🔄 **Joining vc...**") await suhu.edit("🔄 **Joining vc...**")
await music_on(chat_id) await music_on(chat_id)
await add_active_chat(chat_id)
await calls.join_group_call( await calls.join_group_call(
chat_id, chat_id,
AudioPiped( AudioPiped(
@ -330,9 +332,9 @@ async def play(c: Client, m: Message):
caption=f"🗂 **Name:** [{songname}]({url}) | `music`\n**⏱ Duration:** `{duration}`\n🧸 **Request by:** {requester}", caption=f"🗂 **Name:** [{songname}]({url}) | `music`\n**⏱ Duration:** `{duration}`\n🧸 **Request by:** {requester}",
) )
await idle() await idle()
await add_active_chat(chat_id)
os.remove(image) os.remove(image)
except Exception as ep: except Exception as ep:
await suhu.delete() await suhu.delete()
await music_off(chat_id)
await remove_active_chat(chat_id) await remove_active_chat(chat_id)
await m.reply_text(f"🚫 error: `{ep}`") await m.reply_text(f"🚫 error: `{ep}`")