From ba5170a35ff93eefe9222f57762ec4e09a652033 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Mon, 21 Feb 2022 05:54:42 +0700 Subject: [PATCH 01/15] [check] something --- program/music.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/program/music.py b/program/music.py index fb3d717..f1c0fa2 100644 --- a/program/music.py +++ b/program/music.py @@ -44,7 +44,12 @@ def ytsearch(query: str): async def ytdl(link: str): stdout, stderr = await bash( - f'yt-dlp --geo-bypass -g -f "best[height<=?720][width<=?1280]/best" {link}' + 'yt-dlp', + '--geo-bypass', + '-g', + '-f', + 'best[height<=?720][width<=?1280]/best', + f'{link}', ) if stdout: return 1, stdout @@ -99,7 +104,7 @@ async def play_tg_file(c: Client, m: Message, replied: Message = None, link: str duration = convert_seconds(replied.voice.duration) except BaseException: pass - # recheck + if not thumbnail: thumbnail = f"{IMG_5}" @@ -301,7 +306,7 @@ async def play(c: Client, m: Message): query = m.text.split(None, 1)[1] search = ytsearch(query) if search == 0: - await suhu.edit("โŒ **no results found.**") + await suhu.edit("โŒ **no results found**") else: songname = search[0] title = search[0] From c5096876e0c31cf9ce8e208005bf5f82257c9065 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Mon, 21 Feb 2022 06:30:34 +0700 Subject: [PATCH 02/15] [check] something --- program/video.py | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/program/video.py b/program/video.py index 17e49bb..4c47f0d 100644 --- a/program/video.py +++ b/program/video.py @@ -425,49 +425,60 @@ async def vstream(c: Client, m: Message): ) if len(m.command) < 2: - await m.reply("ยป give me a live-link/m3u8 url/youtube link to stream.") + await m.reply("ยป Give me a youtube live url/m3u8 url to stream.") else: if len(m.command) == 2: - link = m.text.split(None, 1)[1] Q = 720 + url = m.text.split(None, 1)[1] + search = ytsearch(url) loser = await c.send_message(chat_id, "๐Ÿ” **Loading...**") elif len(m.command) == 3: op = m.text.split(None, 1)[1] - link = op.split(None, 1)[0] + url = op.split(None, 1)[0] quality = op.split(None, 1)[1] + search = ytsearch(op) if quality == "720" or "480" or "360": Q = int(quality) else: Q = 720 await m.reply( - "ยป only 720, 480, 360 allowed\n\n๐Ÿ’ก now streaming video in **720p**" + "ยป Streaming the video in 720p quality" ) loser = await c.send_message(chat_id, "๐Ÿ” **Loading...**") else: - await m.reply("`/vstream` {link} {720/480/360}") + await m.reply(f"`/vstream` {url} (720/480/360)") regex = r"^(https?\:\/\/)?(www\.youtube\.com|youtu\.?be)\/.+" - match = re.match(regex, link) + match = re.match(regex, url) + if match: - veez, livelink = await ytdl(link) + veez, livelink = await ytdl(url) else: - livelink = link + livelink = url veez = 1 if veez == 0: await loser.edit(f"โŒ yt-dl issues detected\n\nยป `{livelink}`") else: + title = search[0] + songname = search[0] + thumbnail = search[1] + userid = m.from_user.id + gcname = m.chat.title + ctitle = await CHAT_TITLE(gcname) + image = await thumb(thumbnail, title, userid, ctitle) if chat_id in QUEUE: await loser.edit("๐Ÿ”„ Queueing Track...") - pos = add_to_queue(chat_id, "Live Stream", livelink, link, "Video", Q) + pos = add_to_queue(chat_id, "Live Stream", livelink, url, "Video", Q) await loser.delete() requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})" buttons = stream_markup(user_id) await m.reply_photo( - photo=f"{IMG_1}", + photo=image, reply_markup=InlineKeyboardMarkup(buttons), - caption=f"๐Ÿ’ก **Track added to queue ยป** `{pos}`\n\n๐Ÿ’ญ **Chat:** `{chat_id}`\n๐Ÿงธ **Request by:** {requester}", + caption=f"๐Ÿ’ก **Track added to queue ยป** `{pos}`\n\n๐Ÿ—‚ **Name:** [{songname}]({url}) | `live video`\n๐Ÿงธ **Requested by:** {requester}", ) + remove_if_exists(image) else: if Q == 720: amaze = HighQualityVideo() @@ -488,17 +499,19 @@ async def vstream(c: Client, m: Message): ), stream_type=StreamType().live_stream, ) - add_to_queue(chat_id, "Live Stream", livelink, link, "Video", Q) + add_to_queue(chat_id, "Live Stream", livelink, url, "Video", Q) await loser.delete() requester = ( f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})" ) buttons = stream_markup(user_id) await m.reply_photo( - photo=f"{IMG_2}", + photo=image", reply_markup=InlineKeyboardMarkup(buttons), - caption=f"๐Ÿ’ก **[Video Live]({link}) stream started.**\n\n๐Ÿ’ญ **Chat:** `{chat_id}`\n๐Ÿงธ **Request by:** {requester}", + caption=f"๐Ÿ—‚ **Name:** [{songname}]({url}) | `live video`\n๐Ÿงธ **Requested by:** {requester}", ) + await idle() + remove_if_exists(image) except Exception as ep: await loser.delete() await remove_active_chat(chat_id) From c69ba0bd4d319ef61ab7fc7afb6e54876e2e593b Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Mon, 21 Feb 2022 06:52:53 +0700 Subject: [PATCH 03/15] [check] syntax error --- program/video.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/program/video.py b/program/video.py index 4c47f0d..9f55976 100644 --- a/program/video.py +++ b/program/video.py @@ -506,7 +506,7 @@ async def vstream(c: Client, m: Message): ) buttons = stream_markup(user_id) await m.reply_photo( - photo=image", + photo=image, reply_markup=InlineKeyboardMarkup(buttons), caption=f"๐Ÿ—‚ **Name:** [{songname}]({url}) | `live video`\n๐Ÿงธ **Requested by:** {requester}", ) From 50a61e7c4abd4863dc5b4682e6569a2d2c3ff4ae Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Mon, 21 Feb 2022 07:56:14 +0700 Subject: [PATCH 04/15] fixing --- program/video.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/program/video.py b/program/video.py index 9f55976..61dca61 100644 --- a/program/video.py +++ b/program/video.py @@ -460,13 +460,7 @@ async def vstream(c: Client, m: Message): if veez == 0: await loser.edit(f"โŒ yt-dl issues detected\n\nยป `{livelink}`") else: - title = search[0] songname = search[0] - thumbnail = search[1] - userid = m.from_user.id - gcname = m.chat.title - ctitle = await CHAT_TITLE(gcname) - image = await thumb(thumbnail, title, userid, ctitle) if chat_id in QUEUE: await loser.edit("๐Ÿ”„ Queueing Track...") pos = add_to_queue(chat_id, "Live Stream", livelink, url, "Video", Q) @@ -474,7 +468,7 @@ async def vstream(c: Client, m: Message): requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})" buttons = stream_markup(user_id) await m.reply_photo( - photo=image, + photo=f"{IMG_1}", reply_markup=InlineKeyboardMarkup(buttons), caption=f"๐Ÿ’ก **Track added to queue ยป** `{pos}`\n\n๐Ÿ—‚ **Name:** [{songname}]({url}) | `live video`\n๐Ÿงธ **Requested by:** {requester}", ) @@ -506,7 +500,7 @@ async def vstream(c: Client, m: Message): ) buttons = stream_markup(user_id) await m.reply_photo( - photo=image, + photo=f"{IMG_2}", reply_markup=InlineKeyboardMarkup(buttons), caption=f"๐Ÿ—‚ **Name:** [{songname}]({url}) | `live video`\n๐Ÿงธ **Requested by:** {requester}", ) From 044830f2a4e68d44142b61a4245bc31e7fe8024b Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Mon, 21 Feb 2022 08:24:52 +0700 Subject: [PATCH 05/15] [check] some changes --- driver/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/driver/utils.py b/driver/utils.py index 8db3b24..e10b824 100644 --- a/driver/utils.py +++ b/driver/utils.py @@ -51,7 +51,7 @@ async def skip_current_song(chat_id): link = chat_queue[1][2] type = chat_queue[1][3] Q = chat_queue[1][4] - if type == "Audio": + if type == "music": await calls.change_stream( chat_id, AudioPiped( @@ -59,7 +59,7 @@ async def skip_current_song(chat_id): HighQualityAudio(), ), ) - elif type == "Video": + elif type == "video": if Q == 720: hm = HighQualityVideo() elif Q == 480: From 26b37e3d485f6082783fa076194e26d49efa20bf Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Mon, 21 Feb 2022 08:27:30 +0700 Subject: [PATCH 06/15] [check] some changes --- program/music.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/program/music.py b/program/music.py index f1c0fa2..e73818c 100644 --- a/program/music.py +++ b/program/music.py @@ -84,7 +84,7 @@ async def play_tg_file(c: Client, m: Message, replied: Message = None, link: str suhu = await m.reply("๐Ÿ“ฅ downloading audio...") dl = await replied.download() link = replied.link - songname = "Audio" + songname = "music" thumbnail = f"{IMG_5}" duration = "00:00" try: @@ -100,7 +100,7 @@ async def play_tg_file(c: Client, m: Message, replied: Message = None, link: str thumbnail = await user.download_media(replied.audio.thumbs[0].file_id) duration = convert_seconds(replied.audio.duration) elif replied.voice: - songname = "Voice Note" + songname = "voice note" duration = convert_seconds(replied.voice.duration) except BaseException: pass @@ -115,7 +115,7 @@ async def play_tg_file(c: Client, m: Message, replied: Message = None, link: str title = songname userid = m.from_user.id image = await thumb(thumbnail, title, userid, ctitle) - pos = add_to_queue(chat_id, songname, dl, link, "Audio", 0) + pos = add_to_queue(chat_id, songname, dl, link, "music", 0) requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})" buttons = stream_markup(user_id) await suhu.delete() @@ -146,7 +146,7 @@ async def play_tg_file(c: Client, m: Message, replied: Message = None, link: str ), stream_type=StreamType().pulse_stream, ) - add_to_queue(chat_id, songname, dl, link, "Audio", 0) + add_to_queue(chat_id, songname, dl, link, "music", 0) await suhu.delete() buttons = stream_markup(user_id) requester = ( @@ -231,7 +231,7 @@ async def play(c: Client, m: Message): query = m.text.split(None, 1)[1] search = ytsearch(query) if search == 0: - await suhu.edit("โŒ **no results found.**") + await suhu.edit("โŒ **no results found**") else: songname = search[0] title = search[0] @@ -249,7 +249,7 @@ async def play(c: Client, m: Message): if chat_id in QUEUE: await suhu.edit("๐Ÿ”„ Queueing Track...") pos = add_to_queue( - chat_id, songname, ytlink, url, "Audio", 0 + chat_id, songname, ytlink, url, "music", 0 ) await suhu.delete() buttons = stream_markup(user_id) @@ -273,7 +273,7 @@ async def play(c: Client, m: Message): ), stream_type=StreamType().local_stream, ) - add_to_queue(chat_id, songname, ytlink, url, "Audio", 0) + add_to_queue(chat_id, songname, ytlink, url, "music", 0) await suhu.delete() buttons = stream_markup(user_id) requester = ( @@ -323,7 +323,7 @@ async def play(c: Client, m: Message): else: if chat_id in QUEUE: await suhu.edit("๐Ÿ”„ Queueing Track...") - pos = add_to_queue(chat_id, songname, ytlink, url, "Audio", 0) + pos = add_to_queue(chat_id, songname, ytlink, url, "music", 0) await suhu.delete() requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})" buttons = stream_markup(user_id) @@ -346,7 +346,7 @@ async def play(c: Client, m: Message): ), stream_type=StreamType().local_stream, ) - add_to_queue(chat_id, songname, ytlink, url, "Audio", 0) + add_to_queue(chat_id, songname, ytlink, url, "music", 0) await suhu.delete() requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})" buttons = stream_markup(user_id) From e89c29d0cca7375c42b7d9ad840d2d1cb2874680 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Mon, 21 Feb 2022 08:35:41 +0700 Subject: [PATCH 07/15] [check] some changes --- program/video.py | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/program/video.py b/program/video.py index 61dca61..8c0959a 100644 --- a/program/video.py +++ b/program/video.py @@ -105,7 +105,7 @@ async def play_tg_file(c: Client, m: Message, replied: Message = None, link: str Q = int(pq) else: await loser.edit( - "ยป only 720, 480, 360 allowed\n\n๐Ÿ’ก now streaming video in **720p**" + "Streaming the local video in 720p quality" ) try: if replied.video: @@ -114,7 +114,7 @@ async def play_tg_file(c: Client, m: Message, replied: Message = None, link: str elif replied.document: songname = replied.document.file_name[:80] except BaseException: - songname = "Video" + songname = "video" if chat_id in QUEUE: await loser.edit("๐Ÿ”„ Queueing Track...") @@ -124,7 +124,7 @@ async def play_tg_file(c: Client, m: Message, replied: Message = None, link: str userid = m.from_user.id thumbnail = f"{IMG_5}" image = await thumb(thumbnail, title, userid, ctitle) - pos = add_to_queue(chat_id, songname, dl, link, "Video", Q) + pos = add_to_queue(chat_id, songname, dl, link, "video", Q) await loser.delete() requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})" buttons = stream_markup(user_id) @@ -162,7 +162,7 @@ async def play_tg_file(c: Client, m: Message, replied: Message = None, link: str ), stream_type=StreamType().pulse_stream, ) - add_to_queue(chat_id, songname, dl, link, "Video", Q) + add_to_queue(chat_id, songname, dl, link, "video", Q) await loser.delete() requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})" buttons = stream_markup(user_id) @@ -260,7 +260,7 @@ async def vplay(c: Client, m: Message): if chat_id in QUEUE: await loser.edit("๐Ÿ”„ Queueing Track...") pos = add_to_queue( - chat_id, songname, ytlink, url, "Video", Q + chat_id, songname, ytlink, url, "video", Q ) await loser.delete() requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})" @@ -285,7 +285,7 @@ async def vplay(c: Client, m: Message): ), stream_type=StreamType().local_stream, ) - add_to_queue(chat_id, songname, ytlink, url, "Video", Q) + add_to_queue(chat_id, songname, ytlink, url, "video", Q) await loser.delete() requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})" buttons = stream_markup(user_id) @@ -335,7 +335,7 @@ async def vplay(c: Client, m: Message): else: if chat_id in QUEUE: await loser.edit("๐Ÿ”„ Queueing Track...") - pos = add_to_queue(chat_id, songname, ytlink, url, "Video", Q) + pos = add_to_queue(chat_id, songname, ytlink, url, "video", Q) await loser.delete() requester = ( f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})" @@ -361,7 +361,7 @@ async def vplay(c: Client, m: Message): ), stream_type=StreamType().local_stream, ) - add_to_queue(chat_id, songname, ytlink, url, "Video", Q) + add_to_queue(chat_id, songname, ytlink, url, "video", Q) await loser.delete() requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})" buttons = stream_markup(user_id) @@ -442,7 +442,7 @@ async def vstream(c: Client, m: Message): else: Q = 720 await m.reply( - "ยป Streaming the video in 720p quality" + "ยป Streaming the live video in 720p quality" ) loser = await c.send_message(chat_id, "๐Ÿ” **Loading...**") else: @@ -461,16 +461,18 @@ async def vstream(c: Client, m: Message): await loser.edit(f"โŒ yt-dl issues detected\n\nยป `{livelink}`") else: songname = search[0] + thumbnail = search[3] + image = thumbnail if chat_id in QUEUE: await loser.edit("๐Ÿ”„ Queueing Track...") - pos = add_to_queue(chat_id, "Live Stream", livelink, url, "Video", Q) + pos = add_to_queue(chat_id, "live stream", livelink, url, "video", Q) await loser.delete() requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})" buttons = stream_markup(user_id) await m.reply_photo( - photo=f"{IMG_1}", + photo=image, reply_markup=InlineKeyboardMarkup(buttons), - caption=f"๐Ÿ’ก **Track added to queue ยป** `{pos}`\n\n๐Ÿ—‚ **Name:** [{songname}]({url}) | `live video`\n๐Ÿงธ **Requested by:** {requester}", + caption=f"๐Ÿ’ก **Track added to queue ยป** `{pos}`\n\n๐Ÿ—‚ **Name:** [{songname}]({url}) | `live`\n๐Ÿงธ **Requested by:** {requester}", ) remove_if_exists(image) else: @@ -493,16 +495,16 @@ async def vstream(c: Client, m: Message): ), stream_type=StreamType().live_stream, ) - add_to_queue(chat_id, "Live Stream", livelink, url, "Video", Q) + add_to_queue(chat_id, "live stream", livelink, url, "video", Q) await loser.delete() requester = ( f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})" ) buttons = stream_markup(user_id) await m.reply_photo( - photo=f"{IMG_2}", + photo=image, reply_markup=InlineKeyboardMarkup(buttons), - caption=f"๐Ÿ—‚ **Name:** [{songname}]({url}) | `live video`\n๐Ÿงธ **Requested by:** {requester}", + caption=f"๐Ÿ—‚ **Name:** [{songname}]({url}) | `live`\n๐Ÿงธ **Requested by:** {requester}", ) await idle() remove_if_exists(image) From a8db4e6ba3001e4538bb46fb82b1661f69a87c42 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Mon, 21 Feb 2022 09:01:52 +0700 Subject: [PATCH 08/15] [check] some changes --- program/video.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/program/video.py b/program/video.py index 8c0959a..c12a528 100644 --- a/program/video.py +++ b/program/video.py @@ -461,20 +461,17 @@ async def vstream(c: Client, m: Message): await loser.edit(f"โŒ yt-dl issues detected\n\nยป `{livelink}`") else: songname = search[0] - thumbnail = search[3] - image = thumbnail if chat_id in QUEUE: await loser.edit("๐Ÿ”„ Queueing Track...") - pos = add_to_queue(chat_id, "live stream", livelink, url, "video", Q) + pos = add_to_queue(chat_id, songname, livelink, url, "live", Q) await loser.delete() requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})" buttons = stream_markup(user_id) await m.reply_photo( - photo=image, + photo=f"{IMG_1}", reply_markup=InlineKeyboardMarkup(buttons), caption=f"๐Ÿ’ก **Track added to queue ยป** `{pos}`\n\n๐Ÿ—‚ **Name:** [{songname}]({url}) | `live`\n๐Ÿงธ **Requested by:** {requester}", ) - remove_if_exists(image) else: if Q == 720: amaze = HighQualityVideo() @@ -495,19 +492,18 @@ async def vstream(c: Client, m: Message): ), stream_type=StreamType().live_stream, ) - add_to_queue(chat_id, "live stream", livelink, url, "video", Q) + add_to_queue(chat_id, songname, livelink, url, "live", Q) await loser.delete() requester = ( f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})" ) buttons = stream_markup(user_id) await m.reply_photo( - photo=image, + photo=f"{IMG_2}", reply_markup=InlineKeyboardMarkup(buttons), caption=f"๐Ÿ—‚ **Name:** [{songname}]({url}) | `live`\n๐Ÿงธ **Requested by:** {requester}", ) await idle() - remove_if_exists(image) except Exception as ep: await loser.delete() await remove_active_chat(chat_id) From 1b71dc1c2014b9046497484409716df16de6511e Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Mon, 21 Feb 2022 09:05:11 +0700 Subject: [PATCH 09/15] [check] some changes --- program/video.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/program/video.py b/program/video.py index c12a528..7119d45 100644 --- a/program/video.py +++ b/program/video.py @@ -463,7 +463,7 @@ async def vstream(c: Client, m: Message): songname = search[0] if chat_id in QUEUE: await loser.edit("๐Ÿ”„ Queueing Track...") - pos = add_to_queue(chat_id, songname, livelink, url, "live", Q) + pos = add_to_queue(chat_id, songname, livelink, url, "video", Q) await loser.delete() requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})" buttons = stream_markup(user_id) @@ -492,7 +492,7 @@ async def vstream(c: Client, m: Message): ), stream_type=StreamType().live_stream, ) - add_to_queue(chat_id, songname, livelink, url, "live", Q) + add_to_queue(chat_id, songname, livelink, url, "video", Q) await loser.delete() requester = ( f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})" From febbfe5b57b8353b0612b59adca7b02bb7a9ac5d Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Mon, 21 Feb 2022 09:19:52 +0700 Subject: [PATCH 10/15] [check] some changes --- program/music.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/program/music.py b/program/music.py index e73818c..ceec520 100644 --- a/program/music.py +++ b/program/music.py @@ -44,12 +44,7 @@ def ytsearch(query: str): async def ytdl(link: str): stdout, stderr = await bash( - 'yt-dlp', - '--geo-bypass', - '-g', - '-f', - 'best[height<=?720][width<=?1280]/best', - f'{link}', + f'yt-dlp --geo-bypass -g -f "best[height<=?720][width<=?1280]/best" {link}', ) if stdout: return 1, stdout From 60b1e4788deda18e9a4cf2865eb6fd3562a80b74 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Mon, 21 Feb 2022 11:01:48 +0700 Subject: [PATCH 11/15] command create group call --- program/userbot_tools.py | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/program/userbot_tools.py b/program/userbot_tools.py index c38184d..93e20ec 100644 --- a/program/userbot_tools.py +++ b/program/userbot_tools.py @@ -58,7 +58,7 @@ async def leave_chat(_, m: Message): ) -@Client.on_message(command(["leaveall", f"leaveall@{BOT_USERNAME}"])) +@Client.on_message(command(["leaveall", f"leaveall@{BOT_USERNAME}"]) & ~filters.edited) @bot_creator async def leave_all(client, message): if message.from_user.id not in SUDO_USERS: @@ -88,6 +88,29 @@ async def leave_all(client, message): ) +@Client.on_message(command(["startvc", f"startvc@{BOT_USERNAME}"]) & other_filters) +@check_blacklist() +@authorized_users_only +async def start_group_call(c: Client, m: Message): + chat_id = m.chat.id + try: + peer = await user.resolve_peer(chat_id) + await user.send( + CreateGroupCall( + peer=InputPeerChannel( + channel_id=peer.channel_id, + access_hash=peer.access_hash, + ), + random_id=user.rnd_id() // 9000000000, + ) + ) + msg = await c.send_message( + chat_id, "โœ… Group call started !" + ) + except Exception as e: + await msg.edit(f"๐Ÿšซ error: `{e}`") + + @Client.on_message(filters.left_chat_member) async def bot_kicked(c: Client, m: Message): bot_id = me_bot.id From 4ebae40c1425acae6975becc57e26b631d5d2a54 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Mon, 21 Feb 2022 11:03:13 +0700 Subject: [PATCH 12/15] forgot import --- program/userbot_tools.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/program/userbot_tools.py b/program/userbot_tools.py index 93e20ec..f03b7a4 100644 --- a/program/userbot_tools.py +++ b/program/userbot_tools.py @@ -10,6 +10,8 @@ from driver.decorators import authorized_users_only, bot_creator, check_blacklis from pyrogram.types import Message from pyrogram import Client, filters +from pyrogram.raw.types import InputPeerChannel +from pyrogram.raw.functions.phone import CreateGroupCall from pyrogram.errors import UserAlreadyParticipant, UserNotParticipant From ba1f95b6de5b2132dc9527eeae244a2ab290e140 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Mon, 21 Feb 2022 12:18:37 +0700 Subject: [PATCH 13/15] [check] some fixes --- program/userbot_tools.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/program/userbot_tools.py b/program/userbot_tools.py index f03b7a4..f77c305 100644 --- a/program/userbot_tools.py +++ b/program/userbot_tools.py @@ -12,7 +12,7 @@ from pyrogram.types import Message from pyrogram import Client, filters from pyrogram.raw.types import InputPeerChannel from pyrogram.raw.functions.phone import CreateGroupCall -from pyrogram.errors import UserAlreadyParticipant, UserNotParticipant +from pyrogram.errors import UserAlreadyParticipant, UserNotParticipant, ChatAdminRequired @@ -95,6 +95,7 @@ async def leave_all(client, message): @authorized_users_only async def start_group_call(c: Client, m: Message): chat_id = m.chat.id + msg = await c.send_message(chat_id, "`starting...`") try: peer = await user.resolve_peer(chat_id) await user.send( @@ -106,11 +107,11 @@ async def start_group_call(c: Client, m: Message): random_id=user.rnd_id() // 9000000000, ) ) - msg = await c.send_message( - chat_id, "โœ… Group call started !" + await msg.edit_text("โœ… Group call started !") + except ChatAdminRequired: + await msg.edit_text( + "The userbot is not admin in this chat. To start the Group call you must promote the userbot as admin first with permission:\n\nยป โŒ manage_video_chats" ) - except Exception as e: - await msg.edit(f"๐Ÿšซ error: `{e}`") @Client.on_message(filters.left_chat_member) From c3b274379562f993e34a60f11226d267ca2f5d90 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Mon, 21 Feb 2022 12:20:37 +0700 Subject: [PATCH 14/15] command info --- program/callback.py | 1 + 1 file changed, 1 insertion(+) diff --git a/program/callback.py b/program/callback.py index f983e6a..a21adab 100644 --- a/program/callback.py +++ b/program/callback.py @@ -186,6 +186,7 @@ async def admin_set(_, query: CallbackQuery): ยป /reload - reload bot and refresh the admin data ยป /userbotjoin - invite the userbot to join group ยป /userbotleave - order userbot to leave from group +ยป /startvc - start/restart the group call โšก๏ธ __Powered by {BOT_NAME} AI__""", reply_markup=InlineKeyboardMarkup( From b4c3b4f8bc6e1049e7041b7b1d00ea4749141c07 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Mon, 21 Feb 2022 13:01:59 +0700 Subject: [PATCH 15/15] remove `(,)` --- program/music.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/program/music.py b/program/music.py index ceec520..a012a75 100644 --- a/program/music.py +++ b/program/music.py @@ -44,7 +44,7 @@ def ytsearch(query: str): async def ytdl(link: str): stdout, stderr = await bash( - f'yt-dlp --geo-bypass -g -f "best[height<=?720][width<=?1280]/best" {link}', + f'yt-dlp --geo-bypass -g -f "best[height<=?720][width<=?1280]/best" {link}' ) if stdout: return 1, stdout