send notif
after next track playing, bot will notified user if the next track is playing
This commit is contained in:
parent
f0b8baf92c
commit
520dad6261
@ -8,9 +8,26 @@ from pytgcalls.types.input_stream.quality import (
|
|||||||
LowQualityVideo,
|
LowQualityVideo,
|
||||||
MediumQualityVideo,
|
MediumQualityVideo,
|
||||||
)
|
)
|
||||||
|
from pyrogram.types import (
|
||||||
|
CallbackQuery,
|
||||||
|
InlineKeyboardButton,
|
||||||
|
InlineKeyboardMarkup,
|
||||||
|
Message,
|
||||||
|
)
|
||||||
|
from pyrogram import Client, filters
|
||||||
from pytgcalls.types.stream import StreamAudioEnded, StreamVideoEnded
|
from pytgcalls.types.stream import StreamAudioEnded, StreamVideoEnded
|
||||||
|
|
||||||
|
|
||||||
|
keyboard = InlineKeyboardMarkup(
|
||||||
|
[
|
||||||
|
[
|
||||||
|
InlineKeyboardButton(text="• Mᴇɴᴜ", callback_data="cbmenu"),
|
||||||
|
InlineKeyboardButton(text="• Cʟᴏsᴇ", callback_data="cls"),
|
||||||
|
]
|
||||||
|
]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
async def skip_current_song(chat_id):
|
async def skip_current_song(chat_id):
|
||||||
if chat_id in QUEUE:
|
if chat_id in QUEUE:
|
||||||
chat_queue = get_queue(chat_id)
|
chat_queue = get_queue(chat_id)
|
||||||
@ -86,8 +103,17 @@ async def left_handler(_, chat_id: int):
|
|||||||
|
|
||||||
|
|
||||||
@call_py.on_stream_end()
|
@call_py.on_stream_end()
|
||||||
async def stream_end_handler(_, u: Update):
|
async def stream_end_handler(_, u: Update, m: Message):
|
||||||
if isinstance(u, StreamAudioEnded) or isinstance(u, StreamVideoEnded):
|
if isinstance(u, StreamAudioEnded) or isinstance(u, StreamVideoEnded):
|
||||||
chat_id = u.chat_id
|
chat_id = u.chat_id
|
||||||
|
grup_id = m.chat.id
|
||||||
print(chat_id)
|
print(chat_id)
|
||||||
await skip_current_song(chat_id)
|
op = await skip_current_song(chat_id)
|
||||||
|
if op==1:
|
||||||
|
await _.send_message(grup_id, "✅ __Queues__ **is empty**\n\n» **userbot leaving video chat**")
|
||||||
|
elif op==2:
|
||||||
|
await _.send_message(grup_id, "❌ **an error occurred**\n\n» **Clearing** __Queues__ **and leaving video chat.**")
|
||||||
|
else:
|
||||||
|
await _.send_photo(grup_id, photo=f"{NEXT_IMG}", caption=f"💡 **Streaming next track**\n\n🏷 **Name:** [{op[0]}]({op[1]}) | `{op[2]}`\n💭 **Chat:** `{grup_id}`", reply_markup=keyboard)
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user