From e142befc999da39fafbdb4aa0bce05b4a353e364 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Tue, 2 Nov 2021 14:07:20 +0700 Subject: [PATCH 01/40] setup --- program/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/program/__init__.py b/program/__init__.py index 906d362..6ce93ac 100644 --- a/program/__init__.py +++ b/program/__init__.py @@ -1 +1,5 @@ __version__ = "0.6.0" + +# === SETUP === # + +BOT_ID = 0 From 7bca8765cc85a844834f36d0d2eb1a3933a68a7b Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Tue, 2 Nov 2021 14:51:28 +0700 Subject: [PATCH 02/40] improve `function` - added userbot auto join - must check if the bot was promoted as admin first before playing video --- program/video.py | 110 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 102 insertions(+), 8 deletions(-) diff --git a/program/video.py b/program/video.py index a499c31..eb2ef75 100644 --- a/program/video.py +++ b/program/video.py @@ -2,15 +2,17 @@ # Commit Start Date 20/10/2021 # Finished On 28/10/2021 -import asyncio import re +import asyncio -from config import BOT_USERNAME, GROUP_SUPPORT, IMG_1, IMG_2, UPDATES_CHANNEL -from driver.filters import command, other_filters -from driver.queues import QUEUE, add_to_queue -from driver.veez import call_py from pyrogram import Client +from driver.veez import call_py +from program import BOT_ID, USERBOT_ID +from driver.queues import QUEUE, add_to_queue +from driver.filters import command, other_filters +from config import BOT_USERNAME, GROUP_SUPPORT, IMG_1, IMG_2, UPDATES_CHANNEL, ASSISTANT_NAME from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message +from pyrogram.errors import UserAlreadyParticipant, UserNotParticipant from pytgcalls import StreamType from pytgcalls.types.input_stream import AudioVideoPiped from pytgcalls.types.input_stream.quality import ( @@ -56,7 +58,7 @@ async def ytdl(link): @Client.on_message(command(["vplay", f"vplay@{BOT_USERNAME}"]) & other_filters) -async def vplay(client, m: Message): +async def vplay(_, m: Message): keyboard = InlineKeyboardMarkup( [ @@ -70,7 +72,53 @@ async def vplay(client, m: Message): ] ] ) - + + chat_title = m.chat.title + a = await _.get_chat_member(m.chat.id, BOT_ID) + if a.status != "administrator": + await m.reply_text(f"💡 To use me, I need to be an **Administrator** with the following **permissions**:\n\n» ❌ __Delete messages__\n» ❌ __Ban users__\n» ❌ __Add users__\n» ❌ __Manage voice chat__\n\nData is **updated** automatically after you **promote me**") + return + if not a.can_manage_voice_chats: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Manage voice chat__") + return + if not a.can_delete_messages: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Delete messages__") + return + if not a.can_invite_users: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Add users__") + return + if not a.can_restrict_members: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Ban users__") + return + try: + b = await _.get_chat_member(m.chat.id, USERBOT_ID) + if b.status == "kicked": + await m.reply_text(f"@{ASSISTANT_NAME} **is banned in group** {chat_title}\n\n» **unban the userbot first if you want to use this bot.**") + return + except UserNotParticipant: + if m.chat.username: + try: + await call_py.join_chat(f"{m.chat.username}") + except Exception as e: + await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") + return + else: + try: + pope = await _.export_chat_invite_link(m.chat.id) + pepo = await _.revoke_chat_invite_link(m.chat.id, pope) + await call_py.join_chat(pepo.invite_link) + except UserAlreadyParticipant: + pass + except Exception as e: + return await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") replied = m.reply_to_message chat_id = m.chat.id if replied: @@ -244,7 +292,53 @@ async def vstream(client, m: Message): ] ] ) - + + chat_title = m.chat.title + a = await _.get_chat_member(m.chat.id, BOT_ID) + if a.status != "administrator": + await m.reply_text(f"💡 To use me, I need to be an **Administrator** with the following **permissions**:\n\n» ❌ __Delete messages__\n» ❌ __Ban users__\n» ❌ __Add users__\n» ❌ __Manage voice chat__\n\nData is **updated** automatically after you **promote me**") + return + if not a.can_manage_voice_chats: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Manage voice chat__") + return + if not a.can_delete_messages: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Delete messages__") + return + if not a.can_invite_users: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Add users__") + return + if not a.can_restrict_members: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Ban users__") + return + try: + b = await _.get_chat_member(m.chat.id, USERBOT_ID) + if b.status == "kicked": + await m.reply_text(f"@{ASSISTANT_NAME} **is banned in group** {chat_title}\n\n» **unban the userbot first if you want to use this bot.**") + return + except UserNotParticipant: + if m.chat.username: + try: + await call_py.join_chat(f"{m.chat.username}") + except Exception as e: + await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") + return + else: + try: + pope = await _.export_chat_invite_link(m.chat.id) + pepo = await _.revoke_chat_invite_link(m.chat.id, pope) + await call_py.join_chat(pepo.invite_link) + except UserAlreadyParticipant: + pass + except Exception as e: + return await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") chat_id = m.chat.id if len(m.command) < 2: await m.reply("» give me a live-link/m3u8 url/youtube link to stream.") From 318399296c25570ddcba9f19e7f659f080c1ccad Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Tue, 2 Nov 2021 14:52:20 +0700 Subject: [PATCH 03/40] fixes --- program/video.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/program/video.py b/program/video.py index eb2ef75..91d72ab 100644 --- a/program/video.py +++ b/program/video.py @@ -278,7 +278,7 @@ async def vplay(_, m: Message): @Client.on_message(command(["vstream", f"vstream@{BOT_USERNAME}"]) & other_filters) -async def vstream(client, m: Message): +async def vstream(_, m: Message): keyboard = InlineKeyboardMarkup( [ From dd701ae6a5ff8718f56b9f48b9f04dddf659de40 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Tue, 2 Nov 2021 14:56:48 +0700 Subject: [PATCH 04/40] fixes --- program/video.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/program/video.py b/program/video.py index 91d72ab..441ba9e 100644 --- a/program/video.py +++ b/program/video.py @@ -103,22 +103,22 @@ async def vplay(_, m: Message): if b.status == "kicked": await m.reply_text(f"@{ASSISTANT_NAME} **is banned in group** {chat_title}\n\n» **unban the userbot first if you want to use this bot.**") return - except UserNotParticipant: - if m.chat.username: + except UserNotParticipant: + if m.chat.username: + try: + await call_py.join_chat(f"{m.chat.username}") + except Exception as e: + await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") + return + else: try: - await call_py.join_chat(f"{m.chat.username}") + pope = await _.export_chat_invite_link(m.chat.id) + pepo = await _.revoke_chat_invite_link(m.chat.id, pope) + await call_py.join_chat(pepo.invite_link) + except UserAlreadyParticipant: + pass except Exception as e: - await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") - return - else: - try: - pope = await _.export_chat_invite_link(m.chat.id) - pepo = await _.revoke_chat_invite_link(m.chat.id, pope) - await call_py.join_chat(pepo.invite_link) - except UserAlreadyParticipant: - pass - except Exception as e: - return await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") + return await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") replied = m.reply_to_message chat_id = m.chat.id if replied: From e6db2a9b8c1a555508f8c77eebecdea6fb36577c Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Tue, 2 Nov 2021 14:59:51 +0700 Subject: [PATCH 05/40] fixes again --- program/video.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/program/video.py b/program/video.py index 441ba9e..e22693f 100644 --- a/program/video.py +++ b/program/video.py @@ -323,22 +323,22 @@ async def vstream(_, m: Message): if b.status == "kicked": await m.reply_text(f"@{ASSISTANT_NAME} **is banned in group** {chat_title}\n\n» **unban the userbot first if you want to use this bot.**") return - except UserNotParticipant: - if m.chat.username: + except UserNotParticipant: + if m.chat.username: + try: + await call_py.join_chat(f"{m.chat.username}") + except Exception as e: + await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") + return + else: try: - await call_py.join_chat(f"{m.chat.username}") + pope = await _.export_chat_invite_link(m.chat.id) + pepo = await _.revoke_chat_invite_link(m.chat.id, pope) + await call_py.join_chat(pepo.invite_link) + except UserAlreadyParticipant: + pass except Exception as e: - await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") - return - else: - try: - pope = await _.export_chat_invite_link(m.chat.id) - pepo = await _.revoke_chat_invite_link(m.chat.id, pope) - await call_py.join_chat(pepo.invite_link) - except UserAlreadyParticipant: - pass - except Exception as e: - return await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") + return await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") chat_id = m.chat.id if len(m.command) < 2: await m.reply("» give me a live-link/m3u8 url/youtube link to stream.") From d3dcf1b7bd0e3a2980fa37ca34431af278a30505 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Tue, 2 Nov 2021 15:07:40 +0700 Subject: [PATCH 06/40] improve `function` - added userbot auto join - must check if the bot was promoted as admin first before playing video --- program/music.py | 108 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 101 insertions(+), 7 deletions(-) diff --git a/program/music.py b/program/music.py index f0afd6f..f4a87f7 100644 --- a/program/music.py +++ b/program/music.py @@ -2,15 +2,17 @@ # Commit Start Date 20/10/2021 # Finished On 28/10/2021 -import asyncio import re +import asyncio -from config import BOT_USERNAME, GROUP_SUPPORT, IMG_1, IMG_2, UPDATES_CHANNEL -from driver.filters import command, other_filters -from driver.queues import QUEUE, add_to_queue -from driver.veez import call_py from pyrogram import Client +from driver.veez import call_py +from program import BOT_ID, USERBOT_ID +from driver.queues import QUEUE, add_to_queue +from driver.filters import command, other_filters +from pyrogram.errors import UserAlreadyParticipant, UserNotParticipant from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message +from config import BOT_USERNAME, GROUP_SUPPORT, IMG_1, IMG_2, UPDATES_CHANNEL, ASSISTANT_NAME from pytgcalls import StreamType from pytgcalls.types.input_stream import AudioPiped from youtubesearchpython import VideosSearch @@ -64,7 +66,53 @@ async def play(_, m: Message): ] ] ) - + + chat_title = m.chat.title + a = await _.get_chat_member(m.chat.id, BOT_ID) + if a.status != "administrator": + await m.reply_text(f"💡 To use me, I need to be an **Administrator** with the following **permissions**:\n\n» ❌ __Delete messages__\n» ❌ __Ban users__\n» ❌ __Add users__\n» ❌ __Manage voice chat__\n\nData is **updated** automatically after you **promote me**") + return + if not a.can_manage_voice_chats: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Manage voice chat__") + return + if not a.can_delete_messages: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Delete messages__") + return + if not a.can_invite_users: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Add users__") + return + if not a.can_restrict_members: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Ban users__") + return + try: + b = await _.get_chat_member(m.chat.id, USERBOT_ID) + if b.status == "kicked": + await m.reply_text(f"@{ASSISTANT_NAME} **is banned in group** {chat_title}\n\n» **unban the userbot first if you want to use this bot.**") + return + except UserNotParticipant: + if m.chat.username: + try: + await call_py.join_chat(f"{m.chat.username}") + except Exception as e: + await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") + return + else: + try: + pope = await _.export_chat_invite_link(m.chat.id) + pepo = await _.revoke_chat_invite_link(m.chat.id, pope) + await call_py.join_chat(pepo.invite_link) + except UserAlreadyParticipant: + pass + except Exception as e: + return await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") replied = m.reply_to_message chat_id = m.chat.id if replied: @@ -215,7 +263,53 @@ async def stream(_, m: Message): ] ] ) - + + chat_title = m.chat.title + a = await _.get_chat_member(m.chat.id, BOT_ID) + if a.status != "administrator": + await m.reply_text(f"💡 To use me, I need to be an **Administrator** with the following **permissions**:\n\n» ❌ __Delete messages__\n» ❌ __Ban users__\n» ❌ __Add users__\n» ❌ __Manage voice chat__\n\nData is **updated** automatically after you **promote me**") + return + if not a.can_manage_voice_chats: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Manage voice chat__") + return + if not a.can_delete_messages: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Delete messages__") + return + if not a.can_invite_users: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Add users__") + return + if not a.can_restrict_members: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Ban users__") + return + try: + b = await _.get_chat_member(m.chat.id, USERBOT_ID) + if b.status == "kicked": + await m.reply_text(f"@{ASSISTANT_NAME} **is banned in group** {chat_title}\n\n» **unban the userbot first if you want to use this bot.**") + return + except UserNotParticipant: + if m.chat.username: + try: + await call_py.join_chat(f"{m.chat.username}") + except Exception as e: + await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") + return + else: + try: + pope = await _.export_chat_invite_link(m.chat.id) + pepo = await _.revoke_chat_invite_link(m.chat.id, pope) + await call_py.join_chat(pepo.invite_link) + except UserAlreadyParticipant: + pass + except Exception as e: + return await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") chat_id = m.chat.id if len(m.command) < 2: await m.reply("» give me a live-link/m3u8 url/youtube link to stream.") From 02e452203ee4705fce7ac9e5be88b4470aa4095e Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Tue, 2 Nov 2021 15:09:17 +0700 Subject: [PATCH 07/40] forgot --- program/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/program/__init__.py b/program/__init__.py index 6ce93ac..117c511 100644 --- a/program/__init__.py +++ b/program/__init__.py @@ -3,3 +3,4 @@ __version__ = "0.6.0" # === SETUP === # BOT_ID = 0 +USERBOT_ID = 0 From b32215ca9c0c73bd2f03ddac6a7a1487c65b3352 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Tue, 2 Nov 2021 15:17:22 +0700 Subject: [PATCH 08/40] request from `mention` --- program/video.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/program/video.py b/program/video.py index e22693f..fca0b23 100644 --- a/program/video.py +++ b/program/video.py @@ -148,9 +148,10 @@ async def vplay(_, m: Message): if chat_id in QUEUE: 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})" await m.reply_photo( photo=f"{IMG_1}", - caption=f"💡 **Track added to the queue**\n\n🏷 **Name:** [{songname}]({link})\n💭 **Chat:** `{chat_id}`\n🎧 **Request by:** {m.from_user.mention()}\n🔢 **At position »** `{pos}`", + caption=f"💡 **Track added to the queue**\n\n🏷 **Name:** [{songname}]({link})\n💭 **Chat:** `{chat_id}`\n🎧 **Request by:** {requester}\n🔢 **At position »** `{pos}`", reply_markup=keyboard, ) else: @@ -171,9 +172,10 @@ async def vplay(_, m: Message): ) 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})" await m.reply_photo( photo=f"{IMG_2}", - caption=f"💡 **video streaming started.**\n\n🏷 **Name:** [{songname}]({link})\n💭 **Chat:** `{chat_id}`\n💡 **Status:** `Playing`\n🎧 **Request by:** {m.from_user.mention()}", + caption=f"💡 **video streaming started.**\n\n🏷 **Name:** [{songname}]({link})\n💭 **Chat:** `{chat_id}`\n💡 **Status:** `Playing`\n🎧 **Request by:** {requester}", reply_markup=keyboard, ) else: @@ -201,9 +203,10 @@ async def vplay(_, m: Message): chat_id, songname, ytlink, url, "Video", Q ) await loser.delete() + requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})" await m.reply_photo( photo=f"{IMG_1}", - caption=f"💡 **Track added to the queue**\n\n🏷 **Name:** [{songname}]({url})\n💭 **Chat:** `{chat_id}`\n🎧 **Request by:** {m.from_user.mention()}\n🔢 **At position »** `{pos}`", + caption=f"💡 **Track added to the queue**\n\n🏷 **Name:** [{songname}]({url})\n💭 **Chat:** `{chat_id}`\n🎧 **Request by:** {requester}\n🔢 **At position »** `{pos}`", reply_markup=keyboard, ) else: @@ -219,9 +222,10 @@ async def vplay(_, m: Message): ) 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})" await m.reply_photo( photo=f"{IMG_2}", - caption=f"💡 **video streaming started.**\n\n🏷 **Name:** [{songname}]({url})\n💭 **Chat:** `{chat_id}`\n💡 **Status:** `Playing`\n🎧 **Request by:** {m.from_user.mention()}", + caption=f"💡 **video streaming started.**\n\n🏷 **Name:** [{songname}]({url})\n💭 **Chat:** `{chat_id}`\n💡 **Status:** `Playing`\n🎧 **Request by:** {requester}", reply_markup=keyboard, ) except Exception as ep: @@ -250,9 +254,10 @@ async def vplay(_, m: Message): if chat_id in QUEUE: 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})" await m.reply_photo( photo=f"{IMG_1}", - caption=f"💡 **Track added to the queue**\n\n🏷 **Name:** [{songname}]({url})\n💭 **Chat:** `{chat_id}`\n🎧 **Request by:** {m.from_user.mention()}\n🔢 **At position »** `{pos}`", + caption=f"💡 **Track added to the queue**\n\n🏷 **Name:** [{songname}]({url})\n💭 **Chat:** `{chat_id}`\n🎧 **Request by:** {requester}\n🔢 **At position »** `{pos}`", reply_markup=keyboard, ) else: @@ -268,9 +273,10 @@ async def vplay(_, m: Message): ) 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})" await m.reply_photo( photo=f"{IMG_2}", - caption=f"💡 **video streaming started.**\n\n🏷 **Name:** [{songname}]({url})\n💭 **Chat:** `{chat_id}`\n💡 **Status:** `Playing`\n🎧 **Request by:** {m.from_user.mention()}", + caption=f"💡 **video streaming started.**\n\n🏷 **Name:** [{songname}]({url})\n💭 **Chat:** `{chat_id}`\n💡 **Status:** `Playing`\n🎧 **Request by:** {requester}", reply_markup=keyboard, ) except Exception as ep: @@ -376,9 +382,10 @@ async def vstream(_, m: Message): if chat_id in QUEUE: pos = add_to_queue(chat_id, "Live Stream", livelink, link, "Video", Q) await loser.delete() + requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})" await m.reply_photo( photo=f"{IMG_1}", - caption=f"💡 **Track added to the queue**\n\n💭 **Chat:** `{chat_id}`\n🎧 **Request by:** {m.from_user.mention()}\n🔢 **At position »** `{pos}`", + caption=f"💡 **Track added to the queue**\n\n💭 **Chat:** `{chat_id}`\n🎧 **Request by:** {requester}\n🔢 **At position »** `{pos}`", reply_markup=keyboard, ) else: @@ -400,9 +407,10 @@ async def vstream(_, m: Message): ) add_to_queue(chat_id, "Live Stream", livelink, link, "Video", Q) await loser.delete() + requester = f"[{m.from_user.first_name}](tg://user?id={m.from_user.id})" await m.reply_photo( photo=f"{IMG_2}", - caption=f"💡 **[Live stream video]({link}) started.**\n\n💭 **Chat:** `{chat_id}`\n💡 **Status:** `Playing`\n🎧 **Request by:** {m.from_user.mention()}", + caption=f"💡 **[Live stream video]({link}) started.**\n\n💭 **Chat:** `{chat_id}`\n💡 **Status:** `Playing`\n🎧 **Request by:** {requester}", reply_markup=keyboard, ) except Exception as ep: From 843ef7e5056eb0c0267277b9a737e538404dca39 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Tue, 2 Nov 2021 15:36:57 +0700 Subject: [PATCH 09/40] something --- main.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/main.py b/main.py index 02df684..afe5447 100644 --- a/main.py +++ b/main.py @@ -1,14 +1,25 @@ import asyncio +from program import BOT_ID, USERBOT_ID from driver.veez import bot, call_py from pytgcalls import idle +def all_info(bot, call_py): + global BOT_ID, USERBOT_ID + getme = bot.get_me() + getme1 = call_py.get_me() + BOT_ID = getme.id + USERBOT_ID = getme1.id + + async def mulai_bot(): print("[INFO]: STARTING BOT CLIENT") await bot.start() print("[INFO]: STARTING PYTGCALLS CLIENT") await call_py.start() + print("[INFO]: GENERATING CLIENT PROFILE") + all_info(bot, call_py) await idle() print("[INFO]: STOPPING BOT") await bot.stop() From 4d4f9e0fd1f015ab58548232af47bbb14822d668 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Tue, 2 Nov 2021 15:44:29 +0700 Subject: [PATCH 10/40] fixes --- main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index afe5447..f835a01 100644 --- a/main.py +++ b/main.py @@ -1,11 +1,11 @@ import asyncio from program import BOT_ID, USERBOT_ID -from driver.veez import bot, call_py +from driver.veez import bot, user from pytgcalls import idle -def all_info(bot, call_py): +def all_info(bot, user): global BOT_ID, USERBOT_ID getme = bot.get_me() getme1 = call_py.get_me() @@ -19,7 +19,7 @@ async def mulai_bot(): print("[INFO]: STARTING PYTGCALLS CLIENT") await call_py.start() print("[INFO]: GENERATING CLIENT PROFILE") - all_info(bot, call_py) + all_info(bot, user) await idle() print("[INFO]: STOPPING BOT") await bot.stop() From 5c62a8b669f18ddd7edfda2af8a7df072275b3c0 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Tue, 2 Nov 2021 15:51:33 +0700 Subject: [PATCH 11/40] fixes --- program/music.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/program/music.py b/program/music.py index f4a87f7..1d3c3ba 100644 --- a/program/music.py +++ b/program/music.py @@ -6,7 +6,7 @@ import re import asyncio from pyrogram import Client -from driver.veez import call_py +from driver.veez import call_py, user from program import BOT_ID, USERBOT_ID from driver.queues import QUEUE, add_to_queue from driver.filters import command, other_filters @@ -100,7 +100,7 @@ async def play(_, m: Message): except UserNotParticipant: if m.chat.username: try: - await call_py.join_chat(f"{m.chat.username}") + await user.join_chat(f"{m.chat.username}") except Exception as e: await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") return @@ -108,7 +108,7 @@ async def play(_, m: Message): try: pope = await _.export_chat_invite_link(m.chat.id) pepo = await _.revoke_chat_invite_link(m.chat.id, pope) - await call_py.join_chat(pepo.invite_link) + await user.join_chat(pepo.invite_link) except UserAlreadyParticipant: pass except Exception as e: @@ -297,7 +297,7 @@ async def stream(_, m: Message): except UserNotParticipant: if m.chat.username: try: - await call_py.join_chat(f"{m.chat.username}") + await user.join_chat(f"{m.chat.username}") except Exception as e: await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") return @@ -305,7 +305,7 @@ async def stream(_, m: Message): try: pope = await _.export_chat_invite_link(m.chat.id) pepo = await _.revoke_chat_invite_link(m.chat.id, pope) - await call_py.join_chat(pepo.invite_link) + await user.join_chat(pepo.invite_link) except UserAlreadyParticipant: pass except Exception as e: From 4e197994817063151f8da41ec03beeba071eeb31 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Tue, 2 Nov 2021 15:52:40 +0700 Subject: [PATCH 12/40] fixes --- program/video.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/program/video.py b/program/video.py index fca0b23..930b300 100644 --- a/program/video.py +++ b/program/video.py @@ -6,7 +6,7 @@ import re import asyncio from pyrogram import Client -from driver.veez import call_py +from driver.veez import call_py, user from program import BOT_ID, USERBOT_ID from driver.queues import QUEUE, add_to_queue from driver.filters import command, other_filters @@ -106,7 +106,7 @@ async def vplay(_, m: Message): except UserNotParticipant: if m.chat.username: try: - await call_py.join_chat(f"{m.chat.username}") + await user.join_chat(f"{m.chat.username}") except Exception as e: await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") return @@ -114,7 +114,7 @@ async def vplay(_, m: Message): try: pope = await _.export_chat_invite_link(m.chat.id) pepo = await _.revoke_chat_invite_link(m.chat.id, pope) - await call_py.join_chat(pepo.invite_link) + await user.join_chat(pepo.invite_link) except UserAlreadyParticipant: pass except Exception as e: @@ -332,7 +332,7 @@ async def vstream(_, m: Message): except UserNotParticipant: if m.chat.username: try: - await call_py.join_chat(f"{m.chat.username}") + await user.join_chat(f"{m.chat.username}") except Exception as e: await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") return @@ -340,7 +340,7 @@ async def vstream(_, m: Message): try: pope = await _.export_chat_invite_link(m.chat.id) pepo = await _.revoke_chat_invite_link(m.chat.id, pope) - await call_py.join_chat(pepo.invite_link) + await user.join_chat(pepo.invite_link) except UserAlreadyParticipant: pass except Exception as e: From 8688e5a816e97c6e69e9c5ab3399212b609b24a7 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Tue, 2 Nov 2021 15:59:29 +0700 Subject: [PATCH 13/40] forgot --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index f835a01..504db67 100644 --- a/main.py +++ b/main.py @@ -1,7 +1,7 @@ import asyncio from program import BOT_ID, USERBOT_ID -from driver.veez import bot, user +from driver.veez import call_py, bot, user from pytgcalls import idle From 12ce701f2d4729b74ca5d217d7284fddb2a30bf1 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Tue, 2 Nov 2021 16:12:51 +0700 Subject: [PATCH 14/40] fixes --- main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 504db67..6ee8a3b 100644 --- a/main.py +++ b/main.py @@ -8,7 +8,7 @@ from pytgcalls import idle def all_info(bot, user): global BOT_ID, USERBOT_ID getme = bot.get_me() - getme1 = call_py.get_me() + getme1 = user.get_me() BOT_ID = getme.id USERBOT_ID = getme1.id @@ -19,7 +19,7 @@ async def mulai_bot(): print("[INFO]: STARTING PYTGCALLS CLIENT") await call_py.start() print("[INFO]: GENERATING CLIENT PROFILE") - all_info(bot, user) + await all_info(bot, user) await idle() print("[INFO]: STOPPING BOT") await bot.stop() From 7ceece808fa7fe4d032c4cfd26f9a0b9fc4e66fe Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Tue, 2 Nov 2021 16:40:37 +0700 Subject: [PATCH 15/40] fixes `coroutine` object has no attribute `id` --- main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 6ee8a3b..3b8df66 100644 --- a/main.py +++ b/main.py @@ -7,8 +7,8 @@ from pytgcalls import idle def all_info(bot, user): global BOT_ID, USERBOT_ID - getme = bot.get_me() - getme1 = user.get_me() + getme = await bot.get_me() + getme1 = await user.get_me() BOT_ID = getme.id USERBOT_ID = getme1.id @@ -19,7 +19,7 @@ async def mulai_bot(): print("[INFO]: STARTING PYTGCALLS CLIENT") await call_py.start() print("[INFO]: GENERATING CLIENT PROFILE") - await all_info(bot, user) + all_info(bot, user) await idle() print("[INFO]: STOPPING BOT") await bot.stop() From aebfc7df166b9f2f36ccf053318266ba9daf7bf3 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Tue, 2 Nov 2021 16:44:17 +0700 Subject: [PATCH 16/40] forgot --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index 3b8df66..c7d1532 100644 --- a/main.py +++ b/main.py @@ -5,7 +5,7 @@ from driver.veez import call_py, bot, user from pytgcalls import idle -def all_info(bot, user): +async def all_info(bot, user): global BOT_ID, USERBOT_ID getme = await bot.get_me() getme1 = await user.get_me() From 07d5dea328fc09e09e50e5801abd9968c380fe8a Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Tue, 2 Nov 2021 16:50:46 +0700 Subject: [PATCH 17/40] finished --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index c7d1532..ff8ec60 100644 --- a/main.py +++ b/main.py @@ -19,7 +19,7 @@ async def mulai_bot(): print("[INFO]: STARTING PYTGCALLS CLIENT") await call_py.start() print("[INFO]: GENERATING CLIENT PROFILE") - all_info(bot, user) + await all_info(bot, user) await idle() print("[INFO]: STOPPING BOT") await bot.stop() From ae647915152941d285aa43324c73344162842757 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Tue, 2 Nov 2021 17:05:36 +0700 Subject: [PATCH 18/40] setup --- main.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index ff8ec60..5433d01 100644 --- a/main.py +++ b/main.py @@ -1,14 +1,14 @@ import asyncio from program import BOT_ID, USERBOT_ID -from driver.veez import call_py, bot, user +from driver.veez import call_py, bot, uber from pytgcalls import idle -async def all_info(bot, user): +async def all_info(bot, uber): global BOT_ID, USERBOT_ID getme = await bot.get_me() - getme1 = await user.get_me() + getme1 = await uber.get_me() BOT_ID = getme.id USERBOT_ID = getme1.id @@ -19,7 +19,7 @@ async def mulai_bot(): print("[INFO]: STARTING PYTGCALLS CLIENT") await call_py.start() print("[INFO]: GENERATING CLIENT PROFILE") - await all_info(bot, user) + await all_info(bot, uber) await idle() print("[INFO]: STOPPING BOT") await bot.stop() From 11df0ab0fc60d9de1463e2207e2f73d7c89e9aa7 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Tue, 2 Nov 2021 18:49:47 +0700 Subject: [PATCH 19/40] hmm --- main.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index 5433d01..ff8ec60 100644 --- a/main.py +++ b/main.py @@ -1,14 +1,14 @@ import asyncio from program import BOT_ID, USERBOT_ID -from driver.veez import call_py, bot, uber +from driver.veez import call_py, bot, user from pytgcalls import idle -async def all_info(bot, uber): +async def all_info(bot, user): global BOT_ID, USERBOT_ID getme = await bot.get_me() - getme1 = await uber.get_me() + getme1 = await user.get_me() BOT_ID = getme.id USERBOT_ID = getme1.id @@ -19,7 +19,7 @@ async def mulai_bot(): print("[INFO]: STARTING PYTGCALLS CLIENT") await call_py.start() print("[INFO]: GENERATING CLIENT PROFILE") - await all_info(bot, uber) + await all_info(bot, user) await idle() print("[INFO]: STOPPING BOT") await bot.stop() From a9d1ad4ab4c60ebfc66afb9a2c45192f5cd58a7c Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Tue, 2 Nov 2021 20:08:18 +0700 Subject: [PATCH 20/40] none --- program/__init__.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/program/__init__.py b/program/__init__.py index 117c511..906d362 100644 --- a/program/__init__.py +++ b/program/__init__.py @@ -1,6 +1 @@ __version__ = "0.6.0" - -# === SETUP === # - -BOT_ID = 0 -USERBOT_ID = 0 From 60d05b5f273121aca04045d747099be4064d0e7e Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Tue, 2 Nov 2021 20:16:31 +0700 Subject: [PATCH 21/40] some fixes --- main.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index ff8ec60..51b2189 100644 --- a/main.py +++ b/main.py @@ -1,16 +1,29 @@ import asyncio - -from program import BOT_ID, USERBOT_ID -from driver.veez import call_py, bot, user from pytgcalls import idle +from driver.veez import call_py, bot, user +BOT_ID = 0 +USERBOT_ID = 0 async def all_info(bot, user): - global BOT_ID, USERBOT_ID + global BOT_ID, BOT_NAME, BOT_USERNAME + global USERBOT_ID, USERBOT_NAME, USERBOT_MENTION, USERBOT_USERNAME getme = await bot.get_me() getme1 = await user.get_me() BOT_ID = getme.id USERBOT_ID = getme1.id + if getme.last_name: + BOT_NAME = getme.first_name + " " + getme.last_name + else: + BOT_NAME = getme.first_name + BOT_USERNAME = getme.username + USERBOT_NAME = ( + f"{getme1.first_name} {getme1.last_name}" + if getme1.last_name + else getme1.first_name + ) + USERBOT_USERNAME = getme1.username + USERBOT_MENTION = getme1.mention async def mulai_bot(): From d9f39e90ee9521cbf8e9e46318afa7690b9b23e9 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Tue, 2 Nov 2021 20:18:33 +0700 Subject: [PATCH 22/40] yt-dl issues --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index fb79f42..ce7c9e3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,6 +3,7 @@ asyncio ffmpeg-python py-tgcalls==0.8.1rc1 git+https://github.com/pyrogram/pyrogram@master +git+https://github.com/yt-dlp/yt-dlp@master youtube-search-python youtube-search httpx==0.13.3 @@ -13,4 +14,3 @@ requests psutil future wget -yt-dlp From c3a7caa27a8ef57aa496cfc08921179568f74893 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Tue, 2 Nov 2021 20:23:51 +0700 Subject: [PATCH 23/40] forgot --- program/video.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/program/video.py b/program/video.py index 930b300..357eb70 100644 --- a/program/video.py +++ b/program/video.py @@ -7,7 +7,7 @@ import asyncio from pyrogram import Client from driver.veez import call_py, user -from program import BOT_ID, USERBOT_ID +from __main__ import BOT_ID, USERBOT_ID from driver.queues import QUEUE, add_to_queue from driver.filters import command, other_filters from config import BOT_USERNAME, GROUP_SUPPORT, IMG_1, IMG_2, UPDATES_CHANNEL, ASSISTANT_NAME From 362bf7b4653e23f9508b7909edf6ca3d0133f9b8 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Tue, 2 Nov 2021 20:27:16 +0700 Subject: [PATCH 24/40] forgot --- program/music.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/program/music.py b/program/music.py index 1d3c3ba..793d4d3 100644 --- a/program/music.py +++ b/program/music.py @@ -7,7 +7,7 @@ import asyncio from pyrogram import Client from driver.veez import call_py, user -from program import BOT_ID, USERBOT_ID +from __main__ import BOT_ID, USERBOT_ID from driver.queues import QUEUE, add_to_queue from driver.filters import command, other_filters from pyrogram.errors import UserAlreadyParticipant, UserNotParticipant From b8dd1c3b9ad4f58ece7ba9e645d0e59b9b8db16f Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Tue, 2 Nov 2021 20:57:24 +0700 Subject: [PATCH 25/40] las test --- main.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/main.py b/main.py index 51b2189..dcf055d 100644 --- a/main.py +++ b/main.py @@ -3,7 +3,12 @@ from pytgcalls import idle from driver.veez import call_py, bot, user BOT_ID = 0 +BOT_NAME = "" +BOT_USERNAME = "" USERBOT_ID = 0 +USERBOT_NAME = "" +USERBOT_USERNAME = "" +USERBOT_MENTION = "" async def all_info(bot, user): global BOT_ID, BOT_NAME, BOT_USERNAME From 5c26aff8e82f694b1b63bd2d9b15f67e09cfa396 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Tue, 2 Nov 2021 21:32:50 +0700 Subject: [PATCH 26/40] none --- main.py | 34 +--------------------------------- 1 file changed, 1 insertion(+), 33 deletions(-) diff --git a/main.py b/main.py index dcf055d..99381e2 100644 --- a/main.py +++ b/main.py @@ -1,47 +1,15 @@ import asyncio from pytgcalls import idle -from driver.veez import call_py, bot, user - -BOT_ID = 0 -BOT_NAME = "" -BOT_USERNAME = "" -USERBOT_ID = 0 -USERBOT_NAME = "" -USERBOT_USERNAME = "" -USERBOT_MENTION = "" - -async def all_info(bot, user): - global BOT_ID, BOT_NAME, BOT_USERNAME - global USERBOT_ID, USERBOT_NAME, USERBOT_MENTION, USERBOT_USERNAME - getme = await bot.get_me() - getme1 = await user.get_me() - BOT_ID = getme.id - USERBOT_ID = getme1.id - if getme.last_name: - BOT_NAME = getme.first_name + " " + getme.last_name - else: - BOT_NAME = getme.first_name - BOT_USERNAME = getme.username - USERBOT_NAME = ( - f"{getme1.first_name} {getme1.last_name}" - if getme1.last_name - else getme1.first_name - ) - USERBOT_USERNAME = getme1.username - USERBOT_MENTION = getme1.mention - +from driver.veez import call_py, bot async def mulai_bot(): print("[INFO]: STARTING BOT CLIENT") await bot.start() print("[INFO]: STARTING PYTGCALLS CLIENT") await call_py.start() - print("[INFO]: GENERATING CLIENT PROFILE") - await all_info(bot, user) await idle() print("[INFO]: STOPPING BOT") await bot.stop() - loop = asyncio.get_event_loop() loop.run_until_complete(mulai_bot()) From b0cc0e014983f7a96143b644548e6e5dd7cb49c0 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Tue, 2 Nov 2021 22:05:22 +0700 Subject: [PATCH 27/40] test --- program/music.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/program/music.py b/program/music.py index 793d4d3..acf2ccb 100644 --- a/program/music.py +++ b/program/music.py @@ -6,7 +6,7 @@ import re import asyncio from pyrogram import Client -from driver.veez import call_py, user +from driver.veez import call_py, user, bot from __main__ import BOT_ID, USERBOT_ID from driver.queues import QUEUE, add_to_queue from driver.filters import command, other_filters @@ -67,8 +67,15 @@ async def play(_, m: Message): ] ) + try: + popo = await bot.get_me() + papa = popo + pepe = papa.id + except Exception as e: + await m.reply_text(f"error:\n\n{e}") + return chat_title = m.chat.title - a = await _.get_chat_member(m.chat.id, BOT_ID) + a = await _.get_chat_member(m.chat.id, pepe) if a.status != "administrator": await m.reply_text(f"💡 To use me, I need to be an **Administrator** with the following **permissions**:\n\n» ❌ __Delete messages__\n» ❌ __Ban users__\n» ❌ __Add users__\n» ❌ __Manage voice chat__\n\nData is **updated** automatically after you **promote me**") return @@ -93,7 +100,10 @@ async def play(_, m: Message): + "\n\n» ❌ __Ban users__") return try: - b = await _.get_chat_member(m.chat.id, USERBOT_ID) + uber = await user.get_me() + grab = uber + good = grab.id + b = await _.get_chat_member(m.chat.id, good) if b.status == "kicked": await m.reply_text(f"@{ASSISTANT_NAME} **is banned in group** {chat_title}\n\n» **unban the userbot first if you want to use this bot.**") return From 3e5d8b685aa881beee01aed7e3ac8eb368676c88 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Tue, 2 Nov 2021 22:10:01 +0700 Subject: [PATCH 28/40] nope --- program/music.py | 1 - 1 file changed, 1 deletion(-) diff --git a/program/music.py b/program/music.py index acf2ccb..025c2c5 100644 --- a/program/music.py +++ b/program/music.py @@ -7,7 +7,6 @@ import asyncio from pyrogram import Client from driver.veez import call_py, user, bot -from __main__ import BOT_ID, USERBOT_ID from driver.queues import QUEUE, add_to_queue from driver.filters import command, other_filters from pyrogram.errors import UserAlreadyParticipant, UserNotParticipant From bbc7519e7636c1fd72fc25a6cb07f728799abd63 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Tue, 2 Nov 2021 22:12:22 +0700 Subject: [PATCH 29/40] nope --- program/video.py | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/program/video.py b/program/video.py index 357eb70..63420e4 100644 --- a/program/video.py +++ b/program/video.py @@ -6,8 +6,7 @@ import re import asyncio from pyrogram import Client -from driver.veez import call_py, user -from __main__ import BOT_ID, USERBOT_ID +from driver.veez import call_py, user, bot from driver.queues import QUEUE, add_to_queue from driver.filters import command, other_filters from config import BOT_USERNAME, GROUP_SUPPORT, IMG_1, IMG_2, UPDATES_CHANNEL, ASSISTANT_NAME @@ -73,8 +72,15 @@ async def vplay(_, m: Message): ] ) + try: + popo = await bot.get_me() + papa = popo + pepe = papa.id + except Exception as e: + await m.reply_text(f"error:\n\n{e}") + return chat_title = m.chat.title - a = await _.get_chat_member(m.chat.id, BOT_ID) + a = await _.get_chat_member(m.chat.id, pepe) if a.status != "administrator": await m.reply_text(f"💡 To use me, I need to be an **Administrator** with the following **permissions**:\n\n» ❌ __Delete messages__\n» ❌ __Ban users__\n» ❌ __Add users__\n» ❌ __Manage voice chat__\n\nData is **updated** automatically after you **promote me**") return @@ -99,7 +105,10 @@ async def vplay(_, m: Message): + "\n\n» ❌ __Ban users__") return try: - b = await _.get_chat_member(m.chat.id, USERBOT_ID) + uber = await user.get_me() + grab = uber + good = grab.id + b = await _.get_chat_member(m.chat.id, good) if b.status == "kicked": await m.reply_text(f"@{ASSISTANT_NAME} **is banned in group** {chat_title}\n\n» **unban the userbot first if you want to use this bot.**") return @@ -299,8 +308,15 @@ async def vstream(_, m: Message): ] ) + try: + popo = await bot.get_me() + papa = popo + pepe = papa.id + except Exception as e: + await m.reply_text(f"error:\n\n{e}") + return chat_title = m.chat.title - a = await _.get_chat_member(m.chat.id, BOT_ID) + a = await _.get_chat_member(m.chat.id, pepe) if a.status != "administrator": await m.reply_text(f"💡 To use me, I need to be an **Administrator** with the following **permissions**:\n\n» ❌ __Delete messages__\n» ❌ __Ban users__\n» ❌ __Add users__\n» ❌ __Manage voice chat__\n\nData is **updated** automatically after you **promote me**") return @@ -325,7 +341,10 @@ async def vstream(_, m: Message): + "\n\n» ❌ __Ban users__") return try: - b = await _.get_chat_member(m.chat.id, USERBOT_ID) + uber = await user.get_me() + grab = uber + good = grab.id + b = await _.get_chat_member(m.chat.id, good) if b.status == "kicked": await m.reply_text(f"@{ASSISTANT_NAME} **is banned in group** {chat_title}\n\n» **unban the userbot first if you want to use this bot.**") return From d1d596018f956e4d7e63603ae721650f4ed01424 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Tue, 2 Nov 2021 22:13:04 +0700 Subject: [PATCH 30/40] nope --- program/music.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/program/music.py b/program/music.py index 025c2c5..42e8419 100644 --- a/program/music.py +++ b/program/music.py @@ -273,8 +273,15 @@ async def stream(_, m: Message): ] ) + try: + popo = await bot.get_me() + papa = popo + pepe = papa.id + except Exception as e: + await m.reply_text(f"error:\n\n{e}") + return chat_title = m.chat.title - a = await _.get_chat_member(m.chat.id, BOT_ID) + a = await _.get_chat_member(m.chat.id, pepe) if a.status != "administrator": await m.reply_text(f"💡 To use me, I need to be an **Administrator** with the following **permissions**:\n\n» ❌ __Delete messages__\n» ❌ __Ban users__\n» ❌ __Add users__\n» ❌ __Manage voice chat__\n\nData is **updated** automatically after you **promote me**") return @@ -299,7 +306,10 @@ async def stream(_, m: Message): + "\n\n» ❌ __Ban users__") return try: - b = await _.get_chat_member(m.chat.id, USERBOT_ID) + uber = await user.get_me() + grab = uber + good = grab.id + b = await _.get_chat_member(m.chat.id, good) if b.status == "kicked": await m.reply_text(f"@{ASSISTANT_NAME} **is banned in group** {chat_title}\n\n» **unban the userbot first if you want to use this bot.**") return From cfef93ec3c97ca090235ed54a882d8069c49d190 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Tue, 2 Nov 2021 22:37:44 +0700 Subject: [PATCH 31/40] test --- program/music.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/program/music.py b/program/music.py index 42e8419..f1858bf 100644 --- a/program/music.py +++ b/program/music.py @@ -74,7 +74,7 @@ async def play(_, m: Message): await m.reply_text(f"error:\n\n{e}") return chat_title = m.chat.title - a = await _.get_chat_member(m.chat.id, pepe) + a = await bot.get_chat_member(m.chat.id, pepe) if a.status != "administrator": await m.reply_text(f"💡 To use me, I need to be an **Administrator** with the following **permissions**:\n\n» ❌ __Delete messages__\n» ❌ __Ban users__\n» ❌ __Add users__\n» ❌ __Manage voice chat__\n\nData is **updated** automatically after you **promote me**") return @@ -102,7 +102,7 @@ async def play(_, m: Message): uber = await user.get_me() grab = uber good = grab.id - b = await _.get_chat_member(m.chat.id, good) + b = await bot.get_chat_member(m.chat.id, good) if b.status == "kicked": await m.reply_text(f"@{ASSISTANT_NAME} **is banned in group** {chat_title}\n\n» **unban the userbot first if you want to use this bot.**") return @@ -115,8 +115,8 @@ async def play(_, m: Message): return else: try: - pope = await _.export_chat_invite_link(m.chat.id) - pepo = await _.revoke_chat_invite_link(m.chat.id, pope) + pope = await bot.export_chat_invite_link(m.chat.id) + pepo = await bot.revoke_chat_invite_link(m.chat.id, pope) await user.join_chat(pepo.invite_link) except UserAlreadyParticipant: pass @@ -281,7 +281,7 @@ async def stream(_, m: Message): await m.reply_text(f"error:\n\n{e}") return chat_title = m.chat.title - a = await _.get_chat_member(m.chat.id, pepe) + a = await bot.get_chat_member(m.chat.id, pepe) if a.status != "administrator": await m.reply_text(f"💡 To use me, I need to be an **Administrator** with the following **permissions**:\n\n» ❌ __Delete messages__\n» ❌ __Ban users__\n» ❌ __Add users__\n» ❌ __Manage voice chat__\n\nData is **updated** automatically after you **promote me**") return @@ -309,7 +309,7 @@ async def stream(_, m: Message): uber = await user.get_me() grab = uber good = grab.id - b = await _.get_chat_member(m.chat.id, good) + b = await bot.get_chat_member(m.chat.id, good) if b.status == "kicked": await m.reply_text(f"@{ASSISTANT_NAME} **is banned in group** {chat_title}\n\n» **unban the userbot first if you want to use this bot.**") return @@ -322,8 +322,8 @@ async def stream(_, m: Message): return else: try: - pope = await _.export_chat_invite_link(m.chat.id) - pepo = await _.revoke_chat_invite_link(m.chat.id, pope) + pope = await bot.export_chat_invite_link(m.chat.id) + pepo = await bot.revoke_chat_invite_link(m.chat.id, pope) await user.join_chat(pepo.invite_link) except UserAlreadyParticipant: pass From 1cbfad8f91632692f283fae96d0bf70d4c12c5f7 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Tue, 2 Nov 2021 23:38:45 +0700 Subject: [PATCH 32/40] test --- program/music.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/program/music.py b/program/music.py index f1858bf..3c8e531 100644 --- a/program/music.py +++ b/program/music.py @@ -71,8 +71,7 @@ async def play(_, m: Message): papa = popo pepe = papa.id except Exception as e: - await m.reply_text(f"error:\n\n{e}") - return + return await m.reply_text(f"error:\n\n{e}") chat_title = m.chat.title a = await bot.get_chat_member(m.chat.id, pepe) if a.status != "administrator": @@ -278,8 +277,7 @@ async def stream(_, m: Message): papa = popo pepe = papa.id except Exception as e: - await m.reply_text(f"error:\n\n{e}") - return + return await m.reply_text(f"error:\n\n{e}") chat_title = m.chat.title a = await bot.get_chat_member(m.chat.id, pepe) if a.status != "administrator": From 53e9871b2f98a60a827840bffedfa569ace56807 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Tue, 2 Nov 2021 23:39:44 +0700 Subject: [PATCH 33/40] test --- program/video.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/program/video.py b/program/video.py index 63420e4..784c423 100644 --- a/program/video.py +++ b/program/video.py @@ -77,8 +77,7 @@ async def vplay(_, m: Message): papa = popo pepe = papa.id except Exception as e: - await m.reply_text(f"error:\n\n{e}") - return + return await m.reply_text(f"error:\n\n{e}") chat_title = m.chat.title a = await _.get_chat_member(m.chat.id, pepe) if a.status != "administrator": @@ -313,8 +312,7 @@ async def vstream(_, m: Message): papa = popo pepe = papa.id except Exception as e: - await m.reply_text(f"error:\n\n{e}") - return + return await m.reply_text(f"error:\n\n{e}") chat_title = m.chat.title a = await _.get_chat_member(m.chat.id, pepe) if a.status != "administrator": From 55f487976d91cf377880ce260a1d9e72468e95b9 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Tue, 2 Nov 2021 23:48:19 +0700 Subject: [PATCH 34/40] nope --- program/music.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/program/music.py b/program/music.py index 3c8e531..39807d9 100644 --- a/program/music.py +++ b/program/music.py @@ -70,8 +70,6 @@ async def play(_, m: Message): popo = await bot.get_me() papa = popo pepe = papa.id - except Exception as e: - return await m.reply_text(f"error:\n\n{e}") chat_title = m.chat.title a = await bot.get_chat_member(m.chat.id, pepe) if a.status != "administrator": @@ -276,8 +274,6 @@ async def stream(_, m: Message): popo = await bot.get_me() papa = popo pepe = papa.id - except Exception as e: - return await m.reply_text(f"error:\n\n{e}") chat_title = m.chat.title a = await bot.get_chat_member(m.chat.id, pepe) if a.status != "administrator": From ec6a4437be3721306177bee67c290d59775d3ac3 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Tue, 2 Nov 2021 23:50:55 +0700 Subject: [PATCH 35/40] nope --- program/video.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/program/video.py b/program/video.py index 784c423..a37475d 100644 --- a/program/video.py +++ b/program/video.py @@ -76,10 +76,8 @@ async def vplay(_, m: Message): popo = await bot.get_me() papa = popo pepe = papa.id - except Exception as e: - return await m.reply_text(f"error:\n\n{e}") chat_title = m.chat.title - a = await _.get_chat_member(m.chat.id, pepe) + a = await bot.get_chat_member(m.chat.id, pepe) if a.status != "administrator": await m.reply_text(f"💡 To use me, I need to be an **Administrator** with the following **permissions**:\n\n» ❌ __Delete messages__\n» ❌ __Ban users__\n» ❌ __Add users__\n» ❌ __Manage voice chat__\n\nData is **updated** automatically after you **promote me**") return @@ -107,7 +105,7 @@ async def vplay(_, m: Message): uber = await user.get_me() grab = uber good = grab.id - b = await _.get_chat_member(m.chat.id, good) + b = await bot.get_chat_member(m.chat.id, good) if b.status == "kicked": await m.reply_text(f"@{ASSISTANT_NAME} **is banned in group** {chat_title}\n\n» **unban the userbot first if you want to use this bot.**") return @@ -120,8 +118,8 @@ async def vplay(_, m: Message): return else: try: - pope = await _.export_chat_invite_link(m.chat.id) - pepo = await _.revoke_chat_invite_link(m.chat.id, pope) + pope = await bot.export_chat_invite_link(m.chat.id) + pepo = await bot.revoke_chat_invite_link(m.chat.id, pope) await user.join_chat(pepo.invite_link) except UserAlreadyParticipant: pass @@ -311,10 +309,8 @@ async def vstream(_, m: Message): popo = await bot.get_me() papa = popo pepe = papa.id - except Exception as e: - return await m.reply_text(f"error:\n\n{e}") chat_title = m.chat.title - a = await _.get_chat_member(m.chat.id, pepe) + a = await bot.get_chat_member(m.chat.id, pepe) if a.status != "administrator": await m.reply_text(f"💡 To use me, I need to be an **Administrator** with the following **permissions**:\n\n» ❌ __Delete messages__\n» ❌ __Ban users__\n» ❌ __Add users__\n» ❌ __Manage voice chat__\n\nData is **updated** automatically after you **promote me**") return @@ -342,7 +338,7 @@ async def vstream(_, m: Message): uber = await user.get_me() grab = uber good = grab.id - b = await _.get_chat_member(m.chat.id, good) + b = await bot.get_chat_member(m.chat.id, good) if b.status == "kicked": await m.reply_text(f"@{ASSISTANT_NAME} **is banned in group** {chat_title}\n\n» **unban the userbot first if you want to use this bot.**") return @@ -355,8 +351,8 @@ async def vstream(_, m: Message): return else: try: - pope = await _.export_chat_invite_link(m.chat.id) - pepo = await _.revoke_chat_invite_link(m.chat.id, pope) + pope = await bot.export_chat_invite_link(m.chat.id) + pepo = await bot.revoke_chat_invite_link(m.chat.id, pope) await user.join_chat(pepo.invite_link) except UserAlreadyParticipant: pass From 79cfec0d56ba628bf14adb8ed07026924b679d7a Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Tue, 2 Nov 2021 23:58:30 +0700 Subject: [PATCH 36/40] none --- program/music.py | 180 +++++++++++++++++++++++------------------------ 1 file changed, 90 insertions(+), 90 deletions(-) diff --git a/program/music.py b/program/music.py index 39807d9..d4bb736 100644 --- a/program/music.py +++ b/program/music.py @@ -70,55 +70,55 @@ async def play(_, m: Message): popo = await bot.get_me() papa = popo pepe = papa.id - chat_title = m.chat.title - a = await bot.get_chat_member(m.chat.id, pepe) - if a.status != "administrator": - await m.reply_text(f"💡 To use me, I need to be an **Administrator** with the following **permissions**:\n\n» ❌ __Delete messages__\n» ❌ __Ban users__\n» ❌ __Add users__\n» ❌ __Manage voice chat__\n\nData is **updated** automatically after you **promote me**") - return - if not a.can_manage_voice_chats: - await m.reply_text( - "missing required permission:" - + "\n\n» ❌ __Manage voice chat__") - return - if not a.can_delete_messages: - await m.reply_text( - "missing required permission:" - + "\n\n» ❌ __Delete messages__") - return - if not a.can_invite_users: - await m.reply_text( - "missing required permission:" - + "\n\n» ❌ __Add users__") - return - if not a.can_restrict_members: - await m.reply_text( - "missing required permission:" - + "\n\n» ❌ __Ban users__") - return - try: - uber = await user.get_me() - grab = uber - good = grab.id - b = await bot.get_chat_member(m.chat.id, good) - if b.status == "kicked": - await m.reply_text(f"@{ASSISTANT_NAME} **is banned in group** {chat_title}\n\n» **unban the userbot first if you want to use this bot.**") + chat_title = m.chat.title + a = await bot.get_chat_member(m.chat.id, pepe) + if a.status != "administrator": + await m.reply_text(f"💡 To use me, I need to be an **Administrator** with the following **permissions**:\n\n» ❌ __Delete messages__\n» ❌ __Ban users__\n» ❌ __Add users__\n» ❌ __Manage voice chat__\n\nData is **updated** automatically after you **promote me**") return - except UserNotParticipant: - if m.chat.username: - try: - await user.join_chat(f"{m.chat.username}") - except Exception as e: - await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") + if not a.can_manage_voice_chats: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Manage voice chat__") + return + if not a.can_delete_messages: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Delete messages__") + return + if not a.can_invite_users: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Add users__") + return + if not a.can_restrict_members: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Ban users__") + return + try: + uber = await user.get_me() + grab = uber + good = grab.id + b = await bot.get_chat_member(m.chat.id, good) + if b.status == "kicked": + await m.reply_text(f"@{ASSISTANT_NAME} **is banned in group** {chat_title}\n\n» **unban the userbot first if you want to use this bot.**") return - else: + except UserNotParticipant: + if m.chat.username: try: - pope = await bot.export_chat_invite_link(m.chat.id) - pepo = await bot.revoke_chat_invite_link(m.chat.id, pope) - await user.join_chat(pepo.invite_link) - except UserAlreadyParticipant: - pass + await user.join_chat(f"{m.chat.username}") except Exception as e: - return await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") + await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") + return + else: + try: + pope = await bot.export_chat_invite_link(m.chat.id) + pepo = await bot.revoke_chat_invite_link(m.chat.id, pope) + await user.join_chat(pepo.invite_link) + except UserAlreadyParticipant: + pass + except Exception as e: + return await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") replied = m.reply_to_message chat_id = m.chat.id if replied: @@ -274,55 +274,55 @@ async def stream(_, m: Message): popo = await bot.get_me() papa = popo pepe = papa.id - chat_title = m.chat.title - a = await bot.get_chat_member(m.chat.id, pepe) - if a.status != "administrator": - await m.reply_text(f"💡 To use me, I need to be an **Administrator** with the following **permissions**:\n\n» ❌ __Delete messages__\n» ❌ __Ban users__\n» ❌ __Add users__\n» ❌ __Manage voice chat__\n\nData is **updated** automatically after you **promote me**") - return - if not a.can_manage_voice_chats: - await m.reply_text( - "missing required permission:" - + "\n\n» ❌ __Manage voice chat__") - return - if not a.can_delete_messages: - await m.reply_text( - "missing required permission:" - + "\n\n» ❌ __Delete messages__") - return - if not a.can_invite_users: - await m.reply_text( - "missing required permission:" - + "\n\n» ❌ __Add users__") - return - if not a.can_restrict_members: - await m.reply_text( - "missing required permission:" - + "\n\n» ❌ __Ban users__") - return - try: - uber = await user.get_me() - grab = uber - good = grab.id - b = await bot.get_chat_member(m.chat.id, good) - if b.status == "kicked": - await m.reply_text(f"@{ASSISTANT_NAME} **is banned in group** {chat_title}\n\n» **unban the userbot first if you want to use this bot.**") + chat_title = m.chat.title + a = await bot.get_chat_member(m.chat.id, pepe) + if a.status != "administrator": + await m.reply_text(f"💡 To use me, I need to be an **Administrator** with the following **permissions**:\n\n» ❌ __Delete messages__\n» ❌ __Ban users__\n» ❌ __Add users__\n» ❌ __Manage voice chat__\n\nData is **updated** automatically after you **promote me**") return - except UserNotParticipant: - if m.chat.username: - try: - await user.join_chat(f"{m.chat.username}") - except Exception as e: - await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") + if not a.can_manage_voice_chats: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Manage voice chat__") + return + if not a.can_delete_messages: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Delete messages__") + return + if not a.can_invite_users: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Add users__") + return + if not a.can_restrict_members: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Ban users__") + return + try: + uber = await user.get_me() + grab = uber + good = grab.id + b = await bot.get_chat_member(m.chat.id, good) + if b.status == "kicked": + await m.reply_text(f"@{ASSISTANT_NAME} **is banned in group** {chat_title}\n\n» **unban the userbot first if you want to use this bot.**") return - else: + except UserNotParticipant: + if m.chat.username: try: - pope = await bot.export_chat_invite_link(m.chat.id) - pepo = await bot.revoke_chat_invite_link(m.chat.id, pope) - await user.join_chat(pepo.invite_link) - except UserAlreadyParticipant: - pass + await user.join_chat(f"{m.chat.username}") except Exception as e: - return await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") + await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") + return + else: + try: + pope = await bot.export_chat_invite_link(m.chat.id) + pepo = await bot.revoke_chat_invite_link(m.chat.id, pope) + await user.join_chat(pepo.invite_link) + except UserAlreadyParticipant: + pass + except Exception as e: + return await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") chat_id = m.chat.id if len(m.command) < 2: await m.reply("» give me a live-link/m3u8 url/youtube link to stream.") From 6d1c960ba6a39593326b28c4f5ff719c672ed323 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Tue, 2 Nov 2021 23:59:36 +0700 Subject: [PATCH 37/40] none --- program/video.py | 180 +++++++++++++++++++++++------------------------ 1 file changed, 90 insertions(+), 90 deletions(-) diff --git a/program/video.py b/program/video.py index a37475d..6179445 100644 --- a/program/video.py +++ b/program/video.py @@ -76,55 +76,55 @@ async def vplay(_, m: Message): popo = await bot.get_me() papa = popo pepe = papa.id - chat_title = m.chat.title - a = await bot.get_chat_member(m.chat.id, pepe) - if a.status != "administrator": - await m.reply_text(f"💡 To use me, I need to be an **Administrator** with the following **permissions**:\n\n» ❌ __Delete messages__\n» ❌ __Ban users__\n» ❌ __Add users__\n» ❌ __Manage voice chat__\n\nData is **updated** automatically after you **promote me**") - return - if not a.can_manage_voice_chats: - await m.reply_text( - "missing required permission:" - + "\n\n» ❌ __Manage voice chat__") - return - if not a.can_delete_messages: - await m.reply_text( - "missing required permission:" - + "\n\n» ❌ __Delete messages__") - return - if not a.can_invite_users: - await m.reply_text( - "missing required permission:" - + "\n\n» ❌ __Add users__") - return - if not a.can_restrict_members: - await m.reply_text( - "missing required permission:" - + "\n\n» ❌ __Ban users__") - return - try: - uber = await user.get_me() - grab = uber - good = grab.id - b = await bot.get_chat_member(m.chat.id, good) - if b.status == "kicked": - await m.reply_text(f"@{ASSISTANT_NAME} **is banned in group** {chat_title}\n\n» **unban the userbot first if you want to use this bot.**") + chat_title = m.chat.title + a = await bot.get_chat_member(m.chat.id, pepe) + if a.status != "administrator": + await m.reply_text(f"💡 To use me, I need to be an **Administrator** with the following **permissions**:\n\n» ❌ __Delete messages__\n» ❌ __Ban users__\n» ❌ __Add users__\n» ❌ __Manage voice chat__\n\nData is **updated** automatically after you **promote me**") return - except UserNotParticipant: - if m.chat.username: - try: - await user.join_chat(f"{m.chat.username}") - except Exception as e: - await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") + if not a.can_manage_voice_chats: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Manage voice chat__") + return + if not a.can_delete_messages: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Delete messages__") + return + if not a.can_invite_users: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Add users__") + return + if not a.can_restrict_members: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Ban users__") + return + try: + uber = await user.get_me() + grab = uber + good = grab.id + b = await bot.get_chat_member(m.chat.id, good) + if b.status == "kicked": + await m.reply_text(f"@{ASSISTANT_NAME} **is banned in group** {chat_title}\n\n» **unban the userbot first if you want to use this bot.**") return - else: + except UserNotParticipant: + if m.chat.username: try: - pope = await bot.export_chat_invite_link(m.chat.id) - pepo = await bot.revoke_chat_invite_link(m.chat.id, pope) - await user.join_chat(pepo.invite_link) - except UserAlreadyParticipant: - pass + await user.join_chat(f"{m.chat.username}") except Exception as e: - return await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") + await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") + return + else: + try: + pope = await bot.export_chat_invite_link(m.chat.id) + pepo = await bot.revoke_chat_invite_link(m.chat.id, pope) + await user.join_chat(pepo.invite_link) + except UserAlreadyParticipant: + pass + except Exception as e: + return await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") replied = m.reply_to_message chat_id = m.chat.id if replied: @@ -309,55 +309,55 @@ async def vstream(_, m: Message): popo = await bot.get_me() papa = popo pepe = papa.id - chat_title = m.chat.title - a = await bot.get_chat_member(m.chat.id, pepe) - if a.status != "administrator": - await m.reply_text(f"💡 To use me, I need to be an **Administrator** with the following **permissions**:\n\n» ❌ __Delete messages__\n» ❌ __Ban users__\n» ❌ __Add users__\n» ❌ __Manage voice chat__\n\nData is **updated** automatically after you **promote me**") - return - if not a.can_manage_voice_chats: - await m.reply_text( - "missing required permission:" - + "\n\n» ❌ __Manage voice chat__") - return - if not a.can_delete_messages: - await m.reply_text( - "missing required permission:" - + "\n\n» ❌ __Delete messages__") - return - if not a.can_invite_users: - await m.reply_text( - "missing required permission:" - + "\n\n» ❌ __Add users__") - return - if not a.can_restrict_members: - await m.reply_text( - "missing required permission:" - + "\n\n» ❌ __Ban users__") - return - try: - uber = await user.get_me() - grab = uber - good = grab.id - b = await bot.get_chat_member(m.chat.id, good) - if b.status == "kicked": - await m.reply_text(f"@{ASSISTANT_NAME} **is banned in group** {chat_title}\n\n» **unban the userbot first if you want to use this bot.**") + chat_title = m.chat.title + a = await bot.get_chat_member(m.chat.id, pepe) + if a.status != "administrator": + await m.reply_text(f"💡 To use me, I need to be an **Administrator** with the following **permissions**:\n\n» ❌ __Delete messages__\n» ❌ __Ban users__\n» ❌ __Add users__\n» ❌ __Manage voice chat__\n\nData is **updated** automatically after you **promote me**") return - except UserNotParticipant: - if m.chat.username: - try: - await user.join_chat(f"{m.chat.username}") - except Exception as e: - await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") + if not a.can_manage_voice_chats: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Manage voice chat__") + return + if not a.can_delete_messages: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Delete messages__") + return + if not a.can_invite_users: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Add users__") + return + if not a.can_restrict_members: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Ban users__") + return + try: + uber = await user.get_me() + grab = uber + good = grab.id + b = await bot.get_chat_member(m.chat.id, good) + if b.status == "kicked": + await m.reply_text(f"@{ASSISTANT_NAME} **is banned in group** {chat_title}\n\n» **unban the userbot first if you want to use this bot.**") return - else: + except UserNotParticipant: + if m.chat.username: try: - pope = await bot.export_chat_invite_link(m.chat.id) - pepo = await bot.revoke_chat_invite_link(m.chat.id, pope) - await user.join_chat(pepo.invite_link) - except UserAlreadyParticipant: - pass + await user.join_chat(f"{m.chat.username}") except Exception as e: - return await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") + await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") + return + else: + try: + pope = await bot.export_chat_invite_link(m.chat.id) + pepo = await bot.revoke_chat_invite_link(m.chat.id, pope) + await user.join_chat(pepo.invite_link) + except UserAlreadyParticipant: + pass + except Exception as e: + return await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") chat_id = m.chat.id if len(m.command) < 2: await m.reply("» give me a live-link/m3u8 url/youtube link to stream.") From 713e34f43d2b5cfd1645aefdf594f8cee77f3b43 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Wed, 3 Nov 2021 00:02:52 +0700 Subject: [PATCH 38/40] fixes --- program/music.py | 184 ++++++++++++++++++++++++----------------------- 1 file changed, 94 insertions(+), 90 deletions(-) diff --git a/program/music.py b/program/music.py index d4bb736..3c8e531 100644 --- a/program/music.py +++ b/program/music.py @@ -70,55 +70,57 @@ async def play(_, m: Message): popo = await bot.get_me() papa = popo pepe = papa.id - chat_title = m.chat.title - a = await bot.get_chat_member(m.chat.id, pepe) - if a.status != "administrator": - await m.reply_text(f"💡 To use me, I need to be an **Administrator** with the following **permissions**:\n\n» ❌ __Delete messages__\n» ❌ __Ban users__\n» ❌ __Add users__\n» ❌ __Manage voice chat__\n\nData is **updated** automatically after you **promote me**") + except Exception as e: + return await m.reply_text(f"error:\n\n{e}") + chat_title = m.chat.title + a = await bot.get_chat_member(m.chat.id, pepe) + if a.status != "administrator": + await m.reply_text(f"💡 To use me, I need to be an **Administrator** with the following **permissions**:\n\n» ❌ __Delete messages__\n» ❌ __Ban users__\n» ❌ __Add users__\n» ❌ __Manage voice chat__\n\nData is **updated** automatically after you **promote me**") + return + if not a.can_manage_voice_chats: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Manage voice chat__") + return + if not a.can_delete_messages: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Delete messages__") + return + if not a.can_invite_users: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Add users__") + return + if not a.can_restrict_members: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Ban users__") + return + try: + uber = await user.get_me() + grab = uber + good = grab.id + b = await bot.get_chat_member(m.chat.id, good) + if b.status == "kicked": + await m.reply_text(f"@{ASSISTANT_NAME} **is banned in group** {chat_title}\n\n» **unban the userbot first if you want to use this bot.**") return - if not a.can_manage_voice_chats: - await m.reply_text( - "missing required permission:" - + "\n\n» ❌ __Manage voice chat__") - return - if not a.can_delete_messages: - await m.reply_text( - "missing required permission:" - + "\n\n» ❌ __Delete messages__") - return - if not a.can_invite_users: - await m.reply_text( - "missing required permission:" - + "\n\n» ❌ __Add users__") - return - if not a.can_restrict_members: - await m.reply_text( - "missing required permission:" - + "\n\n» ❌ __Ban users__") - return - try: - uber = await user.get_me() - grab = uber - good = grab.id - b = await bot.get_chat_member(m.chat.id, good) - if b.status == "kicked": - await m.reply_text(f"@{ASSISTANT_NAME} **is banned in group** {chat_title}\n\n» **unban the userbot first if you want to use this bot.**") + except UserNotParticipant: + if m.chat.username: + try: + await user.join_chat(f"{m.chat.username}") + except Exception as e: + await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") return - except UserNotParticipant: - if m.chat.username: + else: try: - await user.join_chat(f"{m.chat.username}") + pope = await bot.export_chat_invite_link(m.chat.id) + pepo = await bot.revoke_chat_invite_link(m.chat.id, pope) + await user.join_chat(pepo.invite_link) + except UserAlreadyParticipant: + pass except Exception as e: - await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") - return - else: - try: - pope = await bot.export_chat_invite_link(m.chat.id) - pepo = await bot.revoke_chat_invite_link(m.chat.id, pope) - await user.join_chat(pepo.invite_link) - except UserAlreadyParticipant: - pass - except Exception as e: - return await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") + return await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") replied = m.reply_to_message chat_id = m.chat.id if replied: @@ -274,55 +276,57 @@ async def stream(_, m: Message): popo = await bot.get_me() papa = popo pepe = papa.id - chat_title = m.chat.title - a = await bot.get_chat_member(m.chat.id, pepe) - if a.status != "administrator": - await m.reply_text(f"💡 To use me, I need to be an **Administrator** with the following **permissions**:\n\n» ❌ __Delete messages__\n» ❌ __Ban users__\n» ❌ __Add users__\n» ❌ __Manage voice chat__\n\nData is **updated** automatically after you **promote me**") + except Exception as e: + return await m.reply_text(f"error:\n\n{e}") + chat_title = m.chat.title + a = await bot.get_chat_member(m.chat.id, pepe) + if a.status != "administrator": + await m.reply_text(f"💡 To use me, I need to be an **Administrator** with the following **permissions**:\n\n» ❌ __Delete messages__\n» ❌ __Ban users__\n» ❌ __Add users__\n» ❌ __Manage voice chat__\n\nData is **updated** automatically after you **promote me**") + return + if not a.can_manage_voice_chats: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Manage voice chat__") + return + if not a.can_delete_messages: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Delete messages__") + return + if not a.can_invite_users: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Add users__") + return + if not a.can_restrict_members: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Ban users__") + return + try: + uber = await user.get_me() + grab = uber + good = grab.id + b = await bot.get_chat_member(m.chat.id, good) + if b.status == "kicked": + await m.reply_text(f"@{ASSISTANT_NAME} **is banned in group** {chat_title}\n\n» **unban the userbot first if you want to use this bot.**") return - if not a.can_manage_voice_chats: - await m.reply_text( - "missing required permission:" - + "\n\n» ❌ __Manage voice chat__") - return - if not a.can_delete_messages: - await m.reply_text( - "missing required permission:" - + "\n\n» ❌ __Delete messages__") - return - if not a.can_invite_users: - await m.reply_text( - "missing required permission:" - + "\n\n» ❌ __Add users__") - return - if not a.can_restrict_members: - await m.reply_text( - "missing required permission:" - + "\n\n» ❌ __Ban users__") - return - try: - uber = await user.get_me() - grab = uber - good = grab.id - b = await bot.get_chat_member(m.chat.id, good) - if b.status == "kicked": - await m.reply_text(f"@{ASSISTANT_NAME} **is banned in group** {chat_title}\n\n» **unban the userbot first if you want to use this bot.**") + except UserNotParticipant: + if m.chat.username: + try: + await user.join_chat(f"{m.chat.username}") + except Exception as e: + await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") return - except UserNotParticipant: - if m.chat.username: + else: try: - await user.join_chat(f"{m.chat.username}") + pope = await bot.export_chat_invite_link(m.chat.id) + pepo = await bot.revoke_chat_invite_link(m.chat.id, pope) + await user.join_chat(pepo.invite_link) + except UserAlreadyParticipant: + pass except Exception as e: - await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") - return - else: - try: - pope = await bot.export_chat_invite_link(m.chat.id) - pepo = await bot.revoke_chat_invite_link(m.chat.id, pope) - await user.join_chat(pepo.invite_link) - except UserAlreadyParticipant: - pass - except Exception as e: - return await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") + return await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") chat_id = m.chat.id if len(m.command) < 2: await m.reply("» give me a live-link/m3u8 url/youtube link to stream.") From 896e592498edcc618d2d2cf0a0c90416e925f56c Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Wed, 3 Nov 2021 00:03:24 +0700 Subject: [PATCH 39/40] fixes --- program/video.py | 184 ++++++++++++++++++++++++----------------------- 1 file changed, 94 insertions(+), 90 deletions(-) diff --git a/program/video.py b/program/video.py index 6179445..784c423 100644 --- a/program/video.py +++ b/program/video.py @@ -76,55 +76,57 @@ async def vplay(_, m: Message): popo = await bot.get_me() papa = popo pepe = papa.id - chat_title = m.chat.title - a = await bot.get_chat_member(m.chat.id, pepe) - if a.status != "administrator": - await m.reply_text(f"💡 To use me, I need to be an **Administrator** with the following **permissions**:\n\n» ❌ __Delete messages__\n» ❌ __Ban users__\n» ❌ __Add users__\n» ❌ __Manage voice chat__\n\nData is **updated** automatically after you **promote me**") + except Exception as e: + return await m.reply_text(f"error:\n\n{e}") + chat_title = m.chat.title + a = await _.get_chat_member(m.chat.id, pepe) + if a.status != "administrator": + await m.reply_text(f"💡 To use me, I need to be an **Administrator** with the following **permissions**:\n\n» ❌ __Delete messages__\n» ❌ __Ban users__\n» ❌ __Add users__\n» ❌ __Manage voice chat__\n\nData is **updated** automatically after you **promote me**") + return + if not a.can_manage_voice_chats: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Manage voice chat__") + return + if not a.can_delete_messages: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Delete messages__") + return + if not a.can_invite_users: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Add users__") + return + if not a.can_restrict_members: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Ban users__") + return + try: + uber = await user.get_me() + grab = uber + good = grab.id + b = await _.get_chat_member(m.chat.id, good) + if b.status == "kicked": + await m.reply_text(f"@{ASSISTANT_NAME} **is banned in group** {chat_title}\n\n» **unban the userbot first if you want to use this bot.**") return - if not a.can_manage_voice_chats: - await m.reply_text( - "missing required permission:" - + "\n\n» ❌ __Manage voice chat__") - return - if not a.can_delete_messages: - await m.reply_text( - "missing required permission:" - + "\n\n» ❌ __Delete messages__") - return - if not a.can_invite_users: - await m.reply_text( - "missing required permission:" - + "\n\n» ❌ __Add users__") - return - if not a.can_restrict_members: - await m.reply_text( - "missing required permission:" - + "\n\n» ❌ __Ban users__") - return - try: - uber = await user.get_me() - grab = uber - good = grab.id - b = await bot.get_chat_member(m.chat.id, good) - if b.status == "kicked": - await m.reply_text(f"@{ASSISTANT_NAME} **is banned in group** {chat_title}\n\n» **unban the userbot first if you want to use this bot.**") + except UserNotParticipant: + if m.chat.username: + try: + await user.join_chat(f"{m.chat.username}") + except Exception as e: + await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") return - except UserNotParticipant: - if m.chat.username: + else: try: - await user.join_chat(f"{m.chat.username}") + pope = await _.export_chat_invite_link(m.chat.id) + pepo = await _.revoke_chat_invite_link(m.chat.id, pope) + await user.join_chat(pepo.invite_link) + except UserAlreadyParticipant: + pass except Exception as e: - await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") - return - else: - try: - pope = await bot.export_chat_invite_link(m.chat.id) - pepo = await bot.revoke_chat_invite_link(m.chat.id, pope) - await user.join_chat(pepo.invite_link) - except UserAlreadyParticipant: - pass - except Exception as e: - return await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") + return await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") replied = m.reply_to_message chat_id = m.chat.id if replied: @@ -309,55 +311,57 @@ async def vstream(_, m: Message): popo = await bot.get_me() papa = popo pepe = papa.id - chat_title = m.chat.title - a = await bot.get_chat_member(m.chat.id, pepe) - if a.status != "administrator": - await m.reply_text(f"💡 To use me, I need to be an **Administrator** with the following **permissions**:\n\n» ❌ __Delete messages__\n» ❌ __Ban users__\n» ❌ __Add users__\n» ❌ __Manage voice chat__\n\nData is **updated** automatically after you **promote me**") + except Exception as e: + return await m.reply_text(f"error:\n\n{e}") + chat_title = m.chat.title + a = await _.get_chat_member(m.chat.id, pepe) + if a.status != "administrator": + await m.reply_text(f"💡 To use me, I need to be an **Administrator** with the following **permissions**:\n\n» ❌ __Delete messages__\n» ❌ __Ban users__\n» ❌ __Add users__\n» ❌ __Manage voice chat__\n\nData is **updated** automatically after you **promote me**") + return + if not a.can_manage_voice_chats: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Manage voice chat__") + return + if not a.can_delete_messages: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Delete messages__") + return + if not a.can_invite_users: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Add users__") + return + if not a.can_restrict_members: + await m.reply_text( + "missing required permission:" + + "\n\n» ❌ __Ban users__") + return + try: + uber = await user.get_me() + grab = uber + good = grab.id + b = await _.get_chat_member(m.chat.id, good) + if b.status == "kicked": + await m.reply_text(f"@{ASSISTANT_NAME} **is banned in group** {chat_title}\n\n» **unban the userbot first if you want to use this bot.**") return - if not a.can_manage_voice_chats: - await m.reply_text( - "missing required permission:" - + "\n\n» ❌ __Manage voice chat__") - return - if not a.can_delete_messages: - await m.reply_text( - "missing required permission:" - + "\n\n» ❌ __Delete messages__") - return - if not a.can_invite_users: - await m.reply_text( - "missing required permission:" - + "\n\n» ❌ __Add users__") - return - if not a.can_restrict_members: - await m.reply_text( - "missing required permission:" - + "\n\n» ❌ __Ban users__") - return - try: - uber = await user.get_me() - grab = uber - good = grab.id - b = await bot.get_chat_member(m.chat.id, good) - if b.status == "kicked": - await m.reply_text(f"@{ASSISTANT_NAME} **is banned in group** {chat_title}\n\n» **unban the userbot first if you want to use this bot.**") + except UserNotParticipant: + if m.chat.username: + try: + await user.join_chat(f"{m.chat.username}") + except Exception as e: + await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") return - except UserNotParticipant: - if m.chat.username: + else: try: - await user.join_chat(f"{m.chat.username}") + pope = await _.export_chat_invite_link(m.chat.id) + pepo = await _.revoke_chat_invite_link(m.chat.id, pope) + await user.join_chat(pepo.invite_link) + except UserAlreadyParticipant: + pass except Exception as e: - await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") - return - else: - try: - pope = await bot.export_chat_invite_link(m.chat.id) - pepo = await bot.revoke_chat_invite_link(m.chat.id, pope) - await user.join_chat(pepo.invite_link) - except UserAlreadyParticipant: - pass - except Exception as e: - return await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") + return await m.reply_text(f"❌ **userbot failed to join**\n\n**reason**:{e}") chat_id = m.chat.id if len(m.command) < 2: await m.reply("» give me a live-link/m3u8 url/youtube link to stream.") From 2b2842e029fc88a222051d6237ee48682b6deaa5 Mon Sep 17 00:00:00 2001 From: levina <82658782+levina-lab@users.noreply.github.com> Date: Wed, 3 Nov 2021 00:05:26 +0700 Subject: [PATCH 40/40] feature info --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 954b4d5..2f1b798 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,7 @@ - YouTube/Local/Live/m3u8 stream support - Inline Search support - Control With Button support +- Userbot Auto Join ## 🛠 Commands: - `/play (query)` - play music from youtube