improvements
This commit is contained in:
parent
410744c6e1
commit
4f40414406
@ -2,6 +2,8 @@
|
|||||||
# Commit Start Date 20/10/2021
|
# Commit Start Date 20/10/2021
|
||||||
# Finished On 28/10/2021
|
# Finished On 28/10/2021
|
||||||
|
|
||||||
|
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
|
||||||
@ -21,6 +23,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 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
|
||||||
@ -115,6 +118,7 @@ async def play(c: Client, m: Message):
|
|||||||
"https://t.me/+", "https://t.me/joinchat/"
|
"https://t.me/+", "https://t.me/joinchat/"
|
||||||
)
|
)
|
||||||
await user.join_chat(invitelink)
|
await user.join_chat(invitelink)
|
||||||
|
await remove_active_chat(chat_id)
|
||||||
except UserNotParticipant:
|
except UserNotParticipant:
|
||||||
try:
|
try:
|
||||||
invitelink = await c.export_chat_invite_link(chat_id)
|
invitelink = await c.export_chat_invite_link(chat_id)
|
||||||
@ -123,6 +127,7 @@ async def play(c: Client, m: Message):
|
|||||||
"https://t.me/+", "https://t.me/joinchat/"
|
"https://t.me/+", "https://t.me/joinchat/"
|
||||||
)
|
)
|
||||||
await user.join_chat(invitelink)
|
await user.join_chat(invitelink)
|
||||||
|
await remove_active_chat(chat_id)
|
||||||
except UserAlreadyParticipant:
|
except UserAlreadyParticipant:
|
||||||
pass
|
pass
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -161,6 +166,7 @@ async def play(c: Client, m: Message):
|
|||||||
reply_markup=InlineKeyboardMarkup(buttons),
|
reply_markup=InlineKeyboardMarkup(buttons),
|
||||||
caption=f"💡 **Track added to queue »** `{pos}`\n\n🗂 **Name:** [{songname}]({link}) | `music`\n⏱️ **Duration:** `{duration}`\n🧸 **Request by:** {requester}",
|
caption=f"💡 **Track added to queue »** `{pos}`\n\n🗂 **Name:** [{songname}]({link}) | `music`\n⏱️ **Duration:** `{duration}`\n🧸 **Request by:** {requester}",
|
||||||
)
|
)
|
||||||
|
os.remove(image)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
gcname = m.chat.title
|
gcname = m.chat.title
|
||||||
@ -170,6 +176,7 @@ async def play(c: Client, m: Message):
|
|||||||
thumbnail = f"{IMG_5}"
|
thumbnail = f"{IMG_5}"
|
||||||
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 calls.join_group_call(
|
await calls.join_group_call(
|
||||||
chat_id,
|
chat_id,
|
||||||
AudioPiped(
|
AudioPiped(
|
||||||
@ -190,8 +197,11 @@ 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)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
await suhu.delete()
|
await suhu.delete()
|
||||||
|
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:
|
||||||
if len(m.command) < 2:
|
if len(m.command) < 2:
|
||||||
@ -230,9 +240,11 @@ async def play(c: Client, m: Message):
|
|||||||
reply_markup=InlineKeyboardMarkup(buttons),
|
reply_markup=InlineKeyboardMarkup(buttons),
|
||||||
caption=f"💡 **Track added to queue »** `{pos}`\n\n🗂 **Name:** [{songname}]({url}) | `music`\n**⏱ Duration:** `{duration}`\n🧸 **Request by:** {requester}",
|
caption=f"💡 **Track added to queue »** `{pos}`\n\n🗂 **Name:** [{songname}]({url}) | `music`\n**⏱ Duration:** `{duration}`\n🧸 **Request by:** {requester}",
|
||||||
)
|
)
|
||||||
|
os.remove(image)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
await suhu.edit("🔄 **Joining vc...**")
|
await suhu.edit("🔄 **Joining vc...**")
|
||||||
|
await music_on(chat_id)
|
||||||
await calls.join_group_call(
|
await calls.join_group_call(
|
||||||
chat_id,
|
chat_id,
|
||||||
AudioPiped(
|
AudioPiped(
|
||||||
@ -253,8 +265,11 @@ 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)
|
||||||
except Exception as ep:
|
except Exception as ep:
|
||||||
await suhu.delete()
|
await suhu.delete()
|
||||||
|
await remove_active_chat(chat_id)
|
||||||
await m.reply_text(f"🚫 error: `{ep}`")
|
await m.reply_text(f"🚫 error: `{ep}`")
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@ -292,9 +307,11 @@ async def play(c: Client, m: Message):
|
|||||||
reply_markup=InlineKeyboardMarkup(buttons),
|
reply_markup=InlineKeyboardMarkup(buttons),
|
||||||
caption=f"💡 **Track added to queue »** `{pos}`\n\n🗂 **Name:** [{songname}]({url}) | `music`\n**⏱ Duration:** `{duration}`\n🧸 **Request by:** {requester}",
|
caption=f"💡 **Track added to queue »** `{pos}`\n\n🗂 **Name:** [{songname}]({url}) | `music`\n**⏱ Duration:** `{duration}`\n🧸 **Request by:** {requester}",
|
||||||
)
|
)
|
||||||
|
os.remove(image)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
await suhu.edit("🔄 **Joining vc...**")
|
await suhu.edit("🔄 **Joining vc...**")
|
||||||
|
await music_on(chat_id)
|
||||||
await calls.join_group_call(
|
await calls.join_group_call(
|
||||||
chat_id,
|
chat_id,
|
||||||
AudioPiped(
|
AudioPiped(
|
||||||
@ -313,6 +330,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)
|
||||||
except Exception as ep:
|
except Exception as ep:
|
||||||
await suhu.delete()
|
await suhu.delete()
|
||||||
|
await remove_active_chat(chat_id)
|
||||||
await m.reply_text(f"🚫 error: `{ep}`")
|
await m.reply_text(f"🚫 error: `{ep}`")
|
||||||
|
Loading…
Reference in New Issue
Block a user