From 30b3c5c8baba3cc8e3cd8f11be5286d29a9aa25a Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Sat, 11 Dec 2021 20:28:18 +0530 Subject: [PATCH 01/79] Shadow Music --- ShadowMusic/Plugins/Voicechat.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/ShadowMusic/Plugins/Voicechat.py b/ShadowMusic/Plugins/Voicechat.py index 95e94ff..4e21b7c 100644 --- a/ShadowMusic/Plugins/Voicechat.py +++ b/ShadowMusic/Plugins/Voicechat.py @@ -205,3 +205,26 @@ async def baujaf(_, message): await message.reply_text(f"Failed\n**Possible reason could be**:{e}") return await message.reply_text("Left.") + +@app.on_message(filters.command(["leaveall"])) +async def bye(client, message): + if message.from_user.id in SUDOERS: + left = 0 + failed = 0 + lol = await message.reply("Assistant Leaving all chats") + async for dialog in userbot.iter_dialogs(): + try: + await userbot.leave_chat(dialog.chat.id) + left = left + 1 + await lol.edit( + f"Assistant leaving... Left: {left} chats. Failed: {failed} chats." + ) + except: + failed = failed + 1 + await lol.edit( + f"Assistant leaving... Left: {left} chats. Failed: {failed} chats." + ) + await asyncio.sleep(0.7) + await client.send_message( + message.chat.id, f"Left {left} chats. Failed {failed} chats." + ) From 7762e7a696fe8f8db3ebbf027510e3dafca4f17f Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Sat, 11 Dec 2021 20:29:41 +0530 Subject: [PATCH 02/79] Shadow Music --- ShadowMusic/Plugins/Stats.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ShadowMusic/Plugins/Stats.py b/ShadowMusic/Plugins/Stats.py index 703d13e..795c369 100644 --- a/ShadowMusic/Plugins/Stats.py +++ b/ShadowMusic/Plugins/Stats.py @@ -88,7 +88,7 @@ async def stats_markup(_, CallbackQuery): smex = f""" [โข]**System Stats** -**Yukki Uptime:** {uptime} +**{MUSIC_BOT_NAME} Uptime:** {uptime} **System Proc:** Online **Platform:** {sc} **Architecture:** {arch} From 634a49714b5e1fb0ff96b2f81fb069417fae222d Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Sat, 11 Dec 2021 20:50:37 +0530 Subject: [PATCH 03/79] Shadow Music --- ShadowMusic/Decorators/assistant.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/ShadowMusic/Decorators/assistant.py b/ShadowMusic/Decorators/assistant.py index c8a85d5..5f760b7 100644 --- a/ShadowMusic/Decorators/assistant.py +++ b/ShadowMusic/Decorators/assistant.py @@ -27,17 +27,12 @@ async def wrapper(_, message): return else: try: - invitelink = await app.export_chat_invite_link( - message.chat.id - ) - if invitelink.startswith("https://t.me/+"): - invitelink = invitelink.replace( - "https://t.me/+", "https://t.me/joinchat/" - ) - await userbot.join_chat(invitelink) - await message.reply( - f"{ASSMENTION} Joined Successfully", - ) + xxy = await app.export_chat_invite_link(message.chat.id) + inv_lnk = str(xxy) + inv_lnk = inv_lnk.replace("https://t.me/+","https://t.me/joinchat/") + await asyncio.sleep(10) + await userbot.join_chat(inv_lnk) + await message.reply(f"{ASSNAME} Joined Successfully") except UserAlreadyParticipant: pass except Exception as e: From f5a8509c67db23ebac3c68dbc430a2d654e0e07b Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Sat, 11 Dec 2021 20:53:57 +0530 Subject: [PATCH 04/79] Shadow Music --- ShadowMusic/Decorators/assistant.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ShadowMusic/Decorators/assistant.py b/ShadowMusic/Decorators/assistant.py index 5f760b7..28c4745 100644 --- a/ShadowMusic/Decorators/assistant.py +++ b/ShadowMusic/Decorators/assistant.py @@ -1,3 +1,5 @@ +import asyncio + from typing import Dict, List, Union from pyrogram.errors import UserAlreadyParticipant, UserNotParticipant From 389079d0bfeed621e125d48fadb93fd5a60f323e Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Sat, 11 Dec 2021 21:06:19 +0530 Subject: [PATCH 05/79] Shadow Music --- ShadowMusic/Plugins/Callback.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ShadowMusic/Plugins/Callback.py b/ShadowMusic/Plugins/Callback.py index bc07ae2..5eed238 100644 --- a/ShadowMusic/Plugins/Callback.py +++ b/ShadowMusic/Plugins/Callback.py @@ -480,7 +480,7 @@ async def check_playlist(_, CallbackQuery): msg = f"Fetched Playlist:\n\n" for deshadeeththisarana in _playlist: j += 1 - _note = await get_playlist(user_id, shikhar, genre) + _note = await get_playlist(user_id, deshadeeththisarana, genre) title = _note["title"] duration = _note["duration"] msg += f"{j}- {title[:60]}\n" From 92bfb7549056561b352034b03f1cf29823c38ebd Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Sat, 11 Dec 2021 21:16:20 +0530 Subject: [PATCH 06/79] Shadow Music --- ShadowMusic/Plugins/Callback.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ShadowMusic/Plugins/Callback.py b/ShadowMusic/Plugins/Callback.py index 5eed238..1a46a26 100644 --- a/ShadowMusic/Plugins/Callback.py +++ b/ShadowMusic/Plugins/Callback.py @@ -279,7 +279,7 @@ async def play_playlist(_, CallbackQuery): for_t = 0 for_p = 0 for deshadeeththisarana in _playlist: - _note = await get_playlist(user_id, shikhar, type) + _note = await get_playlist(user_id, deshadeeththisarana, type) title = _note["title"] videoid = _note["videoid"] url = f"https://www.youtube.com/watch?v={videoid}" @@ -535,7 +535,7 @@ async def del_playlist(_, CallbackQuery): await CallbackQuery.message.delete() await CallbackQuery.answer() for deshadeeththisarana in _playlist: - await delete_playlist(user_id, shikhar, genre) + await delete_playlist(user_id, deshadeeththisarana, genre) await CallbackQuery.message.reply_text( f"Successfully deleted {type}'s {genre} whole playlist\n\nBy :- {CallbackQuery.from_user.mention}" ) From b1dacbd3ef722057cbca2effd3bdfc679d6cdf4f Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Sat, 11 Dec 2021 22:06:37 +0530 Subject: [PATCH 07/79] Shadow Music --- ShadowMusic/Utilities/stream.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ShadowMusic/Utilities/stream.py b/ShadowMusic/Utilities/stream.py index ac22c5c..4b16121 100644 --- a/ShadowMusic/Utilities/stream.py +++ b/ShadowMusic/Utilities/stream.py @@ -54,7 +54,7 @@ async def start_stream( to_append = [title, user, duration] got_queue.append(to_append) final_output = await CallbackQuery.message.reply_photo( - photo=thumb, + photo="Utils/Queue.png", caption=( f"๐ฌ__Song:__ [{title[:25]}](https://www.youtube.com/watch?v={videoid}) \nโณ__Duration:__ {duration_min} \n๐ก__Info:__ [Get Additional Information](https://t.me/{BOT_USERNAME}?start=info_{videoid})\n๐ค__Requested by:__ {CallbackQuery.from_user.mention} \n๐ง__Queued at:__ #{position}!" ), @@ -135,7 +135,7 @@ async def start_stream_audio( to_append = [title, user, duration] got_queue.append(to_append) final_output = await message.reply_photo( - photo="Utils/Telegram.JPEG", + photo="Utils/Audio.png", caption=( f"๐ฌ__Audio:__ [Given Audio Via Telegram]({link})\nโณ__Duration:__ {duration_min} \n๐ค__Requested by:__ {message.from_user.mention} \n๐ง__Queued at:__ #{position}!" ), @@ -174,7 +174,7 @@ async def start_stream_audio( await mystic.delete() cap = f"๐ฅ__Playing:__ [Given Audio Via Telegram]({link})\n๐ค**__Requested by:__** {message.from_user.mention}" final_output = await message.reply_photo( - photo="Utils/Telegram.JPEG", + photo="Utils/Audio.png", reply_markup=InlineKeyboardMarkup(buttons), caption=cap, ) From 9a8f63a966545878e257d74f00dbfbd498f92cca Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Sat, 11 Dec 2021 22:17:54 +0530 Subject: [PATCH 08/79] Shadow Music --- ShadowMusic/Utilities/stream.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ShadowMusic/Utilities/stream.py b/ShadowMusic/Utilities/stream.py index 4b16121..a19e5e6 100644 --- a/ShadowMusic/Utilities/stream.py +++ b/ShadowMusic/Utilities/stream.py @@ -10,9 +10,9 @@ from ShadowMusic import BOT_USERNAME, db_mem from ShadowMusic.Core.PyTgCalls import Queues, Shadow from ShadowMusic.Database import (add_active_chat, is_active_chat, music_off, - music_on) + music_on) from ShadowMusic.Inline import (audio_markup, audio_markup2, primary_markup, - secondary_markup) + secondary_markup) from ShadowMusic.Utilities.timer import start_timer loop = asyncio.get_event_loop() @@ -163,6 +163,8 @@ async def start_stream_audio( got_queue = get_queue.get(message.chat.id) title = title user = message.from_user.first_name + chat_id = message.chat.id + user_id = message.from_user.id duration = duration_min to_append = [title, user, duration] got_queue.append(to_append) @@ -183,8 +185,8 @@ async def start_stream_audio( duration_min, duration_sec, final_output, - CallbackQuery.message.chat.id, - CallbackQuery.from_user.id, + chat_id, + user_id, 1, ) From e6d30fa551c9ff9e931a14c979f2326b3807b528 Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Fri, 17 Dec 2021 12:42:03 +0530 Subject: [PATCH 09/79] Shadow Music --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 7a9ebdf..593085f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,7 @@ aiofiles asyncio ffmpeg-python Pillow -git+https://github.com/pyrogram/pyrogram@master +pyrogram==1.2.20 hachoir lyricsgenius py-tgcalls From 6f82c60fb407aa4ba6f2c1f4913e03d269dbf4b8 Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Sun, 19 Dec 2021 15:52:08 +0530 Subject: [PATCH 10/79] Update requirements.txt --- requirements.txt | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/requirements.txt b/requirements.txt index 593085f..dd2251f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,21 +2,20 @@ aiohttp aiofiles asyncio ffmpeg-python -Pillow -pyrogram==1.2.20 +pillow +pyrogram hachoir lyricsgenius -py-tgcalls +py-tgcalls==0.8.1 wget python-dotenv -youtube_search_python -youtube_search +youtube-search-python +youtube-search speedtest-cli motor psutil requests rich dnspython -git+https://github.com/Sorrybabe/downloader -pymongo[srv] -TgCrypto +yt-dlp==2021.11.10.1 +tgcrypto From e29c0536f42031414a2f98d4b972360d0181910a Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Sun, 19 Dec 2021 15:53:42 +0530 Subject: [PATCH 11/79] Shadow Music\ --- config.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/config.py b/config.py index c882cc2..50f3f94 100644 --- a/config.py +++ b/config.py @@ -1,4 +1,5 @@ from os import getenv + from dotenv import load_dotenv load_dotenv() @@ -6,7 +7,11 @@ # VARS get_queue = {} -STRING = getenv("STRING_SESSION", "session") +STRING1 = getenv("STRING_SESSION1", "session") +STRING2 = getenv("STRING_SESSION2", "session") +STRING3 = getenv("STRING_SESSION3", "session") +STRING4 = getenv("STRING_SESSION4", "session") +STRING5 = getenv("STRING_SESSION5", "session") BOT_TOKEN = getenv("BOT_TOKEN") API_ID = int(getenv("API_ID", "")) API_HASH = getenv("API_HASH") @@ -17,7 +22,6 @@ OWNER_ID = list(map(int, getenv("OWNER_ID", "").split())) LOG_GROUP_ID = int(getenv("LOG_GROUP_ID", "")) MUSIC_BOT_NAME = getenv("MUSIC_BOT_NAME") - if str(getenv("SUPPORT_CHANNEL")).strip() == "": SUPPORT_CHANNEL = None else: From a8faf36a518c4e474e1d4add84e33fe6ea49bf8c Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Sun, 19 Dec 2021 15:54:44 +0530 Subject: [PATCH 12/79] Shadow Music --- app.json | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/app.json b/app.json index efa5f1c..2450f33 100644 --- a/app.json +++ b/app.json @@ -65,11 +65,31 @@ "value": "", "required": true }, - "STRING_SESSION": { - "description": "A Pyrogram String Session.", + "STRING_SESSION1": { + "description": "A Pyrogram String Session of Assistant Account.", "value": "", "required": true }, + "STRING_SESSION2": { + "description": "A Pyrogram String Session of Assistant Account.", + "value": "", + "required": false + }, + "STRING_SESSION3": { + "description": "A Pyrogram String Session of Assistant Account.", + "value": "", + "required": false + }, + "STRING_SESSION4": { + "description": "A Pyrogram String Session of Assistant Account.", + "value": "", + "required": false + }, + "STRING_SESSION5": { + "description": "A Pyrogram String Session of Assistant Account.", + "value": "", + "required": false + }, "LOG_GROUP_ID": { "description": "Your Log Group ID, add your bot and promote as an admin with full rights!. Use only Group. Please don't use Channel ID.", "value": "", From 0ccb99b59b290e8ff7b05b24608ef637cf08a11f Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Sun, 19 Dec 2021 15:55:40 +0530 Subject: [PATCH 13/79] Shadow Music From f78f065aeb3d7191f0ced5117bfdb75ee254624f Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Sun, 19 Dec 2021 15:56:25 +0530 Subject: [PATCH 14/79] Shadow Music --- .dockerignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.dockerignore b/.dockerignore index db2c5c5..dfd6569 100644 --- a/.dockerignore +++ b/.dockerignore @@ -10,4 +10,3 @@ raw_files/ .gitignore runtime.txt __pycache__/ - From 274528008c712d102d9bbd7e38d5720f3756aa47 Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Sun, 19 Dec 2021 16:11:33 +0530 Subject: [PATCH 15/79] Shadow Music --- ShadowMusic/__main__.py | 159 ++++++++++++++++++++++++++++------------ 1 file changed, 114 insertions(+), 45 deletions(-) diff --git a/ShadowMusic/__main__.py b/ShadowMusic/__main__.py index 854e26c..d92fd83 100644 --- a/ShadowMusic/__main__.py +++ b/ShadowMusic/__main__.py @@ -3,18 +3,21 @@ import os import re -from config import LOG_GROUP_ID from pyrogram import filters from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup +from pytgcalls import idle from rich.console import Console from rich.table import Table from youtubesearchpython import VideosSearch -from ShadowMusic import (ASSID, ASSMENTION, ASSNAME, ASSUSERNAME, BOT_ID, BOT_NAME, - BOT_USERNAME, SUDOERS, app, db, pymongodb, userbot) +from config import LOG_GROUP_ID +from ShadowMusic import (ASS_CLI_1, ASS_CLI_2, ASS_CLI_3, ASS_CLI_4, ASS_CLI_5, + ASSID1, ASSID2, ASSID3, ASSID4, ASSID5, ASSNAME1, ASSNAME2, + ASSNAME3, ASSNAME4, ASSNAME5, BOT_ID, BOT_NAME, app) from ShadowMusic.Core.Logger.Log import (startup_delete_last, startup_edit_last, - startup_send_new) -from ShadowMusic.Core.PyTgCalls.Shadow import run + startup_send_new) +from ShadowMusic.Core.PyTgCalls.Yukki import (pytgcalls1, pytgcalls2, pytgcalls3, + pytgcalls4, pytgcalls5) from ShadowMusic.Database import get_active_chats, get_sudoers, remove_active_chat from ShadowMusic.Inline import private_panel from ShadowMusic.Plugins import ALL_MODULES @@ -27,7 +30,7 @@ async def initiate_bot(): with console.status( - "[magenta] Booting up The ShadowMusic...", + "[magenta] Booting up The ShadowMusic Bot...", ) as status: console.print("โ [red]Clearing MongoDB cache...") try: @@ -83,7 +86,7 @@ async def initiate_bot(): try: await app.send_message( LOG_GROUP_ID, - "Congrats!! ShadowMusic has started successfully!", + "โ ShadowMusic has started successfully!", ) except Exception as e: print( @@ -97,42 +100,113 @@ async def initiate_bot(): console.print(f"\n[red]Stopping Bot") return try: - await userbot.send_message( + await ASS_CLI_1.send_message( + LOG_GROUP_ID, + "โ Assistant Client 1๏ธโฃ successfully!", + ) + except Exception as e: + print( + "Assistant Account 1 has failed to access the log Channel. Make sure that you have added your Assistant to your log channel and promoted as admin!" + ) + console.print(f"\n[red]Stopping Bot") + return + try: + await ASS_CLI_1.join_chat("ShadowSupport_Official") + await ASS_CLI_1.join_chat("ShadowBotUpdates") + except: + pass + try: + await ASS_CLI_2.send_message( + LOG_GROUP_ID, + "โ Assistant Client 2๏ธโฃ successfully!", + ) + except Exception as e: + print( + "Assistant Account 2 has failed to access the log Channel. Make sure that you have added your Assistant to your log channel and promoted as admin!" + ) + console.print(f"\n[red]Stopping Bot") + return + try: + await ASS_CLI_2.join_chat("ShadowSupport_Official") + await ASS_CLI_2.join_chat("ShadowBotUpdates") + except: + pass + try: + await ASS_CLI_3.send_message( + LOG_GROUP_ID, + "โ Assistant Client 3๏ธโฃ successfully!", + ) + except Exception as e: + print( + "Assistant Account 3 has failed to access the log Channel. Make sure that you have added your Assistant to your log channel and promoted as admin!" + ) + console.print(f"\n[red]Stopping Bot") + return + try: + await ASS_CLI_3.join_chat("ShadowSupport_Official") + await ASS_CLI_3.join_chat("ShadowBotUpdates") + except: + pass + try: + await ASS_CLI_4.send_message( LOG_GROUP_ID, - "Congrats!! Assistant has started successfully!", + "โ Assistant Client 4๏ธโฃ successfully!", ) except Exception as e: print( - "Assistant Account has failed to access the log Channel. Make sure that you have added your bot to your log channel and promoted as admin!" + "Assistant Account 4 has failed to access the log Channel. Make sure that you have added your Assistant to your log channel and promoted as admin!" ) console.print(f"\n[red]Stopping Bot") return try: - await userbot.join_chat("ShadowBotUpdates") + await ASS_CLI_4.join_chat("ShadowSupport_Official") + await ASS_CLI_4.join_chat("ShadowBotUpdates") except: pass try: - await userbot.join_chat("ShadowSupport_Official") + await ASS_CLI_5.send_message( + LOG_GROUP_ID, + "โ Assistant Client 5๏ธโฃ successfully!", + ) + except Exception as e: + print( + "Assistant Account 5 has failed to access the log Channel. Make sure that you have added your Assistant to your log channel and promoted as admin!" + ) + console.print(f"\n[red]Stopping Bot") + return + try: + await ASS_CLI_5.join_chat("ShadowSupport_Official") + await ASS_CLI_5.join_chat("ShadowBotUpdates") except: - pass - + pass console.print(f"\nโ[red] Bot Started as {BOT_NAME}!") console.print(f"โ[green] ID :- {BOT_ID}!") - console.print(f"โ[red] Assistant Started as {ASSNAME}!") - console.print(f"โ[green] ID :- {ASSID}!") - await run() + console.print(f"โ[red] Assistant 1 Started as {ASSNAME1}!") + console.print(f"โ[green] ID :- {ASSID1}!") + console.print(f"โ[red] Assistant 2 Started as {ASSNAME2}!") + console.print(f"โ[green] ID :- {ASSID2}!") + console.print(f"โ[red] Assistant 3 Started as {ASSNAME3}!") + console.print(f"โ[green] ID :- {ASSID3}!") + console.print(f"โ[red] Assistant 4 Started as {ASSNAME4}!") + console.print(f"โ[green] ID :- {ASSID4}!") + console.print(f"โ[red] Assistant 5 Started as {ASSNAME5}!") + console.print(f"โ[green] ID :- {ASSID5}!") + await pytgcalls1.start() + await pytgcalls2.start() + await pytgcalls3.start() + await pytgcalls4.start() + await pytgcalls5.start() + await idle() console.print(f"\n[red]Stopping Bot") home_text_pm = f"""Hello , My name is {BOT_NAME}. - I'm Telegram Voice Chat Audio with some useful features. - All commands can be used with: / """ -@app.on_message(filters.command("help") & filters.private) +@app.on_message(filters.command("vchelp") & filters.private) async def help_command(_, message): text, keyboard = await help_parser(message.from_user.mention) await app.send_message(message.chat.id, text, reply_markup=keyboard) @@ -140,17 +214,11 @@ async def help_command(_, message): @app.on_message(filters.command("start") & filters.private) async def start_command(_, message): - if len(message.text.split()) == 1: - out = private_panel() - await message.reply_text( - home_text_pm, - reply_markup=InlineKeyboardMarkup(out[1]), - ) if len(message.text.split()) > 1: name = (message.text.split(None, 1)[1]).lower() if name[0] == "s": sudoers = await get_sudoers() - text = "**__Sudo Users List of Bot:-__**\n\n" + text = "**__Sudo Users List of ShadowMusic:-__**\n\n" j = 0 for count, user_id in enumerate(sudoers, 1): try: @@ -166,14 +234,14 @@ async def start_command(_, message): await message.reply_text("No Sudo Users") else: await message.reply_text(text) - if name == "help": - text, keyboard = await help_parser(message.from_user.mention) - await message.delete() - return await app.send_text( - message.chat.id, - text, - reply_markup=keyboard, - ) + #if name == "help": + # text, keyboard = await help_parser(message.from_user.mention) + # await message.delete() + # return await app.send_text( + # message.chat.id, + # text, + # reply_markup=keyboard, + # ) if name[0] == "i": m = await message.reply_text("๐ Fetching Info...!") query = (str(name)).replace("info_", "", 1) @@ -221,7 +289,11 @@ async def start_command(_, message): parse_mode="markdown", reply_markup=key, ) - return + #out = private_panel() + return #await message.reply_text( + #home_text_pm, + #reply_markup=InlineKeyboardMarkup(out[1]), + #) async def help_parser(name, keyboard=None): @@ -229,7 +301,7 @@ async def help_parser(name, keyboard=None): keyboard = InlineKeyboardMarkup(paginate_modules(0, HELPABLE, "help")) return ( """Hello {first_name}, - + Click on the buttons for more information. All commands can be used with: / @@ -255,9 +327,7 @@ async def help_button(client, query): back_match = re.match(r"help_back", query.data) create_match = re.match(r"help_create", query.data) top_text = f"""Hello {query.from_user.first_name}, - Click on the buttons for more information. - All commands can be used with: / """ if mod_match: @@ -281,11 +351,11 @@ async def help_button(client, query): ] ) - await query.message.edit( - text=text, - reply_markup=key, - disable_web_page_preview=True, - ) + #await query.message.edit( + # text=text, + # reply_markup=key, + # disable_web_page_preview=True, + #) elif home_match: out = private_panel() await app.send_message( @@ -336,4 +406,3 @@ async def help_button(client, query): if __name__ == "__main__": loop.run_until_complete(initiate_bot()) - From 42a63eee152dcffbf25045f595619436248404d9 Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Sun, 19 Dec 2021 16:16:41 +0530 Subject: [PATCH 16/79] Shadow Music --- ShadowMusic/__init__.py | 171 ++++++++++++++++++++++++++-------------- 1 file changed, 111 insertions(+), 60 deletions(-) diff --git a/ShadowMusic/__init__.py b/ShadowMusic/__init__.py index 32dc4a4..d2755b4 100644 --- a/ShadowMusic/__init__.py +++ b/ShadowMusic/__init__.py @@ -4,18 +4,17 @@ from os import listdir, mkdir from aiohttp import ClientSession -from config import ASSISTANT_PREFIX, DURATION_LIMIT_MIN, LOG_GROUP_ID -from config import MONGO_DB_URI as mango -from config import MUSIC_BOT_NAME, OWNER_ID, SUDO_USERS, get_queue from motor.motor_asyncio import AsyncIOMotorClient as Bot -from pymongo import MongoClient -from pymongo.errors import ConnectionFailure from rich.console import Console from rich.table import Table -from ShadowMusic.Core.Clients.cli import app, userbot +from config import ASSISTANT_PREFIX, DURATION_LIMIT_MIN, LOG_GROUP_ID +from config import MONGO_DB_URI as mango +from config import MUSIC_BOT_NAME, OWNER_ID, SUDO_USERS, get_queue +from ShadowMusic.Core.Clients.cli import (ASS_CLI_1, ASS_CLI_2, ASS_CLI_3, + ASS_CLI_4, ASS_CLI_5, app) from ShadowMusic.Core.Logger.Log import (startup_delete_last, startup_edit_last, - startup_send_new) + startup_send_new) from ShadowMusic.Utilities.changers import time_to_seconds loop = asyncio.get_event_loop() @@ -28,14 +27,17 @@ ### Mongo DB MONGODB_CLI = Bot(mango) db = MONGODB_CLI.ShadowMusic -pymongodb = "" ### Boot Time boottime = time.time() ### Clients app = app -userbot = userbot +ASS_CLI_1 = ASS_CLI_1 +ASS_CLI_2 = ASS_CLI_2 +ASS_CLI_3 = ASS_CLI_3 +ASS_CLI_4 = ASS_CLI_4 +ASS_CLI_5 = ASS_CLI_5 aiohttpsession = ClientSession() ### Config @@ -52,16 +54,36 @@ BOT_USERNAME = "" ### Assistant Info -ASSID = 0 -ASSNAME = "" -ASSUSERNAME = "" -ASSMENTION = "" +ASSID1 = 0 +ASSNAME1 = "" +ASSUSERNAME1 = "" +ASSMENTION1 = "" +ASSID2 = 0 +ASSNAME2 = "" +ASSUSERNAME2 = "" +ASSMENTION2 = "" +ASSID3 = 0 +ASSNAME3 = "" +ASSUSERNAME3 = "" +ASSMENTION3 = "" +ASSID4 = 0 +ASSNAME4 = "" +ASSUSERNAME4 = "" +ASSMENTION4 = "" +ASSID5 = 0 +ASSNAME5 = "" +ASSUSERNAME5 = "" +ASSMENTION5 = "" async def initiate_bot(): - global pymongodb, SUDOERS, Imp_Modules, OWNER_ID + global SUDOERS, Imp_Modules, OWNER_ID global BOT_ID, BOT_NAME, BOT_USERNAME - global ASSID, ASSNAME, ASSMENTION, ASSUSERNAME + global ASSID1, ASSNAME1, ASSMENTION1, ASSUSERNAME1 + global ASSID2, ASSNAME2, ASSMENTION2, ASSUSERNAME2 + global ASSID3, ASSNAME3, ASSMENTION3, ASSUSERNAME3 + global ASSID4, ASSNAME4, ASSMENTION4, ASSUSERNAME4 + global ASSID5, ASSNAME5, ASSMENTION5, ASSUSERNAME5 os.system("clear") header = Table(show_header=True, header_style="bold yellow") header.add_column( @@ -73,9 +95,21 @@ async def initiate_bot(): ) as status: console.print("โ [red]Booting Up The Clients...\n") await app.start() - await userbot.start() - console.print("โ [green]Clients Booted Successfully!") - initial = await startup_send_new("Starting ShadowMusic...") + console.print("โ [green]Booted Bot Client") + console.print("\nโ [red]Booting Up The Assistant Clients...") + await ASS_CLI_1.start() + console.print("โ [yellow]Booted Assistant Client 1") + await ASS_CLI_2.start() + console.print("โ [yellow]Booted Assistant Client 2") + await ASS_CLI_3.start() + console.print("โ [yellow]Booted Assistant Client 3") + await ASS_CLI_4.start() + console.print("โ [yellow]Booted Assistant Client 4") + await ASS_CLI_5.start() + console.print("โ [yellow]Booted Assistant Client 5") + await asyncio.sleep(0.5) + console.print("โ [green]Assistant Clients Booted Successfully!") + initial = await startup_send_new("Starting ShadowMusic Bot...") await asyncio.sleep(0.5) all_over = await startup_send_new("Checking Required Directories...") console.print( @@ -90,66 +124,74 @@ async def initiate_bot(): if "search" not in listdir(): mkdir("search") console.print("โ [green]Directories Updated!") - okbhai = await startup_edit_last(all_over, "Checking Database...") - await asyncio.sleep(2) - console.print("\nโ [red]Checking the existence of Database...") - if mango == "": - status.update(status="[bold red] Failed to boot ShadowMusic!") - console.print( - "[bold yellow]\nWARNING! DATABASE URL NOT FOUND!!\n\nExiting all processes with SIGTERM..." - ) - return - console.print("โ [green]Database found!") - __ = await startup_edit_last(okbhai, "Validating Database...") - await asyncio.sleep(0.7) - console.print("โ [yellow]Validating Database...") - if not mango.endswith("=majority"): - status.update(status="[bold red] Failed to boot ShadowMusic!") - console.print( - "[bold yellow]\nWARNING! INVALID DATABASE URL! USE ONLY MONGO DB URL!!\n\nExiting all processes with SIGTERM..." - ) - return - try: - smex = MongoClient(mango, port=27017) - except: - status.update(status="[bold red] Failed to boot ShadowMusic!") - console.print( - "[bold yellow] I hate it to say but something is wrong with your database url :(\ntry rechecking it or replace it with a new one.\n\nExiting all processes with SIGTERM..." - ) - return - pymongodb = smex.ShadowMusic - await asyncio.sleep(2) - console.print("โ [green]Database Validation Successful!") await asyncio.sleep(0.9) - ___ = await startup_edit_last(__, "Refurbishing Necessary Data...") + ___ = await startup_edit_last( + all_over, "Refurbishing Necessary Data..." + ) console.print("\nโ [red]Refurbishing Necessities...") getme = await app.get_me() - getme1 = await userbot.get_me() + getme1 = await ASS_CLI_1.get_me() + getme2 = await ASS_CLI_2.get_me() + getme3 = await ASS_CLI_3.get_me() + getme4 = await ASS_CLI_4.get_me() + getme5 = await ASS_CLI_5.get_me() BOT_ID = getme.id - ASSID = getme1.id + ASSID1 = getme1.id + ASSID2 = getme2.id + ASSID3 = getme3.id + ASSID4 = getme4.id + ASSID5 = getme5.id if getme.last_name: BOT_NAME = getme.first_name + " " + getme.last_name else: BOT_NAME = getme.first_name BOT_USERNAME = getme.username - ASSNAME = ( + ASSNAME1 = ( f"{getme1.first_name} {getme1.last_name}" if getme1.last_name else getme1.first_name ) - ASSUSERNAME = getme1.username - ASSMENTION = getme1.mention + ASSUSERNAME1 = getme1.username + ASSMENTION1 = getme1.mention + ASSNAME2 = ( + f"{getme2.first_name} {getme2.last_name}" + if getme2.last_name + else getme2.first_name + ) + ASSUSERNAME2 = getme2.username + ASSMENTION2 = getme2.mention + ASSNAME3 = ( + f"{getme3.first_name} {getme3.last_name}" + if getme3.last_name + else getme3.first_name + ) + ASSUSERNAME3 = getme3.username + ASSMENTION3 = getme3.mention + ASSNAME4 = ( + f"{getme4.first_name} {getme4.last_name}" + if getme4.last_name + else getme4.first_name + ) + ASSUSERNAME4 = getme4.username + ASSMENTION4 = getme4.mention + ASSNAME5 = ( + f"{getme5.first_name} {getme5.last_name}" + if getme5.last_name + else getme5.first_name + ) + ASSUSERNAME5 = getme5.username + ASSMENTION5 = getme5.mention console.print("โ [green]Refurbished Successfully!") await asyncio.sleep(0.9) ____ok = await startup_edit_last(___, "Loading Sudo Users...") console.print("\nโ [red]Loading Sudo Users...") - sudoersdb = pymongodb.sudoers - sudoers = sudoersdb.find_one({"sudo": "sudo"}) + sudoersdb = db.sudoers + sudoers = await sudoersdb.find_one({"sudo": "sudo"}) sudoers = [] if not sudoers else sudoers["sudoers"] for user_id in SUDOERS: if user_id not in sudoers: sudoers.append(user_id) - sudoersdb.update_one( + await sudoersdb.update_one( {"sudo": "sudo"}, {"$set": {"sudoers": sudoers}}, upsert=True, @@ -163,8 +205,18 @@ async def initiate_bot(): loop.run_until_complete(initiate_bot()) -if ASSID not in SUDOERS: - SUDOERS.append(ASSID) +ASSIDS = [] + +if ASSID1 not in ASSIDS: + ASSIDS.append(ASSID1) +if ASSID2 not in ASSIDS: + ASSIDS.append(ASSID2) +if ASSID3 not in ASSIDS: + ASSIDS.append(ASSID3) +if ASSID4 not in ASSIDS: + ASSIDS.append(ASSID4) +if ASSID5 not in ASSIDS: + ASSIDS.append(ASSID5) def init_db(): @@ -173,4 +225,3 @@ def init_db(): init_db() - From 1638d81f70038ce692bbb0dee9ab6d5ee90582d5 Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Sun, 19 Dec 2021 16:18:04 +0530 Subject: [PATCH 17/79] Shadow Music --- ShadowMusic/Core/Clients/cli.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ShadowMusic/Core/Clients/cli.py b/ShadowMusic/Core/Clients/cli.py index 22a8e7c..fee4275 100644 --- a/ShadowMusic/Core/Clients/cli.py +++ b/ShadowMusic/Core/Clients/cli.py @@ -1,6 +1,8 @@ -from config import API_HASH, API_ID, BOT_TOKEN, STRING from pyrogram import Client +from config import (API_HASH, API_ID, BOT_TOKEN, STRING1, STRING2, STRING3, + STRING4, STRING5) + app = Client( "ShadowMusic", API_ID, @@ -8,4 +10,8 @@ bot_token=BOT_TOKEN, ) -userbot = Client(STRING, API_ID, API_HASH) +ASS_CLI_1 = Client(STRING1, API_ID, API_HASH) +ASS_CLI_2 = Client(STRING2, API_ID, API_HASH) +ASS_CLI_3 = Client(STRING3, API_ID, API_HASH) +ASS_CLI_4 = Client(STRING4, API_ID, API_HASH) +ASS_CLI_5 = Client(STRING5, API_ID, API_HASH) From 7061eaad6b2a723f62e210cd1974951080c4b526 Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Sun, 19 Dec 2021 16:19:33 +0530 Subject: [PATCH 18/79] Shadow Music --- ShadowMusic/Core/Logger/Log.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ShadowMusic/Core/Logger/Log.py b/ShadowMusic/Core/Logger/Log.py index 77bf0dd..fcb41a7 100644 --- a/ShadowMusic/Core/Logger/Log.py +++ b/ShadowMusic/Core/Logger/Log.py @@ -1,10 +1,8 @@ from config import LOG_GROUP_ID as _channel_id_ - -from ShadowMusic.Core.Clients.cli import app, userbot +from ShadowMusic.Core.Clients.cli import app failure = "Make sure your bot is in your log channel and is promoted as an admin with full rights!" - async def log(_message_): try: await app.send_message(_channel_id_, f"#LOGGER\n\n{_message_}") From 43aa058ce7ad442d3485c46dca717ca00e07d86c Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Sun, 19 Dec 2021 16:27:49 +0530 Subject: [PATCH 19/79] Shadow Music --- ShadowMusic/Core/PyTgCalls/Shadow.py | 351 ++++++++++++++++++++++++--- 1 file changed, 324 insertions(+), 27 deletions(-) diff --git a/ShadowMusic/Core/PyTgCalls/Shadow.py b/ShadowMusic/Core/PyTgCalls/Shadow.py index fb7360c..47e9638 100644 --- a/ShadowMusic/Core/PyTgCalls/Shadow.py +++ b/ShadowMusic/Core/PyTgCalls/Shadow.py @@ -3,20 +3,21 @@ import time from asyncio import QueueEmpty -from config import get_queue from pyrogram.errors import FloodWait, MessageNotModified from pyrogram.types import (CallbackQuery, InlineKeyboardButton, InlineKeyboardMarkup, KeyboardButton, Message, ReplyKeyboardMarkup, ReplyKeyboardRemove) -from pytgcalls import PyTgCalls +from pytgcalls import PyTgCalls, StreamType from pytgcalls.types import Update from pytgcalls.types.input_stream import InputAudioStream, InputStream -from ShadowMusic import MUSIC_BOT_NAME, app, db_mem, userbot +from config import get_queue +from ShadowMusic import (ASS_CLI_1, ASS_CLI_2, ASS_CLI_3, ASS_CLI_4, ASS_CLI_5, + MUSIC_BOT_NAME, app, db_mem) from ShadowMusic.Core.PyTgCalls import Queues from ShadowMusic.Core.PyTgCalls.Converter import convert from ShadowMusic.Core.PyTgCalls.Downloader import download -from ShadowMusic.Database import remove_active_chat +from ShadowMusic.Database import get_assistant, remove_active_chat from ShadowMusic.Inline import (audio_markup, audio_timer_markup_start, primary_markup, timer_markup) from ShadowMusic.Utilities.changers import time_to_seconds @@ -26,35 +27,210 @@ from ShadowMusic.Utilities.timer import start_timer from ShadowMusic.Utilities.youtube import get_yt_info_id -pytgcalls = PyTgCalls(userbot) +### Clients +pytgcalls1 = PyTgCalls(ASS_CLI_1) +pytgcalls2 = PyTgCalls(ASS_CLI_2) +pytgcalls3 = PyTgCalls(ASS_CLI_3) +pytgcalls4 = PyTgCalls(ASS_CLI_4) +pytgcalls5 = PyTgCalls(ASS_CLI_5) -@pytgcalls.on_kicked() -async def kicked_handler(client: PyTgCalls, chat_id: int): - try: - Queues.clear(chat_id) - except QueueEmpty: - pass - await remove_active_chat(chat_id) +### Multi Assistant start -@pytgcalls.on_closed_voice_chat() -async def kicked_handler(client: PyTgCalls, chat_id: int): - try: - Queues.clear(chat_id) - except QueueEmpty: - pass - await remove_active_chat(chat_id) +async def join_stream(chat_id: int, file_path: str): + _assistant = await get_assistant(chat_id, "assistant") + assistant = _assistant["saveassistant"] + if int(assistant) == 1: + try: + await pytgcalls1.join_group_call( + chat_id, + InputStream( + InputAudioStream( + file_path, + ), + ), + stream_type=StreamType().local_stream, + ) + return True + except: + return False + elif int(assistant) == 2: + try: + await pytgcalls2.join_group_call( + chat_id, + InputStream( + InputAudioStream( + file_path, + ), + ), + stream_type=StreamType().local_stream, + ) + return True + except: + return False + elif int(assistant) == 3: + try: + await pytgcalls3.join_group_call( + chat_id, + InputStream( + InputAudioStream( + file_path, + ), + ), + stream_type=StreamType().local_stream, + ) + return True + except: + return False + elif int(assistant) == 4: + try: + await pytgcalls4.join_group_call( + chat_id, + InputStream( + InputAudioStream( + file_path, + ), + ), + stream_type=StreamType().local_stream, + ) + return True + except: + return False + elif int(assistant) == 5: + try: + await pytgcalls5.join_group_call( + chat_id, + InputStream( + InputAudioStream( + file_path, + ), + ), + stream_type=StreamType().local_stream, + ) + return True + except: + return False + return False + + +### Multi Assistant Pause + + +async def pause_stream(chat_id: int): + _assistant = await get_assistant(chat_id, "assistant") + assistant = _assistant["saveassistant"] + if int(assistant) == 1: + await pytgcalls1.pause_stream(chat_id) + elif int(assistant) == 2: + await pytgcalls2.pause_stream(chat_id) + elif int(assistant) == 3: + await pytgcalls3.pause_stream(chat_id) + elif int(assistant) == 4: + await pytgcalls4.pause_stream(chat_id) + elif int(assistant) == 5: + await pytgcalls5.pause_stream(chat_id) + + +### Multi Assistant Resume + + +async def resume_stream(chat_id: int): + _assistant = await get_assistant(chat_id, "assistant") + assistant = _assistant["saveassistant"] + if int(assistant) == 1: + await pytgcalls1.resume_stream(chat_id) + elif int(assistant) == 2: + await pytgcalls2.resume_stream(chat_id) + elif int(assistant) == 3: + await pytgcalls3.resume_stream(chat_id) + elif int(assistant) == 4: + await pytgcalls4.resume_stream(chat_id) + elif int(assistant) == 5: + await pytgcalls5.resume_stream(chat_id) + + +### Multi Assistant Stop -@pytgcalls.on_stream_end() -async def on_stream_end(client: PyTgCalls, update: Update) -> None: - chat_id = update.chat_id + +async def stop_stream(chat_id: int): + _assistant = await get_assistant(chat_id, "assistant") + assistant = _assistant["saveassistant"] + if int(assistant) == 1: + await pytgcalls1.leave_group_call(chat_id) + elif int(assistant) == 2: + await pytgcalls2.leave_group_call(chat_id) + elif int(assistant) == 3: + await pytgcalls3.leave_group_call(chat_id) + elif int(assistant) == 4: + await pytgcalls4.leave_group_call(chat_id) + elif int(assistant) == 5: + await pytgcalls5.leave_group_call(chat_id) + + +### Multi Assistant Skip + + +async def skip_stream(chat_id: int, file_path: str): + _assistant = await get_assistant(chat_id, "assistant") + assistant = _assistant["saveassistant"] + if int(assistant) == 1: + await pytgcalls1.change_stream( + chat_id, + InputStream( + InputAudioStream( + file_path, + ), + ), + ) + elif int(assistant) == 2: + await pytgcalls2.change_stream( + chat_id, + InputStream( + InputAudioStream( + file_path, + ), + ), + ) + elif int(assistant) == 3: + await pytgcalls3.change_stream( + chat_id, + InputStream( + InputAudioStream( + file_path, + ), + ), + ) + elif int(assistant) == 4: + await pytgcalls4.change_stream( + chat_id, + InputStream( + InputAudioStream( + file_path, + ), + ), + ) + elif int(assistant) == 5: + await pytgcalls5.change_stream( + chat_id, + InputStream( + InputAudioStream( + file_path, + ), + ), + ) + + +### Multi Assistant Playout End + + +async def playout_end(pytgclients, chat_id): try: Queues.task_done(chat_id) if Queues.is_empty(chat_id): await remove_active_chat(chat_id) - await pytgcalls.leave_group_call(chat_id) + await pytgclients.leave_group_call(chat_id) else: afk = Queues.get(chat_id)["file"] finxx = f"{afk[0]}{afk[1]}{afk[2]}" @@ -81,7 +257,7 @@ async def on_stream_end(client: PyTgCalls, update: Update) -> None: None, download, afk, mystic, title ) raw_path = await convert(downloaded_file) - await pytgcalls.change_stream( + await pytgclients.change_stream( chat_id, InputStream( InputAudioStream( @@ -113,7 +289,7 @@ async def on_stream_end(client: PyTgCalls, update: Update) -> None: videoid = afk else: videoid = afk - await pytgcalls.change_stream( + await pytgclients.change_stream( chat_id, InputStream( InputAudioStream( @@ -130,7 +306,7 @@ async def on_stream_end(client: PyTgCalls, update: Update) -> None: buttons = buttons = audio_markup( videoid, "283402", duration_min, duration_min ) - thumb = "Utils/Telegram.JPEG" + thumb = "Utils/Audio.png" aud = 1 else: _path_ = _path_ = ( @@ -162,5 +338,126 @@ async def on_stream_end(client: PyTgCalls, update: Update) -> None: print(e) -run = pytgcalls.run +### Multi Assistant Queue Clear + + +async def clear_queue(chat_id): + try: + Queues.clear(chat_id) + except QueueEmpty: + pass + await remove_active_chat(chat_id) + + +### Playout End For Client 1 +@pytgcalls1.on_stream_end() +async def stream_end_handler1(_, update: Update): + await playout_end(pytgcalls1, update.chat_id) + + +### Playout End For Client 2 +@pytgcalls2.on_stream_end() +async def stream_end_handler(_, update: Update): + await playout_end(pytgcalls2, update.chat_id) + + +### Playout End For Client 3 +@pytgcalls3.on_stream_end() +async def stream_end_handler3(_, update: Update): + await playout_end(pytgcalls3, update.chat_id) + + +### Playout End For Client 4 +@pytgcalls4.on_stream_end() +async def stream_end_handler(_, update: Update): + await playout_end(pytgcalls4, update.chat_id) + + +### Playout End For Client 5 +@pytgcalls5.on_stream_end() +async def stream_end_handler5(_, update: Update): + await playout_end(pytgcalls5, update.chat_id) + + +### Kicked Handlers + + +@pytgcalls1.on_kicked() +async def kicked_handler1(_, chat_id: int): + await clear_queue(chat_id) + + +@pytgcalls2.on_kicked() +async def kicked_handler2(_, chat_id: int): + await clear_queue(chat_id) + + +@pytgcalls3.on_kicked() +async def kicked_handle3(_, chat_id: int): + await clear_queue(chat_id) + + +@pytgcalls4.on_kicked() +async def kicked_handler4(_, chat_id: int): + await clear_queue(chat_id) + + +@pytgcalls5.on_kicked() +async def kicked_handler5(_, chat_id: int): + await clear_queue(chat_id) + + +### Closed Handlers + + +@pytgcalls1.on_closed_voice_chat() +async def closed_voice_chat_handler1(_, chat_id: int): + await clear_queue(chat_id) + + +@pytgcalls2.on_closed_voice_chat() +async def closed_voice_chat_handler2(_, chat_id: int): + await clear_queue(chat_id) + + +@pytgcalls3.on_closed_voice_chat() +async def closed_voice_chat_handler3(_, chat_id: int): + await clear_queue(chat_id) + + +@pytgcalls4.on_closed_voice_chat() +async def closed_voice_chat_handler4(_, chat_id: int): + await clear_queue(chat_id) + + +@pytgcalls5.on_closed_voice_chat() +async def closed_voice_chat_handler5(_, chat_id: int): + await clear_queue(chat_id) + + +### Left Handlers + + +@pytgcalls1.on_left() +async def left_handler1(_, chat_id: int): + await clear_queue(chat_id) + + +@pytgcalls2.on_left() +async def left_handler2(_, chat_id: int): + await clear_queue(chat_id) + + +@pytgcalls3.on_left() +async def left_handler3(_, chat_id: int): + await clear_queue(chat_id) + + +@pytgcalls4.on_left() +async def left_handler4(_, chat_id: int): + await clear_queue(chat_id) + +@pytgcalls5.on_left() +async def left_handler5(_, chat_id: int): + await clear_queue(chat_id) From 7be89c4911b046968e3eb742b3452520889a9163 Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Sun, 19 Dec 2021 16:30:22 +0530 Subject: [PATCH 20/79] Shadow Music --- ShadowMusic/Database/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ShadowMusic/Database/__init__.py b/ShadowMusic/Database/__init__.py index 59131d7..3f3da8f 100644 --- a/ShadowMusic/Database/__init__.py +++ b/ShadowMusic/Database/__init__.py @@ -15,6 +15,6 @@ is_pmpermit_approved) from .queue import (add_active_chat, get_active_chats, is_active_chat, is_music_playing, music_off, music_on, remove_active_chat) +from .start import _get_start, get_start, get_start_names, save_start from .sudo import add_sudo, get_sudoers, remove_sudo from .theme import _get_theme, get_theme, save_theme - From 3294d71612334e3e61095d43d835072123772c64 Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Sun, 19 Dec 2021 16:31:13 +0530 Subject: [PATCH 21/79] Shadow Music --- ShadowMusic/Database/assistant.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ShadowMusic/Database/assistant.py b/ShadowMusic/Database/assistant.py index d6a1e59..d9dd821 100644 --- a/ShadowMusic/Database/assistant.py +++ b/ShadowMusic/Database/assistant.py @@ -2,7 +2,7 @@ from ShadowMusic import db -assisdb = db.assis +assisdb = db.multiassistant async def get_as_names(chat_id: int) -> List[str]: From 77cefaaee7de40b3dd9d87be6f5f866ad64ccead Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Sun, 19 Dec 2021 16:32:07 +0530 Subject: [PATCH 22/79] Shadow Music --- ShadowMusic/Database/start.py | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 ShadowMusic/Database/start.py diff --git a/ShadowMusic/Database/start.py b/ShadowMusic/Database/start.py new file mode 100644 index 0000000..59da61a --- /dev/null +++ b/ShadowMusic/Database/start.py @@ -0,0 +1,37 @@ +from typing import Dict, List, Union + +from ShadowMusic import db + +assisdb = db.start + + +async def get_start_names(chat_id: int) -> List[str]: + _notes = [] + for note in await _get_start(chat_id): + _notes.append(note) + return _notes + + +async def _get_start(chat_id: int) -> Dict[str, int]: + _notes = await assisdb.find_one({"chat_id": chat_id}) + if not _notes: + return {} + return _notes["notes"] + + +async def get_start(chat_id: int, name: str) -> Union[bool, dict]: + name = name.lower().strip() + _notes = await _get_start(chat_id) + if name in _notes: + return _notes[name] + else: + return False + + +async def save_start(chat_id: int, name: str, note: dict): + name = name.lower().strip() + _notes = await _get_start(chat_id) + _notes[name] = note + await assisdb.update_one( + {"chat_id": chat_id}, {"$set": {"notes": _notes}}, upsert=True + ) From 5a831eeb3f64d7a3e21f39a7b2b5ed82094116a6 Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Sun, 19 Dec 2021 16:36:04 +0530 Subject: [PATCH 23/79] Shadow Music --- ShadowMusic/Decorators/assistant.py | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/ShadowMusic/Decorators/assistant.py b/ShadowMusic/Decorators/assistant.py index 28c4745..89b3acf 100644 --- a/ShadowMusic/Decorators/assistant.py +++ b/ShadowMusic/Decorators/assistant.py @@ -1,25 +1,37 @@ -import asyncio - +import random from typing import Dict, List, Union from pyrogram.errors import UserAlreadyParticipant, UserNotParticipant -from ShadowMusic import (ASSID, ASSMENTION, ASSNAME, ASSUSERNAME, BOT_ID, app, - userbot) +from ShadowMusic import MUSIC_BOT_NAME, app +from ShadowMusic.Database import get_assistant, save_assistant +from ShadowMusic.Utilities.assistant import get_assistant_details, random_assistant def AssistantAdd(mystic): async def wrapper(_, message): + _assistant = await get_assistant(message.chat.id, "assistant") + if not _assistant: + ran_ass = random.choice(random_assistant) + assis = { + "saveassistant": ran_ass, + } + await save_assistant(message.chat.id, "assistant", assis) + else: + ran_ass = _assistant["saveassistant"] + ASS_ID, ASS_NAME, ASS_USERNAME, ASS_ACC = await get_assistant_details( + ran_ass + ) try: - b = await app.get_chat_member(message.chat.id, ASSID) + b = await app.get_chat_member(message.chat.id, ASS_ID) if b.status == "kicked": return await message.reply_text( - f"Assistant Account[{ASSID}] is banned.\nUnban it first to use Music Bot\n\nUsername: @{ASSUSERNAME}" + f"Assistant Account [{ASS_ID}] is banned.\nUnban it first to use Music Bot\n\nUsername: @{ASS_USERNAME}" ) except UserNotParticipant: if message.chat.username: try: - await userbot.join_chat(message.chat.username) + await ASS_ACC.join_chat(message.chat.username) except UserAlreadyParticipant: pass except Exception as e: @@ -33,7 +45,7 @@ async def wrapper(_, message): inv_lnk = str(xxy) inv_lnk = inv_lnk.replace("https://t.me/+","https://t.me/joinchat/") await asyncio.sleep(10) - await userbot.join_chat(inv_lnk) + await ASS_ACC.join_chat(inv_lnk) await message.reply(f"{ASSNAME} Joined Successfully") except UserAlreadyParticipant: pass From 71635b9de841cd5b847200944bcddb1075fe4b58 Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Sun, 19 Dec 2021 16:41:08 +0530 Subject: [PATCH 24/79] Shadow Music --- ShadowMusic/Inline/start.py | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/ShadowMusic/Inline/start.py b/ShadowMusic/Inline/start.py index add575d..23c675e 100644 --- a/ShadowMusic/Inline/start.py +++ b/ShadowMusic/Inline/start.py @@ -1,7 +1,7 @@ -from config import MUSIC_BOT_NAME, SUPPORT_CHANNEL, SUPPORT_GROUP from pyrogram.types import (CallbackQuery, InlineKeyboardButton, InlineKeyboardMarkup, InputMediaPhoto, Message) +from config import MUSIC_BOT_NAME, SUPPORT_CHANNEL, SUPPORT_GROUP from ShadowMusic import BOT_USERNAME @@ -184,7 +184,28 @@ def setting_markup(): ] return f"๐ง **{MUSIC_BOT_NAME} Settings**", buttons - + +def setting_markup2(): + buttons = [ + [ + InlineKeyboardButton(text="๐ Audio Quality", callback_data="AQ"), + InlineKeyboardButton(text="๐ Audio Volume", callback_data="AV"), + ], + [ + InlineKeyboardButton( + text="๐ฅ Authorized Users", callback_data="AU" + ), + InlineKeyboardButton( + text="๐ป Dashboard", callback_data="Dashboard" + ), + ], + [ + InlineKeyboardButton(text="โ๏ธ Close", callback_data="close"), + ], + ] + return f"๐ง **{MUSIC_BOT_NAME} Settings**", buttons + + def volmarkup(): buttons = [ [ From 0e8ee05ba1ea4e7f2959d0ecfdca687558c7f169 Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Sun, 19 Dec 2021 16:42:03 +0530 Subject: [PATCH 25/79] Shadow Music --- ShadowMusic/Inline/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ShadowMusic/Inline/__init__.py b/ShadowMusic/Inline/__init__.py index f2df822..84e3d7e 100644 --- a/ShadowMusic/Inline/__init__.py +++ b/ShadowMusic/Inline/__init__.py @@ -8,5 +8,5 @@ playlist_markup, third_playlist_markup) from .song import song_download_markup, song_markup from .start import (custommarkup, dashmarkup, private_panel, setting_markup, - start_pannel, usermarkup, volmarkup) + setting_markup2, start_pannel, usermarkup, volmarkup) from .stats import stats1, stats2, stats3, stats4, stats5, stats6, stats7 From b43c52de23e2222083b0df003a4ee05a775c0afc Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Sun, 19 Dec 2021 16:43:05 +0530 Subject: [PATCH 26/79] Shadow Music --- ShadowMusic/Inline/others.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ShadowMusic/Inline/others.py b/ShadowMusic/Inline/others.py index 7b87403..402ec60 100644 --- a/ShadowMusic/Inline/others.py +++ b/ShadowMusic/Inline/others.py @@ -39,7 +39,7 @@ def others_markup(videoid, user_id): InlineKeyboardButton( text="๐ Close Menu", callback_data=f"close", - ) + ), ], ] return buttons From 31a526c1c2a8b0ec2a0f6aab70a1d4c0b0bf5cec Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Sun, 19 Dec 2021 16:49:53 +0530 Subject: [PATCH 27/79] Shadow Music --- ShadowMusic/Utilities/assistant.py | 35 ++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 ShadowMusic/Utilities/assistant.py diff --git a/ShadowMusic/Utilities/assistant.py b/ShadowMusic/Utilities/assistant.py new file mode 100644 index 0000000..659442c --- /dev/null +++ b/ShadowMusic/Utilities/assistant.py @@ -0,0 +1,35 @@ +from Shadow import (ASS_CLI_1, ASS_CLI_2, ASS_CLI_3, ASS_CLI_4, ASS_CLI_5, + ASSID1, ASSID2, ASSID3, ASSID4, ASSID5, ASSNAME1, ASSNAME2, + ASSNAME3, ASSNAME4, ASSNAME5, ASSUSERNAME1, ASSUSERNAME2, + ASSUSERNAME3, ASSUSERNAME4, ASSUSERNAME5) + +random_assistant = ["5", "1", "2", "3", "4"] + + +async def get_assistant_details(assistant: int): + if int(assistant) == 1: + x = ASSID1 + y = ASSNAME1 + z = ASSUSERNAME1 + a = ASS_CLI_1 + elif int(assistant) == 2: + x = ASSID2 + y = ASSNAME2 + z = ASSUSERNAME2 + a = ASS_CLI_2 + elif int(assistant) == 3: + x = ASSID3 + y = ASSNAME3 + z = ASSUSERNAME3 + a = ASS_CLI_3 + elif int(assistant) == 4: + x = ASSID4 + y = ASSNAME4 + z = ASSUSERNAME4 + a = ASS_CLI_4 + elif int(assistant) == 5: + x = ASSID5 + y = ASSNAME5 + z = ASSUSERNAME5 + a = ASS_CLI_5 + return x, y, z, a From f2f9669c9bf83cde676910a1c300b0520269cc4a Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Sun, 19 Dec 2021 16:58:49 +0530 Subject: [PATCH 28/79] Shadow Music --- ShadowMusic/Utilities/stream.py | 41 +++++++-------------------------- 1 file changed, 8 insertions(+), 33 deletions(-) diff --git a/ShadowMusic/Utilities/stream.py b/ShadowMusic/Utilities/stream.py index a19e5e6..d97737c 100644 --- a/ShadowMusic/Utilities/stream.py +++ b/ShadowMusic/Utilities/stream.py @@ -2,13 +2,12 @@ import os import shutil -from config import get_queue from pyrogram.types import InlineKeyboardMarkup -from pytgcalls import StreamType -from pytgcalls.types.input_stream import InputAudioStream, InputStream +from config import get_queue from ShadowMusic import BOT_USERNAME, db_mem -from ShadowMusic.Core.PyTgCalls import Queues, Shadow +from ShadowMusic.Core.PyTgCalls import Queues +from ShadowMusic.Core.PyTgCalls.Shadow import join_stream from ShadowMusic.Database import (add_active_chat, is_active_chat, music_off, music_on) from ShadowMusic.Inline import (audio_markup, audio_markup2, primary_markup, @@ -65,17 +64,7 @@ async def start_stream( os.remove(thumb) return else: - try: - await Shadow.pytgcalls.join_group_call( - CallbackQuery.message.chat.id, - InputStream( - InputAudioStream( - file, - ), - ), - stream_type=StreamType().local_stream, - ) - except Exception as e: + if not await join_stream(CallbackQuery.message.chat.id, file): return await mystic.edit( "Error Joining Voice Chat. Make sure Voice Chat is Enabled." ) @@ -144,27 +133,14 @@ async def start_stream_audio( await mystic.delete() return else: - try: - await Shadow.pytgcalls.join_group_call( - message.chat.id, - InputStream( - InputAudioStream( - file, - ), - ), - stream_type=StreamType().local_stream, - ) - except Exception as e: - await mystic.edit( + if not await join_stream(message.chat.id, file): + return await mystic.edit( "Error Joining Voice Chat. Make sure Voice Chat is Enabled." ) - return get_queue[message.chat.id] = [] got_queue = get_queue.get(message.chat.id) title = title user = message.from_user.first_name - chat_id = message.chat.id - user_id = message.from_user.id duration = duration_min to_append = [title, user, duration] got_queue.append(to_append) @@ -185,8 +161,7 @@ async def start_stream_audio( duration_min, duration_sec, final_output, - chat_id, - user_id, + message.chat.id, + message.from_user.id, 1, ) - From c923703411b112c5572ae19697bd59d5274e61ae Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Sun, 19 Dec 2021 17:01:56 +0530 Subject: [PATCH 29/79] Shadow Music --- ShadowMusic/Utilities/thumbnails.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/ShadowMusic/Utilities/thumbnails.py b/ShadowMusic/Utilities/thumbnails.py index daf8ff7..71cdf5c 100644 --- a/ShadowMusic/Utilities/thumbnails.py +++ b/ShadowMusic/Utilities/thumbnails.py @@ -33,8 +33,21 @@ async def gen_thumb(thumbnail, title, userid, theme, ctitle): draw = ImageDraw.Draw(img) font = ImageFont.truetype("Utils/finalfont.ttf", 50) font2 = ImageFont.truetype("Utils/finalfont.ttf", 75) - draw.text((20, 538), f"{title[:20]}...", fill= "white", stroke_width = 1, stroke_fill="white", font=font2) - draw.text((20, 650), f"Playing on: {ctitle[:50]}...", fill="white", stroke_width = 1, stroke_fill="white" ,font=font) + draw.text( + (20, 538), + f"{title[:20]}...", + fill= "white", + stroke_width = 1, + stroke_fill="white", + font=font2 + ) + draw.text( + (20, 650), + f"Playing on: {ctitle[:50]}...", + fill="white", + stroke_width = 1, + stroke_fill="white", + font=font) img.save(f"cache/final{userid}.png") os.remove(f"cache/temp{userid}.png") os.remove(f"cache/thumb{userid}.jpg") From 50f0de8eae0e4760a70efaf26a3f7dd366f39a89 Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Sun, 19 Dec 2021 17:03:28 +0530 Subject: [PATCH 30/79] Shadow Music --- ShadowMusic/Utilities/thumbnails.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ShadowMusic/Utilities/thumbnails.py b/ShadowMusic/Utilities/thumbnails.py index 71cdf5c..b5fdea8 100644 --- a/ShadowMusic/Utilities/thumbnails.py +++ b/ShadowMusic/Utilities/thumbnails.py @@ -35,7 +35,7 @@ async def gen_thumb(thumbnail, title, userid, theme, ctitle): font2 = ImageFont.truetype("Utils/finalfont.ttf", 75) draw.text( (20, 538), - f"{title[:20]}...", + f"{title[:15]}...", fill= "white", stroke_width = 1, stroke_fill="white", From c7e91350b2b94b170a924c4dbe4ddd2af2d3a901 Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Mon, 20 Dec 2021 11:11:23 +0530 Subject: [PATCH 31/79] Shadow Music --- ShadowMusic/Plugins/Admins.py | 68 ++++++++++------------------------- 1 file changed, 19 insertions(+), 49 deletions(-) diff --git a/ShadowMusic/Plugins/Admins.py b/ShadowMusic/Plugins/Admins.py index 517a978..0581112 100644 --- a/ShadowMusic/Plugins/Admins.py +++ b/ShadowMusic/Plugins/Admins.py @@ -3,20 +3,20 @@ import random from asyncio import QueueEmpty -from config import get_queue from pyrogram import filters from pyrogram.types import (CallbackQuery, InlineKeyboardButton, InlineKeyboardMarkup, KeyboardButton, Message, ReplyKeyboardMarkup, ReplyKeyboardRemove) -from pytgcalls import StreamType -from pytgcalls.types.input_stream import InputAudioStream, InputStream +from config import get_queue from ShadowMusic import BOT_USERNAME, MUSIC_BOT_NAME, app, db_mem -from ShadowMusic.Core.PyTgCalls import Queues, Shadow +from ShadowMusic.Core.PyTgCalls import Queues from ShadowMusic.Core.PyTgCalls.Converter import convert from ShadowMusic.Core.PyTgCalls.Downloader import download +from ShadowMusic.Core.PyTgCalls.Yukki import (pause_stream, resume_stream, + skip_stream, stop_stream) from ShadowMusic.Database import (is_active_chat, is_music_playing, music_off, - music_on, remove_active_chat) + music_on, remove_active_chat) from ShadowMusic.Decorators.admins import AdminRightsCheck from ShadowMusic.Decorators.checker import checker, checkerCB from ShadowMusic.Inline import audio_markup, primary_markup @@ -32,30 +32,14 @@ __MODULE__ = "Voice Chat" __HELP__ = """ - - -/pause -- Pause the playing music on voice chat. - -/resume -- Resume the paused music on voice chat. - -/skip -- Skip the current playing music on voice chat - -/end or /stop -- Stop the playout. - -/queue -- Check queue list. - - -**Note:** -Only for Sudo Users - -/activevc -- Check active voice chats on bot. - +- /pause: Pause the playing music on voice chat. +- /resume: Resume the paused music on voice chat. +- /skip: Skip the current playing music on voice chat +- /end or /stop: Stop the playout. +- /queue: Check queue list. + +**Only for Sudo Users** +- /activevc: Check active voice chats on bot. """ @@ -76,7 +60,7 @@ async def admins(_, message: Message): if not await is_music_playing(message.chat.id): return await message.reply_text("Music is already Paused.") await music_off(chat_id) - await Shadow.pytgcalls.pause_stream(chat_id) + await pause_stream(chat_id) await message.reply_text( f"๐ง Voicechat Paused by {message.from_user.mention}!" ) @@ -84,7 +68,7 @@ async def admins(_, message: Message): if await is_music_playing(message.chat.id): return await message.reply_text("Music is already Playing.") await music_on(chat_id) - await Shadow.pytgcalls.resume_stream(message.chat.id) + await resume_stream(chat_id) await message.reply_text( f"๐ง Voicechat Resumed by {message.from_user.mention}!" ) @@ -94,7 +78,7 @@ async def admins(_, message: Message): except QueueEmpty: pass await remove_active_chat(chat_id) - await Shadow.pytgcalls.leave_group_call(message.chat.id) + await stop_stream(chat_id) await message.reply_text( f"๐ง Voicechat End/Stopped by {message.from_user.mention}!" ) @@ -105,7 +89,7 @@ async def admins(_, message: Message): await message.reply_text( "No more music in __Queue__ \n\nLeaving Voice Chat" ) - await Shadow.pytgcalls.leave_group_call(message.chat.id) + await stop_stream(chat_id) return else: videoid = Queues.get(chat_id)["file"] @@ -131,14 +115,7 @@ async def admins(_, message: Message): None, download, videoid, mystic, title ) raw_path = await convert(downloaded_file) - await Shadow.pytgcalls.change_stream( - chat_id, - InputStream( - InputAudioStream( - raw_path, - ), - ), - ) + await skip_stream(chat_id, raw_path) theme = await check_theme(chat_id) chat_title = await specialfont_to_normal(message.chat.title) thumb = await gen_thumb( @@ -158,14 +135,7 @@ async def admins(_, message: Message): ) os.remove(thumb) else: - await Shadow.pytgcalls.change_stream( - chat_id, - InputStream( - InputAudioStream( - videoid, - ), - ), - ) + await skip_stream(chat_id, videoid) afk = videoid title = db_mem[videoid]["title"] duration_min = db_mem[videoid]["duration"] From 35b730649617065303f81173156ca329824c8675 Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Mon, 20 Dec 2021 11:15:56 +0530 Subject: [PATCH 32/79] Shadow Music --- ShadowMusic/Plugins/Assistant.py | 412 +++++++++++++++---------------- 1 file changed, 205 insertions(+), 207 deletions(-) diff --git a/ShadowMusic/Plugins/Assistant.py b/ShadowMusic/Plugins/Assistant.py index 8cfc0bc..8b3ec39 100644 --- a/ShadowMusic/Plugins/Assistant.py +++ b/ShadowMusic/Plugins/Assistant.py @@ -7,43 +7,68 @@ InlineQueryResultPhoto, InputTextMessageContent, Message) -from ShadowMusic import (ASSID, ASSISTANT_PREFIX, ASSNAME, BOT_ID, BOT_USERNAME, - LOG_GROUP_ID, MUSIC_BOT_NAME, SUDOERS, app, userbot) +from ShadowMusic import (ASS_CLI_1, ASS_CLI_2, ASS_CLI_3, ASS_CLI_4, ASS_CLI_5, + ASSISTANT_PREFIX, BOT_ID, BOT_USERNAME, LOG_GROUP_ID, + MUSIC_BOT_NAME, SUDOERS, app) from ShadowMusic.Database import (approve_pmpermit, disapprove_pmpermit, - is_pmpermit_approved) + is_pmpermit_approved) __MODULE__ = "Assistant" __HELP__ = f""" - -**Note:** -- Only for Sudo Users - - - -{ASSISTANT_PREFIX[0]}block [ Reply to a User Message] -- Blocks the User from Assistant Account. - -{ASSISTANT_PREFIX[0]}unblock [ Reply to a User Message] -- Unblocks the User from Assistant Account. - -{ASSISTANT_PREFIX[0]}approve [ Reply to a User Message] -- Approves the User for DM. - -{ASSISTANT_PREFIX[0]}disapprove [ Reply to a User Message] -- Disapproves the User for DM. - -{ASSISTANT_PREFIX[0]}pfp [ Reply to a Photo] -- Changes Assistant account PFP. - -{ASSISTANT_PREFIX[0]}bio [Bio text] -- Changes Bio of Assistant Account. - +**Only for Sudo Users** + +{ASSISTANT_PREFIX[0]}block [Reply to a User Message]: Blocks the User from Assistant Account. +{ASSISTANT_PREFIX[0]}unblock [Reply to a User Message]: Unblocks the User from Assistant Account. +{ASSISTANT_PREFIX[0]}approve [Reply to a User Message]: Approves the User for DM. +{ASSISTANT_PREFIX[0]}disapprove [Reply to a User Message]: Disapproves the User for DM. +{ASSISTANT_PREFIX[0]}pfp [Reply to a Photo]: Changes Assistant account PFP. +{ASSISTANT_PREFIX[0]}bio [Bio text]: Changes Bio of Assistant Account. """ flood = {} -@userbot.on_message( +@ASS_CLI_1.on_message( + filters.private + & filters.incoming + & ~filters.service + & ~filters.edited + & ~filters.me + & ~filters.bot + & ~filters.via_bot + & ~filters.user(SUDOERS) +) +@ASS_CLI_2.on_message( + filters.private + & filters.incoming + & ~filters.service + & ~filters.edited + & ~filters.me + & ~filters.bot + & ~filters.via_bot + & ~filters.user(SUDOERS) +) +@ASS_CLI_3.on_message( + filters.private + & filters.incoming + & ~filters.service + & ~filters.edited + & ~filters.me + & ~filters.bot + & ~filters.via_bot + & ~filters.user(SUDOERS) +) +@ASS_CLI_4.on_message( + filters.private + & filters.incoming + & ~filters.service + & ~filters.edited + & ~filters.me + & ~filters.bot + & ~filters.via_bot + & ~filters.user(SUDOERS) +) +@ASS_CLI_5.on_message( filters.private & filters.incoming & ~filters.service @@ -53,11 +78,11 @@ & ~filters.via_bot & ~filters.user(SUDOERS) ) -async def awaiting_message(_, message): +async def awaiting_message(client, message): user_id = message.from_user.id if await is_pmpermit_approved(user_id): return - async for m in userbot.iter_history(user_id, limit=6): + async for m in client.iter_history(user_id, limit=6): if m.reply_markup: await m.delete() if str(user_id) in flood: @@ -66,28 +91,42 @@ async def awaiting_message(_, message): flood[str(user_id)] = 1 if flood[str(user_id)] > 5: await message.reply_text("Spam Detected. User Blocked") - await userbot.send_message( + await client.send_message( LOG_GROUP_ID, f"**Spam Detect Block On Assistant**\n\n- **Blocked User:** {message.from_user.mention}\n- **User ID:** {message.from_user.id}", ) - return await userbot.block_user(user_id) - results = await userbot.get_inline_bot_results( - BOT_ID, f"permit_to_pm {user_id}" - ) - await userbot.send_inline_bot_result( - user_id, - results.query_id, - results.results[0].id, - hide_via=True, + return await client.block_user(user_id) + await message.reply_text( + f"Hello, I am {MUSIC_BOT_NAME}'s Assistant.\n\nPlease dont spam here , else you'll get blocked.\nFor more Help start :- @{BOT_USERNAME}" ) -@userbot.on_message( +@ASS_CLI_1.on_message( + filters.command("approve", prefixes=ASSISTANT_PREFIX) + & filters.user(SUDOERS) + & ~filters.via_bot +) +@ASS_CLI_2.on_message( + filters.command("approve", prefixes=ASSISTANT_PREFIX) + & filters.user(SUDOERS) + & ~filters.via_bot +) +@ASS_CLI_3.on_message( + filters.command("approve", prefixes=ASSISTANT_PREFIX) + & filters.user(SUDOERS) + & ~filters.via_bot +) +@ASS_CLI_4.on_message( filters.command("approve", prefixes=ASSISTANT_PREFIX) & filters.user(SUDOERS) & ~filters.via_bot ) -async def pm_approve(_, message): +@ASS_CLI_5.on_message( + filters.command("approve", prefixes=ASSISTANT_PREFIX) + & filters.user(SUDOERS) + & ~filters.via_bot +) +async def pm_approve(client, message): if not message.reply_to_message: return await eor( message, text="Reply to a user's message to approve." @@ -99,12 +138,32 @@ async def pm_approve(_, message): await eor(message, text="User is approved to pm") -@userbot.on_message( +@ASS_CLI_1.on_message( filters.command("disapprove", prefixes=ASSISTANT_PREFIX) & filters.user(SUDOERS) & ~filters.via_bot ) -async def pm_disapprove(_, message): +@ASS_CLI_2.on_message( + filters.command("disapprove", prefixes=ASSISTANT_PREFIX) + & filters.user(SUDOERS) + & ~filters.via_bot +) +@ASS_CLI_3.on_message( + filters.command("disapprove", prefixes=ASSISTANT_PREFIX) + & filters.user(SUDOERS) + & ~filters.via_bot +) +@ASS_CLI_4.on_message( + filters.command("disapprove", prefixes=ASSISTANT_PREFIX) + & filters.user(SUDOERS) + & ~filters.via_bot +) +@ASS_CLI_5.on_message( + filters.command("disapprove", prefixes=ASSISTANT_PREFIX) + & filters.user(SUDOERS) + & ~filters.via_bot +) +async def pm_disapprove(client, message): if not message.reply_to_message: return await eor( message, text="Reply to a user's message to disapprove." @@ -112,7 +171,7 @@ async def pm_disapprove(_, message): user_id = message.reply_to_message.from_user.id if not await is_pmpermit_approved(user_id): await eor(message, text="User is already disapproved to pm") - async for m in userbot.iter_history(user_id, limit=6): + async for m in client.iter_history(user_id, limit=6): if m.reply_markup: try: await m.delete() @@ -123,208 +182,147 @@ async def pm_disapprove(_, message): await eor(message, text="User is disapproved to pm") -@userbot.on_message( +@ASS_CLI_1.on_message( + filters.command("block", prefixes=ASSISTANT_PREFIX) + & filters.user(SUDOERS) + & ~filters.via_bot +) +@ASS_CLI_2.on_message( + filters.command("block", prefixes=ASSISTANT_PREFIX) + & filters.user(SUDOERS) + & ~filters.via_bot +) +@ASS_CLI_3.on_message( + filters.command("block", prefixes=ASSISTANT_PREFIX) + & filters.user(SUDOERS) + & ~filters.via_bot +) +@ASS_CLI_4.on_message( filters.command("block", prefixes=ASSISTANT_PREFIX) & filters.user(SUDOERS) & ~filters.via_bot ) -async def block_user_func(_, message): +@ASS_CLI_5.on_message( + filters.command("block", prefixes=ASSISTANT_PREFIX) + & filters.user(SUDOERS) + & ~filters.via_bot +) +async def block_user_func(client, message): if not message.reply_to_message: return await eor(message, text="Reply to a user's message to block.") user_id = message.reply_to_message.from_user.id await eor(message, text="Successfully blocked the user") - await userbot.block_user(user_id) + await client.block_user(user_id) -@userbot.on_message( +@ASS_CLI_1.on_message( + filters.command("unblock", prefixes=ASSISTANT_PREFIX) + & filters.user(SUDOERS) + & ~filters.via_bot +) +@ASS_CLI_2.on_message( + filters.command("unblock", prefixes=ASSISTANT_PREFIX) + & filters.user(SUDOERS) + & ~filters.via_bot +) +@ASS_CLI_3.on_message( filters.command("unblock", prefixes=ASSISTANT_PREFIX) & filters.user(SUDOERS) & ~filters.via_bot ) -async def unblock_user_func(_, message): +@ASS_CLI_4.on_message( + filters.command("unblock", prefixes=ASSISTANT_PREFIX) + & filters.user(SUDOERS) + & ~filters.via_bot +) +@ASS_CLI_5.on_message( + filters.command("unblock", prefixes=ASSISTANT_PREFIX) + & filters.user(SUDOERS) + & ~filters.via_bot +) +async def unblock_user_func(client, message): if not message.reply_to_message: return await eor( message, text="Reply to a user's message to unblock." ) user_id = message.reply_to_message.from_user.id - await userbot.unblock_user(user_id) + await client.unblock_user(user_id) await eor(message, text="Successfully Unblocked the user") - -@userbot.on_message( +@ASS_CLI_1.on_message( + filters.command("pfp", prefixes=ASSISTANT_PREFIX) + & filters.user(SUDOERS) + & ~filters.via_bot +) +@ASS_CLI_2.on_message( + filters.command("pfp", prefixes=ASSISTANT_PREFIX) + & filters.user(SUDOERS) + & ~filters.via_bot +) +@ASS_CLI_3.on_message( filters.command("pfp", prefixes=ASSISTANT_PREFIX) & filters.user(SUDOERS) & ~filters.via_bot ) -async def set_pfp(_, message): +@ASS_CLI_4.on_message( + filters.command("pfp", prefixes=ASSISTANT_PREFIX) + & filters.user(SUDOERS) + & ~filters.via_bot +) +@ASS_CLI_5.on_message( + filters.command("pfp", prefixes=ASSISTANT_PREFIX) + & filters.user(SUDOERS) + & ~filters.via_bot +) +async def set_pfp(client, message): if not message.reply_to_message or not message.reply_to_message.photo: - return await eor(message, text="Reply to a photo.") + return await eor(message, text="Reply to a photo.") photo = await message.reply_to_message.download() - try: - await userbot.set_profile_photo(photo=photo) + try: + await client.set_profile_photo(photo=photo) await eor(message, text="Successfully Changed PFP.") except Exception as e: await eor(message, text=e) - - -@userbot.on_message( + + +@ASS_CLI_1.on_message( + filters.command("bio", prefixes=ASSISTANT_PREFIX) + & filters.user(SUDOERS) + & ~filters.via_bot +) +@ASS_CLI_2.on_message( + filters.command("bio", prefixes=ASSISTANT_PREFIX) + & filters.user(SUDOERS) + & ~filters.via_bot +) +@ASS_CLI_3.on_message( + filters.command("bio", prefixes=ASSISTANT_PREFIX) + & filters.user(SUDOERS) + & ~filters.via_bot +) +@ASS_CLI_4.on_message( + filters.command("bio", prefixes=ASSISTANT_PREFIX) + & filters.user(SUDOERS) + & ~filters.via_bot +) +@ASS_CLI_5.on_message( filters.command("bio", prefixes=ASSISTANT_PREFIX) & filters.user(SUDOERS) & ~filters.via_bot ) -async def set_bio(_, message): +async def set_bio(client, message): if len(message.command) == 1: - return await eor(message , text="Give some text to set as bio.") + return await eor(message, text="Give some text to set as bio.") elif len(message.command) > 1: bio = message.text.split(None, 1)[1] - try: - await userbot.update_profile(bio=bio) - await eor(message , text="Changed Bio.") + try: + await client.update_profile(bio=bio) + await eor(message, text="Changed Bio.") except Exception as e: - await eor(message , text=e) + await eor(message, text=e) else: - return await eor(message , text="Give some text to set as bio.") - -flood2 = {} - -@app.on_callback_query(filters.regex("pmpermit")) -async def pmpermit_cq(_, cq): - user_id = cq.from_user.id - data, victim = ( - cq.data.split(None, 2)[1], - cq.data.split(None, 2)[2], - ) - if data == "approve": - if user_id != ASSID: - return await cq.answer("This Button Is Not For You") - await approve_pmpermit(int(victim)) - return await app.edit_inline_text( - cq.inline_message_id, "User Has Been Approved To PM." - ) - - if data == "block": - if user_id != ASSID: - return await cq.answer("This Button Is Not For You") - await cq.answer() - await app.edit_inline_text( - cq.inline_message_id, "Successfully blocked the user." - ) - await userbot.block_user(int(victim)) - return await userbot.send( - DeleteHistory( - peer=(await userbot.resolve_peer(victim)), - max_id=0, - revoke=False, - ) - ) - - if user_id == ASSID: - return await cq.answer("It's For The Other Person.") - - if data == "to_scam_you": - async for m in userbot.iter_history(user_id, limit=6): - if m.reply_markup: - await m.delete() - await userbot.send_message(user_id, "Blocked, Go scam someone else.") - await userbot.send_message( - LOG_GROUP_ID, - f"**Scam Block On Assistant**\n\n- **Blocked User:** {cq.from_user.mention}\n- **User ID:** {user_id}", - ) - await userbot.block_user(user_id) - await cq.answer() - if data == "for_pro": - async for m in userbot.iter_history(user_id, limit=6): - if m.reply_markup: - await m.delete() - await userbot.send_message(user_id, f"Blocked, No Promotions.") - await userbot.send_message( - LOG_GROUP_ID, - f"**Promotion Block On Assistant**\n\n- **Blocked User:** {cq.from_user.mention}\n- **User ID:** {user_id}", - ) - await userbot.block_user(user_id) - await cq.answer() - elif data == "approve_me": - await cq.answer() - if str(user_id) in flood2: - flood2[str(user_id)] += 1 - else: - flood2[str(user_id)] = 1 - if flood2[str(user_id)] > 5: - await userbot.send_message( - user_id, "SPAM DETECTED, USER BLOCKED." - ) - await userbot.send_message( - LOG_GROUP_ID, - f"**Spam Detect Block On Assistant**\n\n- **Blocked User:** {cq.from_user.mention}\n- **User ID:** {user_id}", - ) - return await userbot.block_user(user_id) - await userbot.send_message( - user_id, - "I'm busy right now, will approve you shortly, DO NOT SPAM.", - ) - - -async def pmpermit_func(answers, user_id, victim): - if user_id != ASSID: - return - caption = f"Hi, I'm {ASSNAME}, What are you here for?, You'll be blocked if you send more than 5 messages." - audio_markup2 = InlineKeyboardMarkup( - [ - [ - InlineKeyboardButton( - text=f"Add {MUSIC_BOT_NAME} To Your Group", - url=f"https://t.me/{BOT_USERNAME}?startgroup=true", - ), - ], - [ - InlineKeyboardButton( - text="To Scam You", - callback_data=f"pmpermit to_scam_you a", - ), - InlineKeyboardButton( - text="For Promotion", callback_data=f"pmpermit for_pro a" - ), - ], - [ - InlineKeyboardButton( - text="Approve me", callback_data=f"pmpermit approve_me a" - ), - InlineKeyboardButton( - text="Approve", callback_data=f"pmpermit approve {victim}" - ), - ], - [ - InlineKeyboardButton( - "Block & Delete", callback_data="pmpermit block {victim}" - ) - ], - ] - ) - answers.append( - InlineQueryResultArticle( - title="do_not_click_here", - reply_markup=audio_markup2, - input_message_content=InputTextMessageContent(caption), - ) - ) - return answers - - -@app.on_inline_query() -async def inline_query_handler(client, query): - try: - text = query.query.strip().lower() - answers = [] - if text.split()[0] == "permit_to_pm": - user_id = query.from_user.id - victim = text.split()[1] - answerss = await pmpermit_func(answers, user_id, victim) - await client.answer_inline_query( - query.id, results=answerss, cache_time=2 - ) - except: - return + return await eor(message, text="Give some text to set as bio.") async def eor(msg: Message, **kwargs): From b32f8b100cd93fafec081260cb7c31a0f470d1c1 Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Mon, 20 Dec 2021 11:18:06 +0530 Subject: [PATCH 33/79] Shadow Music --- ShadowMusic/Plugins/Auth.py | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/ShadowMusic/Plugins/Auth.py b/ShadowMusic/Plugins/Auth.py index 038fe7a..d660d17 100644 --- a/ShadowMusic/Plugins/Auth.py +++ b/ShadowMusic/Plugins/Auth.py @@ -1,29 +1,22 @@ from pyrogram import Client, filters from pyrogram.types import Message -from ShadowMusic import SUDOERS, app +from ShadowMusic import app from ShadowMusic.Database import (_get_authusers, delete_authuser, get_authuser, - get_authuser_count, get_authuser_names, - save_authuser) + get_authuser_count, get_authuser_names, + save_authuser) from ShadowMusic.Decorators.admins import AdminActual from ShadowMusic.Utilities.changers import (alpha_to_int, int_to_alpha, - time_to_seconds) + time_to_seconds) __MODULE__ = "Auth Users" __HELP__ = """ - **Note:** --Auth users can skip, pause, stop, resume Voice Chats even without Admin Rights. - - -/auth [Username or Reply to a Message] -- Add a user to AUTH LIST of the group. - -/unauth [Username or Reply to a Message] -- Remove a user from AUTH LIST of the group. +=> Auth users can skip, pause, stop, resume Voice Chats even without Admin Rights. -/authusers -- Check AUTH LIST of the group. +- /auth [Username or Reply to a Message]: Add a user to AUTH LIST of the group. +- /unauth [Username or Reply to a Message]: Remove a user from AUTH LIST of the group. +- /authusers: Check AUTH LIST of the group. """ From b8b8d880b18801bd59ae51da756ac1061621a409 Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Mon, 20 Dec 2021 11:20:06 +0530 Subject: [PATCH 34/79] Shadow Music --- ShadowMusic/Plugins/Blacklist.py | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/ShadowMusic/Plugins/Blacklist.py b/ShadowMusic/Plugins/Blacklist.py index 5b3ddd8..3caf31b 100644 --- a/ShadowMusic/Plugins/Blacklist.py +++ b/ShadowMusic/Plugins/Blacklist.py @@ -6,23 +6,11 @@ __MODULE__ = "Blacklist" __HELP__ = """ +- /blacklistedchat: Check Blacklisted Chats of Bot. - -/blacklistedchat -- Check Blacklisted Chats of Bot. - - -**Note:** -Only for Sudo Users. - - -/blacklistchat [CHAT_ID] -- Blacklist any chat from using Music Bot - - -/whitelistchat [CHAT_ID] -- Whitelist any blacklisted chat from using Music Bot - +**Only for Sudo Users** +- /blacklistchat [CHAT_ID]: Blacklist any chat from using Music Bot +- /whitelistchat [CHAT_ID]: Whitelist any blacklisted chat from using Music Bot """ From 6ac328290afa1540c1da754e2dc2d1003f30aa91 Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Mon, 20 Dec 2021 11:28:53 +0530 Subject: [PATCH 35/79] Shadow Music --- ShadowMusic/Plugins/Callback.py | 53 ++++++++++----------------------- 1 file changed, 15 insertions(+), 38 deletions(-) diff --git a/ShadowMusic/Plugins/Callback.py b/ShadowMusic/Plugins/Callback.py index 1a46a26..b73042e 100644 --- a/ShadowMusic/Plugins/Callback.py +++ b/ShadowMusic/Plugins/Callback.py @@ -3,25 +3,26 @@ import random from asyncio import QueueEmpty -from config import get_queue from pyrogram import filters from pyrogram.types import InlineKeyboardMarkup -from pytgcalls import StreamType -from pytgcalls.types.input_stream import InputAudioStream, InputStream +from config import get_queue from ShadowMusic import BOT_USERNAME, MUSIC_BOT_NAME, app, db_mem -from ShadowMusic.Core.PyTgCalls import Queues, Shadow +from ShadowMusic.Core.PyTgCalls import Queues from ShadowMusic.Core.PyTgCalls.Converter import convert from ShadowMusic.Core.PyTgCalls.Downloader import download +from ShadowMusic.Core.PyTgCalls.Shadow import (join_stream, pause_stream, + resume_stream, skip_stream, + stop_stream) from ShadowMusic.Database import (_get_playlists, delete_playlist, get_playlist, get_playlist_names, is_active_chat, save_playlist) from ShadowMusic.Database.queue import (add_active_chat, is_active_chat, - is_music_playing, music_off, music_on, - remove_active_chat) + is_music_playing, music_off, music_on, + remove_active_chat) from ShadowMusic.Decorators.admins import AdminRightsCheckCB from ShadowMusic.Decorators.checker import checkerCB from ShadowMusic.Inline import (audio_markup, audio_markup2, download_markup, - fetch_playlist, paste_queue_markup, primary_markup) + fetch_playlist, paste_queue_markup, primary_markup) from ShadowMusic.Utilities.changers import time_to_seconds from ShadowMusic.Utilities.chat import specialfont_to_normal from ShadowMusic.Utilities.paste import isPreviewUp, paste_queue @@ -65,7 +66,7 @@ async def admin_risghts(_, CallbackQuery): "Music is already Paused", show_alert=True ) await music_off(chat_id) - await Shadow.pytgcalls.pause_stream(chat_id) + await pause_stream(chat_id) await CallbackQuery.message.reply_text( f"๐ง Voicechat Paused by {CallbackQuery.from_user.mention}!", reply_markup=audio_markup2, @@ -78,7 +79,7 @@ async def admin_risghts(_, CallbackQuery): "Music is already Resumed.", show_alert=True ) await music_on(chat_id) - await Shadow.pytgcalls.resume_stream(chat_id) + await resume_stream(chat_id) await CallbackQuery.message.reply_text( f"๐ง Voicechat Resumed by {CallbackQuery.from_user.mention}!", reply_markup=audio_markup2, @@ -91,7 +92,7 @@ async def admin_risghts(_, CallbackQuery): except QueueEmpty: pass await remove_active_chat(chat_id) - await Shadow.pytgcalls.leave_group_call(chat_id) + await stop_stream(chat_id) await CallbackQuery.message.reply_text( f"๐ง Voicechat End/Stopped by {CallbackQuery.from_user.mention}!", reply_markup=audio_markup2, @@ -105,7 +106,7 @@ async def admin_risghts(_, CallbackQuery): await CallbackQuery.message.reply_text( f"No more music in __Queue__ \n\nLeaving Voice Chat..Button Used By :- {CallbackQuery.from_user.mention}" ) - await Shadow.pytgcalls.leave_group_call(chat_id) + await stop_stream(chat_id) await CallbackQuery.message.delete() await CallbackQuery.answer( "Skipped. No more music in Queue", show_alert=True @@ -139,14 +140,7 @@ async def admin_risghts(_, CallbackQuery): None, download, videoid, mystic, title ) raw_path = await convert(downloaded_file) - await Shadow.pytgcalls.change_stream( - chat_id, - InputStream( - InputAudioStream( - raw_path, - ), - ), - ) + await skip_stream(chat_id, raw_path) theme = await check_theme(chat_id) chat_title = await specialfont_to_normal( CallbackQuery.message.chat.title @@ -178,14 +172,7 @@ async def admin_risghts(_, CallbackQuery): else: await CallbackQuery.message.delete() await CallbackQuery.answer("Skipped!", show_alert=True) - await Shadow.pytgcalls.change_stream( - chat_id, - InputStream( - InputAudioStream( - videoid, - ), - ), - ) + await skip_stream(chat_id, videoid) afk = videoid title = db_mem[videoid]["title"] duration_min = db_mem[videoid]["duration"] @@ -318,17 +305,7 @@ async def play_playlist(_, CallbackQuery): None, download, videoid, mystic, title ) raw_path = await convert(downloaded_file) - try: - await Shadow.pytgcalls.join_group_call( - chat_id, - InputStream( - InputAudioStream( - raw_path, - ), - ), - stream_type=StreamType().local_stream, - ) - except Exception as e: + if not await join_stream(chat_id, raw_path): return await mystic.edit( "Error Joining Voice Chat. Make sure Voice Chat is Enabled." ) From ff68b53e0ccf8bf4c81335e9a3c384953ce3a34e Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Mon, 20 Dec 2021 11:33:36 +0530 Subject: [PATCH 36/79] Shadow Music --- ShadowMusic/Plugins/Developer.py | 246 +++++++++++++------------------ 1 file changed, 103 insertions(+), 143 deletions(-) diff --git a/ShadowMusic/Plugins/Developer.py b/ShadowMusic/Plugins/Developer.py index 45d698f..67536cc 100644 --- a/ShadowMusic/Plugins/Developer.py +++ b/ShadowMusic/Plugins/Developer.py @@ -3,7 +3,6 @@ import subprocess import sys import traceback -from asyncio import create_subprocess_shell, sleep, subprocess from html import escape from inspect import getfullargspec from io import StringIO @@ -11,46 +10,22 @@ from pyrogram import filters from pyrogram.errors import MessageNotModified -from pyrogram.types import Message, ReplyKeyboardMarkup +from pyrogram.types import (InlineKeyboardButton, InlineKeyboardMarkup, + Message, ReplyKeyboardMarkup) -from ShadowMusic import SUDOERS, userbot +from ShadowMusic import SUDOERS, app from ShadowMusic.Utilities.tasks import add_task, rm_task # Eval and Sh module from WBB __MODULE__ = "Broadcast" __HELP__ = """ - -**Note:** -Only for Sudo Users. - - -/broadcast [Message or Reply to a Message] -- Broadcast any message to Bot's Served Chats. - -/broadcast_pin [Message or Reply to a Message] -- Broadcast any message to Bot's Served Chats with message getting Pinned in chat [Disabled Notifications]. - -/broadcast_pin_loud [Message or Reply to a Message] -- Broadcast any message to Bot's Served Chats with message getting Pinned in chat [Enabled Notifications]. - +**Only for Sudo Users** +- /broadcast [Message or Reply to a Message]: Broadcast any message to Bot's Served Chats +- /broadcast_pin [Message or Reply to a Message]: Broadcast any message to Bot's Served Chats with message getting Pinned in chat [Disabled Notifications]. +- /broadcast_pin_loud [Message or Reply to a Message]: Broadcast any message to Bot's Served Chats with message getting Pinned in chat [Enabled Notifications]. """ -m = None -p = print -r = None -arrow = lambda x: (x.text if isinstance(x, Message) else "") + "\n`โ`" - - -async def eor(msg: Message, **kwargs): - func = ( - (msg.edit_text if msg.from_user.is_self else msg.reply) - if msg.from_user - else msg.reply - ) - spec = getfullargspec(func.__wrapped__).args - return await func(**{k: v for k, v in kwargs.items() if k in spec}) - async def aexec(code, client, message): exec( @@ -60,82 +35,37 @@ async def aexec(code, client, message): return await locals()["__aexec"](client, message) -async def iter_edit(message: Message, text: str): - async for m in userbot.iter_history(message.chat.id): - - # If no replies found, reply - if m.message_id == message.message_id: - return 0 - - if not m.from_user or not m.text or not m.reply_to_message: - continue - - if ( - (m.reply_to_message.message_id == message.message_id) - and (m.from_user.id == message.from_user.id) - and ("โ" in m.text) - ): - try: - return await m.edit(text) - except MessageNotModified: - return +async def edit_or_reply(msg: Message, **kwargs): + func = msg.edit_text if msg.from_user.is_self else msg.reply + spec = getfullargspec(func.__wrapped__).args + await func(**{k: v for k, v in kwargs.items() if k in spec}) -@userbot.on_message( +@app.on_message( filters.user(SUDOERS) & ~filters.forwarded & ~filters.via_bot - & ~filters.edited - & filters.command("eval"), + & filters.command("eval") ) -async def executor(client, message: Message): - global m, p, r +async def executor(client, message): if len(message.command) < 2: - return await eor(message, text="Command needed to execute") - + return await edit_or_reply( + message, text="__Nigga Give me some command to execute.__" + ) try: cmd = message.text.split(" ", maxsplit=1)[1] except IndexError: return await message.delete() - - if message.chat.type == "channel": - return - - m = message - p = print - - # To prevent keyboard input attacks - if m.reply_to_message: - r = m.reply_to_message - if r.reply_markup and isinstance(r.reply_markup, ReplyKeyboardMarkup): - return await eor(m, text="INSECURE!") - status = None + t1 = time() old_stderr = sys.stderr old_stdout = sys.stdout redirected_output = sys.stdout = StringIO() redirected_error = sys.stderr = StringIO() stdout, stderr, exc = None, None, None try: - task, task_id = await add_task( - aexec, - "Eval", - cmd, - client, - m, - ) - - text = f"{arrow('')} Pending Task `{task_id}`" - if not message.edit_date: - status = await m.reply(text, quote=True) - - await task - except Exception as e: - e = traceback.format_exc() - print(e) - exc = e.splitlines()[-1] - - await rm_task() - + await aexec(cmd, client, message) + except Exception: + exc = traceback.format_exc() stdout = redirected_output.getvalue() stderr = redirected_error.getvalue() sys.stdout = old_stdout @@ -149,86 +79,116 @@ async def executor(client, message: Message): evaluation = stdout else: evaluation = "Success" - - final_output = f"**โ**\n`{escape(evaluation.strip())}`" - + final_output = f"**OUTPUT**:\n```{evaluation.strip()}```" if len(final_output) > 4096: filename = "output.txt" with open(filename, "w+", encoding="utf8") as out_file: out_file.write(str(evaluation.strip())) + t2 = time() + keyboard = InlineKeyboardMarkup( + [ + [ + InlineKeyboardButton( + text="โณ", callback_data=f"runtime {t2-t1} Seconds" + ) + ] + ] + ) await message.reply_document( document=filename, - caption="`โ`\n **Attached Document**", + caption=f"**INPUT:**\n`{cmd[0:980]}`\n\n**OUTPUT:**\n`Attached Document`", quote=False, + reply_markup=keyboard, ) + await message.delete() os.remove(filename) - if status: - await status.delete() - return + else: + t2 = time() + keyboard = InlineKeyboardMarkup( + [ + [ + InlineKeyboardButton( + text="โณ", + callback_data=f"runtime {round(t2-t1, 3)} Seconds", + ), + InlineKeyboardButton( + text="๐", + callback_data=f"forceclose abc|{message.from_user.id}", + ), + ] + ] + ) + await edit_or_reply(message, text=final_output, reply_markup=keyboard) + - # Edit the output if input is edited - if message.edit_date: - status_ = await iter_edit(message, final_output) - if status_ == 0: - return await message.reply(final_output, quote=True) - return - if not status.from_user: - status = await userbot.get_messages(status.chat.id, status.message_id) - await eor(status, text=final_output, quote=True) +@app.on_callback_query(filters.regex(r"runtime")) +async def runtime_func_cq(_, cq): + runtime = cq.data.split(None, 1)[1] + await cq.answer(runtime, show_alert=True) -@userbot.on_message( +@app.on_message( filters.user(SUDOERS) & ~filters.forwarded & ~filters.via_bot - & ~filters.edited & filters.command("sh"), ) -async def shellrunner(_, message: Message): +async def shellrunner(client, message): if len(message.command) < 2: - return await eor(message, text="**Usage:**\n/sh git pull") - - if message.reply_to_message: - r = message.reply_to_message - if r.reply_markup and isinstance( - r.reply_markup, - ReplyKeyboardMarkup, - ): - return await eor(message, text="INSECURE!") - output = "" + return await edit_or_reply(message, text="**Usage:**\n/sh git pull") text = message.text.split(None, 1)[1] if "\n" in text: code = text.split("\n") - shell = " ".join(code) + output = "" + for x in code: + shell = re.split(""" (?=(?:[^'"]|'[^']*'|"[^"]*")*$)""", x) + try: + process = subprocess.Popen( + shell, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + ) + except Exception as err: + print(err) + await edit_or_reply(message, text=f"**ERROR:**\n```{err}```") + output += f"**{code}**\n" + output += process.stdout.read()[:-1].decode("utf-8") + output += "\n" else: - shell = text - process = await create_subprocess_shell( - shell, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - ) - out, errorz = await process.communicate() - if errorz: - error = f"**INPUT:**\n```{escape(text)}```\n\n**ERROR:**\n```{errorz.decode('utf-8')}```" - return await eor(message, text=error) - output += out.decode("utf-8") - output += "\n" + shell = re.split(""" (?=(?:[^'"]|'[^']*'|"[^"]*")*$)""", text) + for a in range(len(shell)): + shell[a] = shell[a].replace('"', "") + try: + process = subprocess.Popen( + shell, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + ) + except Exception as err: + print(err) + exc_type, exc_obj, exc_tb = sys.exc_info() + errors = traceback.format_exception( + etype=exc_type, + value=exc_obj, + tb=exc_tb, + ) + return await edit_or_reply( + message, text=f"**ERROR:**\n```{''.join(errors)}```" + ) + output = process.stdout.read()[:-1].decode("utf-8") if str(output) == "\n": output = None if output: if len(output) > 4096: with open("output.txt", "w+") as file: file.write(output) - await message.reply_document( - "output.txt", caption=f"{escape(text)}" + await app.send_document( + message.chat.id, + "output.txt", + reply_to_message_id=message.message_id, + caption="`Output`", ) return os.remove("output.txt") - await eor( - message, - text=f"**INPUT:**\n```{escape(text)}```\n\n**OUTPUT:**\n```{(output)}```", - ) + await edit_or_reply(message, text=f"**OUTPUT:**\n```{output}```") else: - return await eor( - message, - text=f"**INPUT:**\n```{escape(text)}```\n\n**OUTPUT: **\n`No output`", - ) + await edit_or_reply(message, text="**OUTPUT: **\n`No output`") From 34ccb6e7330143dfefc307c73bf02d2923a675d7 Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Mon, 20 Dec 2021 11:39:02 +0530 Subject: [PATCH 37/79] Shadow Music --- ShadowMusic/Plugins/Download.py | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/ShadowMusic/Plugins/Download.py b/ShadowMusic/Plugins/Download.py index 5a399b6..f94bf4c 100644 --- a/ShadowMusic/Plugins/Download.py +++ b/ShadowMusic/Plugins/Download.py @@ -21,14 +21,9 @@ __MODULE__ = "Global Ban" __HELP__ = """ -**Note:** -Only for Sudo Users. - -/gban [Username or Reply to a user] -- Ban a user globally in Bot's Served Chats and prevents user from using bot commands. - -/ungban [Username or Reply to a user] -- Remove a user from Bot's GBan List. +**Only for Sudo Users** +- /gban [Username or Reply to a user]: Ban a user globally in Bot's Served Chats and prevents user from using bot commands. +- /ungban [Username or Reply to a user]: Remove a user from Bot's GBan List. """ @@ -38,11 +33,14 @@ async def closed(_, query: CallbackQuery): await query.answer("Closed") -@app.on_callback_query(filters.regex(pattern=r"down")) +@app.on_callback_query(filters.regex(pattern=r"failed")) async def down(_, CallbackQuery): - await CallbackQuery.answer() - + await CallbackQuery.answer("Download or Upload Failed :(") +@app.on_callback_query(filters.regex(pattern=r"up_n_down")) +async def up_n_down(_, CallbackQuery): + await CallbackQuery.answer("Wait...") + @app.on_callback_query(filters.regex(pattern=r"gets")) async def getspy(_, CallbackQuery): await CallbackQuery.answer() @@ -65,11 +63,11 @@ async def ytdata(_, CallbackQuery): inl = InlineKeyboardMarkup( - [[InlineKeyboardButton(text="Downloading......", callback_data=f"down")]] + [[InlineKeyboardButton(text="Downloading......", callback_data=f"up_n_down")]] ) upl = InlineKeyboardMarkup( - [[InlineKeyboardButton(text="Uploading......", callback_data=f"down")]] + [[InlineKeyboardButton(text="Uploading......", callback_data=f"up_n_down")]] ) @@ -77,7 +75,7 @@ def inl_mark(videoid, user_id): buttons = [ [ InlineKeyboardButton( - text="Download or Upload Failed......", callback_data=f"down" + text="Download or Upload Failed......", callback_data=f"failed" ) ], [ From fe24177c70c4c49b505f2b7049534cbd4858e6f2 Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Mon, 20 Dec 2021 11:42:07 +0530 Subject: [PATCH 38/79] Shadow Music --- ShadowMusic/Plugins/Lyrics.py | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/ShadowMusic/Plugins/Lyrics.py b/ShadowMusic/Plugins/Lyrics.py index 52b211f..164aa7d 100644 --- a/ShadowMusic/Plugins/Lyrics.py +++ b/ShadowMusic/Plugins/Lyrics.py @@ -1,5 +1,5 @@ -import re import os +import re import lyricsgenius from pyrogram import Client, filters @@ -10,13 +10,10 @@ __MODULE__ = "Lyrics" __HELP__ = """ - -/Lyrics [Music Name] -- Searches Lyrics for the particular Music on web. +- /lyrics [Music Name]: Searches Lyrics for the particular Music on web. **Note**: Inline button of Lyrics has some bugs. Searches only 50% results. You can use command instead if you want lyrics for any playing music. - """ @@ -54,15 +51,12 @@ async def lyricssex(_, CallbackQuery): usr = f"[{CallbackQuery.from_user.first_name}](tg://user?id={userid})" xxx = f""" **Lyrics Search Powered By {MUSIC_BOT_NAME}** - **Searched By:-** {usr} **Searched Song:-** __{title}__ - **Found Lyrics For:-** __{S.title}__ **Artist:-** {S.artist} **__Lyrics:__** - {S.lyrics}""" if len(xxx) > 4096: filename = "lyrics.txt" @@ -92,13 +86,10 @@ async def lrsearch(_, message: Message): return await m.edit("Lyrics not found :(") xxx = f""" **Lyrics Search Powered By {MUSIC_BOT_NAME}** - **Searched Song:-** __{query}__ **Found Lyrics For:-** __{S.title}__ **Artist:-** {S.artist} - **__Lyrics:__** - {S.lyrics}""" if len(xxx) > 4096: await m.delete() @@ -113,4 +104,3 @@ async def lrsearch(_, message: Message): os.remove(filename) else: await m.edit(xxx) - From 3c6bafad8f540674d9f76d63fe3ef796cf391fad Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Mon, 20 Dec 2021 12:00:44 +0530 Subject: [PATCH 39/79] Shadow Music --- ShadowMusic/Plugins/Multi-Assistant.py | 94 ++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 ShadowMusic/Plugins/Multi-Assistant.py diff --git a/ShadowMusic/Plugins/Multi-Assistant.py b/ShadowMusic/Plugins/Multi-Assistant.py new file mode 100644 index 0000000..7e2b383 --- /dev/null +++ b/ShadowMusic/Plugins/Multi-Assistant.py @@ -0,0 +1,94 @@ +import random + +from pyrogram import filters +from pyrogram.raw.functions.messages import DeleteHistory +from pyrogram.types import (CallbackQuery, InlineKeyboardButton, + InlineKeyboardMarkup, InlineQueryResultArticle, + InlineQueryResultPhoto, InputTextMessageContent, + Message) + +from ShadowMusic import SUDOERS, app +from ShadowMusic.Database import get_assistant, save_assistant +from ShadowMusic.Utilities.assistant import get_assistant_details, random_assistant + +__MODULE__ = "Multi Assistant" +__HELP__ = """ +- /checkassistant: Check the alloted assistant of your chat + +**For Sudo Users:** +- /changeassistant [ASS NUMBER]: Change the previoius alloted assistant to new one. +- /setassistant [ASS NUMBER or Random]: Set a assistant account for chat. +""" + + +ass_num_list = ["1", "2", "3", "4", "5"] + + +@app.on_message(filters.command("changeassistant") & filters.user(SUDOERS)) +async def assis_change(_, message: Message): + usage = f"**Usage:**\n/changeassistant [ASS_NO]\n\nSelect from them\n{' | '.join(ass_num_list)}" + if len(message.command) != 2: + return await message.reply_text(usage) + num = message.text.split(None, 1)[1].strip() + if num not in ass_num_list: + return await message.reply_text(usage) + ass_num = int(message.text.strip().split()[1]) + _assistant = await get_assistant(message.chat.id, "assistant") + if not _assistant: + return await message.reply_text( + "No Pre-Saved Assistant Found.\n\nYou can set Assistant Via /setassistant" + ) + else: + ass = _assistant["saveassistant"] + assis = { + "saveassistant": ass_num, + } + await save_assistant(message.chat.id, "assistant", assis) + await message.reply_text( + f"**Changed Assistant**\n\nChanged Assistant Account from **{ass}** to Assistant Number **{ass_num}**" + ) + + +ass_num_list2 = ["1", "2", "3", "4", "5", "Random"] + + +@app.on_message(filters.command("setassistant") & filters.user(SUDOERS)) +async def assis_change(_, message: Message): + usage = f"**Usage:**\n/setassistant [ASS_NO or Random]\n\nSelect from them\n{' | '.join(ass_num_list2)}\n\nUse 'Random' to set random Assistant" + if len(message.command) != 2: + return await message.reply_text(usage) + query = message.text.split(None, 1)[1].strip() + if query not in ass_num_list2: + return await message.reply_text(usage) + if str(query) == "Random": + ran_ass = random.choice(random_assistant) + else: + ran_ass = int(message.text.strip().split()[1]) + _assistant = await get_assistant(message.chat.id, "assistant") + if not _assistant: + await message.reply_text( + f"**__Shadow Music Assistant Alloted__**\n\nAssistant No. **{ran_ass}**" + ) + assis = { + "saveassistant": ran_ass, + } + await save_assistant(message.chat.id, "assistant", assis) + else: + ass = _assistant["saveassistant"] + return await message.reply_text( + f"Pre-Saved Assistant Number {ass} Found.\n\nYou can change Assistant Via /changeassistant" + ) + + +@app.on_message(filters.command("checkassistant") & filters.group) +async def check_ass(_, message: Message): + _assistant = await get_assistant(message.chat.id, "assistant") + if not _assistant: + return await message.reply_text( + "No Pre-Saved Assistant Found.\n\nYou can set Assistant Via /play" + ) + else: + ass = _assistant["saveassistant"] + return await message.reply_text( + f"Pre-Saved Assistant Found\n\nAssistanty Number {ass} " + ) From 9a6746aeac6d67fb021b11428e2f6f377809df62 Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Mon, 20 Dec 2021 12:02:25 +0530 Subject: [PATCH 40/79] Shadow Music --- ShadowMusic/Plugins/Ping.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ShadowMusic/Plugins/Ping.py b/ShadowMusic/Plugins/Ping.py index 804cf29..ea53131 100644 --- a/ShadowMusic/Plugins/Ping.py +++ b/ShadowMusic/Plugins/Ping.py @@ -11,11 +11,9 @@ __MODULE__ = "Ping" __HELP__ = """ - -/ping - Check if Bot is alive or not. +- /ping: Check if Bot is alive or not. """ - async def bot_sys_stats(): bot_uptime = int(time.time() - boottime) cpu = psutil.cpu_percent(interval=0.5) From 70738e25bdcc700e2babb5b1199223ae04bc4ee0 Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Mon, 20 Dec 2021 12:09:29 +0530 Subject: [PATCH 41/79] Shadow Music --- ShadowMusic/Plugins/Playlist.py | 39 +++++++++++++++------------------ 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/ShadowMusic/Plugins/Playlist.py b/ShadowMusic/Plugins/Playlist.py index dd17523..ff2867a 100644 --- a/ShadowMusic/Plugins/Playlist.py +++ b/ShadowMusic/Plugins/Playlist.py @@ -5,34 +5,29 @@ from ShadowMusic import BOT_ID, BOT_USERNAME, MUSIC_BOT_NAME, SUDOERS, app, db_mem from ShadowMusic.Database import (_get_playlists, delete_playlist, get_playlist, - get_playlist_names, save_playlist) + get_playlist_names, save_playlist) from ShadowMusic.Decorators.admins import AdminRightsCheck +from ShadowMusic.Decorators.assistant import AssistantAdd from ShadowMusic.Decorators.checker import checker, checkerCB +from ShadowMusic.Decorators.permission import PermissionCheck from ShadowMusic.Inline import (add_genre_markup, check_genre_markup, check_markup, - delete_playlist_markuup, download_markup, - others_markup, play_genre_playlist, playlist_markup, - third_playlist_markup) + delete_playlist_markuup, download_markup, + others_markup, play_genre_playlist, playlist_markup, + third_playlist_markup) __MODULE__ = "Playlist" __HELP__ = """ - -/playplaylist -- Start playing Your Saved Playlist. - -/playlist -- Check Your Saved Playlist On Servers. - -/delmyplaylist -- Delete any saved music in your playlist - -/delgroupplaylist -- Delete any saved music in your group's playlist [Requires Admin Rights.] - +- /playplaylist: Start playing Your Saved Playlist. +- /playlist: Check Your Saved Playlist On Servers. +- /delmyplaylist: Delete any saved music in your playlist +- /delgroupplaylist: Delete any saved music in your group's playlist [Requires Admin Rights] """ -@app.on_message(filters.command("playplaylist")) +@app.on_message(filters.command("playplaylist") & filters.group) @checker +@PermissionCheck +@AssistantAdd async def play_playlist_cmd(_, message): thumb = "Utils/Playlist.png" await message.delete() @@ -100,8 +95,10 @@ async def play_playlist_cmd(_, message): return -@app.on_message(filters.command("playlist")) +@app.on_message(filters.command("playlist") & filters.group) @checker +@PermissionCheck +@AssistantAdd async def playlist(_, message): thumb = "Utils/Playlist.png" user_id = message.from_user.id @@ -163,7 +160,7 @@ async def playlist(_, message): ] -@app.on_message(filters.command("delmyplaylist")) +@app.on_message(filters.command("delmyplaylist") & filters.group) async def del_cmd(_, message): usage = f"Usage:\n\n/delmyplaylist [Genre] [Numbers between 1-30] ( to delete a particular music in playlist )\n\nor\n\n/delmyplaylist [Genre] all ( to delete whole playlist )\n\n**Genres:-**\n{' | '.join(options_Genre)}" if len(message.command) < 3: @@ -210,7 +207,7 @@ async def del_cmd(_, message): await message.reply_text("You have no such music in Playlist.") -@app.on_message(filters.command("delgroupplaylist")) +@app.on_message(filters.command("delgroupplaylist") & filters.group) @AdminRightsCheck async def delgroupplaylist(_, message): usage = f"Usage:\n\n/delgroupplaylist [Genre] [Numbers between 1-30] ( to delete a particular music in playlist )\n\nor\n\n /delgroupplaylist [Genre] all ( to delete whole playlist )\n\n**Genres:-**\n{' | '.join(options_Genre)}" From 6ae3942bf6292fe62c47293c48ff0394ad88bf5d Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Mon, 20 Dec 2021 12:10:54 +0530 Subject: [PATCH 42/79] Shadow Music --- ShadowMusic/Plugins/Song.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/ShadowMusic/Plugins/Song.py b/ShadowMusic/Plugins/Song.py index 58bcdd0..4bd29f7 100644 --- a/ShadowMusic/Plugins/Song.py +++ b/ShadowMusic/Plugins/Song.py @@ -18,13 +18,7 @@ __MODULE__ = "Song" __HELP__ = """ - - -/song [Youtube URL or Search Query] -- Download the particular query in audio or video format. - - - +/song [Youtube URL or Search Query]: Download the particular query in audio or video format. """ From cba87bcbcefdddb609115932f346393bca60ffc1 Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Mon, 20 Dec 2021 12:12:41 +0530 Subject: [PATCH 43/79] Shadow Music --- ShadowMusic/Plugins/Speedtest.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ShadowMusic/Plugins/Speedtest.py b/ShadowMusic/Plugins/Speedtest.py index 3b20037..5d8ff85 100644 --- a/ShadowMusic/Plugins/Speedtest.py +++ b/ShadowMusic/Plugins/Speedtest.py @@ -9,10 +9,7 @@ __MODULE__ = "Speedtest" __HELP__ = """ - -/speedtest -- Check Server Latency and Speed. - +- /speedtest: Check Server Latency and Speed. """ From 56956f8c44adcad15742fe18f3fac5190808f112 Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Mon, 20 Dec 2021 12:22:38 +0530 Subject: [PATCH 44/79] Shadow Music --- ShadowMusic/Plugins/Start.py | 144 ++++++++++++++++++++++------------- 1 file changed, 90 insertions(+), 54 deletions(-) diff --git a/ShadowMusic/Plugins/Start.py b/ShadowMusic/Plugins/Start.py index 78bb078..0727a2a 100644 --- a/ShadowMusic/Plugins/Start.py +++ b/ShadowMusic/Plugins/Start.py @@ -1,4 +1,5 @@ import asyncio +import random import time from sys import version as pyver from typing import Dict, List, Union @@ -8,33 +9,30 @@ from pyrogram.types import (CallbackQuery, InlineKeyboardButton, InlineKeyboardMarkup, InputMediaPhoto, Message) -from ShadowMusic import ASSID, BOT_ID, MUSIC_BOT_NAME, OWNER_ID, SUDOERS, app +from ShadowMusic import ASSIDS, BOT_ID, MUSIC_BOT_NAME, OWNER_ID, SUDOERS, app from ShadowMusic import boottime as bot_start_time from ShadowMusic import db from ShadowMusic.Core.PyTgCalls import Shadow from ShadowMusic.Database import (add_nonadmin_chat, add_served_chat, blacklisted_chats, get_assistant, get_authuser, - get_authuser_names, is_nonadmin_chat, + get_authuser_names, get_start, is_nonadmin_chat, is_served_chat, remove_active_chat, - remove_nonadmin_chat, save_assistant) + remove_nonadmin_chat, save_assistant, save_start) from ShadowMusic.Decorators.admins import ActualAdminCB from ShadowMusic.Decorators.permission import PermissionCheck from ShadowMusic.Inline import (custommarkup, dashmarkup, setting_markup, - start_pannel, usermarkup, volmarkup) + setting_markup2, start_pannel, usermarkup, + volmarkup) +from ShadowMusic.Utilities.assistant import get_assistant_details, random_assistant from ShadowMusic.Utilities.ping import get_readable_time welcome_group = 2 __MODULE__ = "Essentials" __HELP__ = """ - - -/start -- Start the Bot. - -/help -- Get Commands Helper Menu. - +- /start: Start the Bot. +- /help: Get Commands Helper Menu. +- /settings: Get Settings button. """ @@ -45,43 +43,81 @@ async def welcome(_, message: Message): pass else: await add_served_chat(chat_id) - if chat_id in await blacklisted_chats(): - await message.reply_text( - f"Hushh, Your chat group[{message.chat.title}] has been blacklisted!\n\nAsk any Sudo User to whitelist your chat" - ) - await app.leave_chat(chat_id) for member in message.new_chat_members: try: + if member.id == BOT_ID: + if chat_id in await blacklisted_chats(): + await message.reply_text( + f"Hushh, Your chat group[{message.chat.title}] has been blacklisted!\n\nAsk any Sudo User to whitelist your chat" + ) + await app.leave_chat(chat_id) + _assistant = await get_assistant(message.chat.id, "assistant") + if not _assistant: + ran_ass = random.choice(random_assistant) + assis = { + "saveassistant": ran_ass, + } + await save_assistant(message.chat.id, "assistant", assis) + else: + ran_ass = _assistant["saveassistant"] + ( + ASS_ID, + ASS_NAME, + ASS_USERNAME, + ASS_ACC, + ) = await get_assistant_details(ran_ass) + #out = start_pannel() + #await message.reply_text( + # f"Welcome To {MUSIC_BOT_NAME}\n\nPromote me as administrator in your group otherwise I will not function properly.\n\nAssistant Username:- @{ASS_USERNAME}\nAssistant ID:- {ASS_ID}", + # reply_markup=InlineKeyboardMarkup(out[1]), + #) + if member.id in ASSIDS: + return await remove_active_chat(chat_id) if member.id in OWNER_ID: return await message.reply_text( - f"{MUSIC_BOT_NAME}'s Owner[{member.mention}] has just joined your chat." + f"{MUSIC_BOT_NAME}'s Owner [{member.mention}] has just joined your chat." ) if member.id in SUDOERS: return await message.reply_text( - f"A member of {MUSIC_BOT_NAME}'s Sudo User[{member.mention}] has just joined your chat." - ) - if member.id == ASSID: - await remove_active_chat(chat_id) - if member.id == BOT_ID: - out = start_pannel() - await message.reply_text( - f"Welcome To {MUSIC_BOT_NAME}\n\nPromote me as administrator in your group otherwise I will not function properly.", - reply_markup=InlineKeyboardMarkup(out[1]), + f"A member of {MUSIC_BOT_NAME}'s Sudo User [{member.mention}] has just joined your chat." ) - return + return except: return -@app.on_message(filters.command(["help", "start"]) & filters.group) +#@app.on_message(filters.command(["help", "start"]) & filters.group) +#@PermissionCheck +#async def useradd(_, message: Message): +# out = start_pannel() +# await asyncio.gather( +# message.delete(), +# message.reply_text( +# f"Thanks for having me in {message.chat.title}.\n{MUSIC_BOT_NAME} is alive.\n\nFor any assistance or help, checkout our support group and channel.", +# reply_markup=InlineKeyboardMarkup(out[1]), +# ), +# ) + + +@app.on_message(filters.command("settings") & filters.group) @PermissionCheck -async def useradd(_, message: Message): - out = start_pannel() +async def settings(_, message: Message): + c_id = message.chat.id + _check = await get_start(c_id, "assistant") + if not _check: + assis = { + "volume": 100, + } + await save_start(c_id, "assistant", assis) + volume = 100 + else: + volume = _check["volume"] + text, buttons = setting_markup2() await asyncio.gather( message.delete(), message.reply_text( - f"Thanks for having me in {message.chat.title}.\n{MUSIC_BOT_NAME} is alive.\n\nFor any assistance or help, checkout our support group and channel.", - reply_markup=InlineKeyboardMarkup(out[1]), + f"{text}\n\n**Group:** {message.chat.title}\n**Group ID:** {message.chat.id}\n**Volume Level:** {volume}%", + reply_markup=InlineKeyboardMarkup(buttons), ), ) @@ -103,12 +139,12 @@ async def settingm(_, CallbackQuery): c_title = CallbackQuery.message.chat.title c_id = CallbackQuery.message.chat.id chat_id = CallbackQuery.message.chat.id - _check = await get_assistant(c_id, "assistant") + _check = await get_start(c_id, "assistant") if not _check: assis = { "volume": 100, } - await save_assistant(c_id, "assistant", assis) + await save_start(c_id, "assistant", assis) volume = 100 else: volume = _check["volume"] @@ -173,7 +209,7 @@ async def start_markup_check(_, CallbackQuery): if command == "AV": await CallbackQuery.answer("Bot Settings ...") text, buttons = volmarkup() - _check = await get_assistant(c_id, "assistant") + _check = await get_start(c_id, "assistant") volume = _check["volume"] await CallbackQuery.edit_message_text( text=f"{text}\n\n**Group:** {c_title}\n**Group ID:** {c_id}\n**Volume Level:** {volume}%\n**Audio Quality:** Default Best", @@ -194,7 +230,7 @@ async def start_markup_check(_, CallbackQuery): if command == "Dashboard": await CallbackQuery.answer("Dashboard...") text, buttons = dashmarkup() - _check = await get_assistant(c_id, "assistant") + _check = await get_start(c_id, "assistant") volume = _check["volume"] await CallbackQuery.edit_message_text( text=f"{text}\n\n**Group:** {c_title}\n**Group ID:** {c_id}\n**Volume Level:** {volume}%\n\nCheck {MUSIC_BOT_NAME}'s System Stats In the DashBoard Here! More Functions adding very soon! Keep on Checking Support Channel.", @@ -203,7 +239,7 @@ async def start_markup_check(_, CallbackQuery): if command == "Custommarkup": await CallbackQuery.answer("Bot Settings ...") text, buttons = custommarkup() - _check = await get_assistant(c_id, "assistant") + _check = await get_start(c_id, "assistant") volume = _check["volume"] await CallbackQuery.edit_message_text( text=f"{text}\n\n**Group:** {c_title}\n**Group ID:** {c_id}\n**Volume Level:** {volume}%\n**Audio Quality:** Default Best", @@ -219,7 +255,7 @@ async def start_markup_check(_, CallbackQuery): await CallbackQuery.answer("Setting Audio Changes ...") except: return await CallbackQuery.answer("No active Group Call...") - await save_assistant(c_id, "assistant", assis) + await save_start(c_id, "assistant", assis) text, buttons = volmarkup() await CallbackQuery.edit_message_text( text=f"{text}\n\n**Group:** {c_title}\n**Group ID:** {c_id}\n**Volume Level:** {volume}%\n**Audio Quality:** Default Best", @@ -235,7 +271,7 @@ async def start_markup_check(_, CallbackQuery): await CallbackQuery.answer("Setting Audio Changes ...") except: return await CallbackQuery.answer("No active Group Call...") - await save_assistant(c_id, "assistant", assis) + await save_start(c_id, "assistant", assis) text, buttons = volmarkup() await CallbackQuery.edit_message_text( text=f"{text}\n\n**Group:** {c_title}\n**Group ID:** {c_id}\n**Volume Level:** {volume}%\n**Audio Quality:** Default Best", @@ -251,7 +287,7 @@ async def start_markup_check(_, CallbackQuery): await CallbackQuery.answer("Setting Audio Changes ...") except: return await CallbackQuery.answer("No active Group Call...") - await save_assistant(c_id, "assistant", assis) + await save_start(c_id, "assistant", assis) text, buttons = volmarkup() await CallbackQuery.edit_message_text( text=f"{text}\n\n**Group:** {c_title}\n**Group ID:** {c_id}\n**Volume Level:** {volume}%\n**Audio Quality:** Default Best", @@ -267,14 +303,14 @@ async def start_markup_check(_, CallbackQuery): await CallbackQuery.answer("Setting Audio Changes ...") except: return await CallbackQuery.answer("No active Group Call...") - await save_assistant(c_id, "assistant", assis) + await save_start(c_id, "assistant", assis) text, buttons = volmarkup() await CallbackQuery.edit_message_text( text=f"{text}\n\n**Group:** {c_title}\n**Group ID:** {c_id}\n**Volume Level:** {volume}%\n**Audio Quality:** Default Best", reply_markup=InlineKeyboardMarkup(buttons), ) if command == "PTEN": - _check = await get_assistant(c_id, "assistant") + _check = await get_start(c_id, "assistant") volume = _check["volume"] volume = volume + 10 if int(volume) > 200: @@ -289,14 +325,14 @@ async def start_markup_check(_, CallbackQuery): await CallbackQuery.answer("Setting Audio Changes ...") except: return await CallbackQuery.answer("No active Group Call...") - await save_assistant(c_id, "assistant", assis) + await save_start(c_id, "assistant", assis) text, buttons = custommarkup() await CallbackQuery.edit_message_text( text=f"{text}\n\n**Group:** {c_title}\n**Group ID:** {c_id}\n**Volume Level:** {volume}%\n**Audio Quality:** Default Best", reply_markup=InlineKeyboardMarkup(buttons), ) if command == "MTEN": - _check = await get_assistant(c_id, "assistant") + _check = await get_start(c_id, "assistant") volume = _check["volume"] volume = volume - 10 if int(volume) > 200: @@ -311,14 +347,14 @@ async def start_markup_check(_, CallbackQuery): await CallbackQuery.answer("Setting Audio Changes ...") except: return await CallbackQuery.answer("No active Group Call...") - await save_assistant(c_id, "assistant", assis) + await save_start(c_id, "assistant", assis) text, buttons = custommarkup() await CallbackQuery.edit_message_text( text=f"{text}\n\n**Group:** {c_title}\n**Group ID:** {c_id}\n**Volume Level:** {volume}%\n**Audio Quality:** Default Best", reply_markup=InlineKeyboardMarkup(buttons), ) if command == "PTF": - _check = await get_assistant(c_id, "assistant") + _check = await get_start(c_id, "assistant") volume = _check["volume"] volume = volume + 25 if int(volume) > 200: @@ -333,14 +369,14 @@ async def start_markup_check(_, CallbackQuery): await CallbackQuery.answer("Setting Audio Changes ...") except: return await CallbackQuery.answer("No active Group Call...") - await save_assistant(c_id, "assistant", assis) + await save_start(c_id, "assistant", assis) text, buttons = custommarkup() await CallbackQuery.edit_message_text( text=f"{text}\n\n**Group:** {c_title}\n**Group ID:** {c_id}\n**Volume Level:** {volume}%\n**Audio Quality:** Default Best", reply_markup=InlineKeyboardMarkup(buttons), ) if command == "MTF": - _check = await get_assistant(c_id, "assistant") + _check = await get_start(c_id, "assistant") volume = _check["volume"] volume = volume - 25 if int(volume) > 200: @@ -355,14 +391,14 @@ async def start_markup_check(_, CallbackQuery): await CallbackQuery.answer("Setting Audio Changes ...") except: return await CallbackQuery.answer("No active Group Call...") - await save_assistant(c_id, "assistant", assis) + await save_start(c_id, "assistant", assis) text, buttons = custommarkup() await CallbackQuery.edit_message_text( text=f"{text}\n\n**Group:** {c_title}\n**Group ID:** {c_id}\n**Volume Level:** {volume}%\n**Audio Quality:** Default Best", reply_markup=InlineKeyboardMarkup(buttons), ) if command == "PFZ": - _check = await get_assistant(c_id, "assistant") + _check = await get_start(c_id, "assistant") volume = _check["volume"] volume = volume + 50 if int(volume) > 200: @@ -377,14 +413,14 @@ async def start_markup_check(_, CallbackQuery): await CallbackQuery.answer("Setting Audio Changes ...") except: return await CallbackQuery.answer("No active Group Call...") - await save_assistant(c_id, "assistant", assis) + await save_start(c_id, "assistant", assis) text, buttons = custommarkup() await CallbackQuery.edit_message_text( text=f"{text}\n\n**Group:** {c_title}\n**Group ID:** {c_id}\n**Volume Level:** {volume}%\n**Audio Quality:** Default Best", reply_markup=InlineKeyboardMarkup(buttons), ) if command == "MFZ": - _check = await get_assistant(c_id, "assistant") + _check = await get_start(c_id, "assistant") volume = _check["volume"] volume = volume - 50 if int(volume) > 200: @@ -399,7 +435,7 @@ async def start_markup_check(_, CallbackQuery): await CallbackQuery.answer("Setting Audio Changes ...") except: return await CallbackQuery.answer("No active Group Call...") - await save_assistant(c_id, "assistant", assis) + await save_start(c_id, "assistant", assis) text, buttons = custommarkup() await CallbackQuery.edit_message_text( text=f"{text}\n\n**Group:** {c_title}\n**Group ID:** {c_id}\n**Volume Level:** {volume}%\n**Audio Quality:** Default Best", From dbde81d87fb559b80a3ec378e2f01f0fed6b2a61 Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Mon, 20 Dec 2021 12:27:21 +0530 Subject: [PATCH 45/79] Shadow Music --- ShadowMusic/Plugins/Stats.py | 127 ++++++++++++++++++++++++++++++----- 1 file changed, 111 insertions(+), 16 deletions(-) diff --git a/ShadowMusic/Plugins/Stats.py b/ShadowMusic/Plugins/Stats.py index 795c369..27bfa77 100644 --- a/ShadowMusic/Plugins/Stats.py +++ b/ShadowMusic/Plugins/Stats.py @@ -8,28 +8,27 @@ import uuid from datetime import datetime from sys import version as pyver +import multiprocessing import psutil +from pymongo import MongoClient from pyrogram import Client from pyrogram import __version__ as pyrover from pyrogram import filters from pyrogram.types import Message -from ShadowMusic import (BOT_ID, MUSIC_BOT_NAME, SUDOERS, app, boottime, pymongodb, - userbot) +from config import MONGO_DB_URI +from ShadowMusic import (ASS_CLI_1, ASS_CLI_2, ASS_CLI_3, ASS_CLI_4, ASS_CLI_5, + BOT_ID, MUSIC_BOT_NAME, SUDOERS, app, boottime) from ShadowMusic.Database import get_gbans_count, get_served_chats, get_sudoers from ShadowMusic.Inline import (stats1, stats2, stats3, stats4, stats5, stats6, - stats7) + stats7) from ShadowMusic.Plugins import ALL_MODULES from ShadowMusic.Utilities.ping import get_readable_time __MODULE__ = "Stats" __HELP__ = """ - - -/stats -- Check the Stats of Bot. -- Gets the stat of MongoDb , Assistant, System etc +/stats: Check the Stats of Bot (Can get the stat of MongoDb , Assistant, System also) """ @@ -61,7 +60,7 @@ async def gstats(_, message): resp = (end - start).microseconds / 1000 smex = f""" [โข]**General Stats** - + Ping: `โก{resp} ms` {uptime} """ @@ -80,6 +79,7 @@ async def stats_markup(_, CallbackQuery): await CallbackQuery.answer("Getting System Stats...", show_alert=True) sc = platform.system() arch = platform.machine() + cpu_count = multiprocessing.cpu_count() ram = ( str(round(psutil.virtual_memory().total / (1024.0 ** 3))) + " GB" ) @@ -88,10 +88,11 @@ async def stats_markup(_, CallbackQuery): smex = f""" [โข]**System Stats** -**{MUSIC_BOT_NAME} Uptime:** {uptime} +**ShadowMusic Uptime:** {uptime} **System Proc:** Online **Platform:** {sc} **Architecture:** {arch} +**CPUs:** {cpu_count}v **Ram:** {ram} **Python Ver:** {pyver.split()[0]} **Pyrogram Ver:** {pyrover}""" @@ -110,7 +111,7 @@ async def stats_markup(_, CallbackQuery): smex = f""" [โข]**Storage Stats** -**Storage Avail:** {total[:4]} GiB +**Storage Avail:** {total[:4]} GiB **Storage Used:** {used[:4]} GiB **Storage Left:** {free[:4]} GiB""" await CallbackQuery.edit_message_text(smex, reply_markup=stats3) @@ -142,7 +143,20 @@ async def stats_markup(_, CallbackQuery): await CallbackQuery.answer( "Getting MongoDB Stats...", show_alert=True ) - db = pymongodb + try: + pymongo = MongoClient(MONGO_DB_URI) + except Exception as e: + print(e) + return await CallbackQuery.edit_message_text( + "Failed to get Mongo DB stats", reply_markup=stats5 + ) + try: + db = pymongo.Yukki + except Exception as e: + print(e) + return await CallbackQuery.edit_message_text( + "Failed to get Mongo DB stats", reply_markup=stats5 + ) call = db.command("dbstats") database = call["db"] datasize = call["dataSize"] / 1024 @@ -177,7 +191,11 @@ async def stats_markup(_, CallbackQuery): "Getting Assistant Stats.. Please Wait...", reply_markup=stats7 ) groups_ub = channels_ub = bots_ub = privates_ub = total_ub = 0 - async for i in userbot.iter_dialogs(): + groups_ub2 = channels_ub2 = bots_ub2 = privates_ub2 = total_ub2 = 0 + groups_ub3 = channels_ub3 = bots_ub3 = privates_ub3 = total_ub3 = 0 + groups_ub4 = channels_ub4 = bots_ub4 = privates_ub4 = total_ub4 = 0 + groups_ub5 = channels_ub5 = bots_ub5 = privates_ub5 = total_ub5 = 0 + async for i in ASS_CLI_1.iter_dialogs(): t = i.chat.type total_ub += 1 if t in ["supergroup", "group"]: @@ -189,14 +207,91 @@ async def stats_markup(_, CallbackQuery): elif t == "private": privates_ub += 1 + async for i in ASS_CLI_2.iter_dialogs(): + t = i.chat.type + total_ub2 += 1 + if t in ["supergroup", "group"]: + groups_ub2 += 1 + elif t == "channel": + channels_ub2 += 1 + elif t == "bot": + bots_ub2 += 1 + elif t == "private": + privates_ub2 += 1 + + async for i in ASS_CLI_3.iter_dialogs(): + t = i.chat.type + total_ub3 += 1 + if t in ["supergroup", "group"]: + groups_ub3 += 1 + elif t == "channel": + channels_ub3 += 1 + elif t == "bot": + bots_ub3 += 1 + elif t == "private": + privates_ub3 += 1 + + async for i in ASS_CLI_4.iter_dialogs(): + t = i.chat.type + total_ub4 += 1 + if t in ["supergroup", "group"]: + groups_ub4 += 1 + elif t == "channel": + channels_ub4 += 1 + elif t == "bot": + bots_ub4 += 1 + elif t == "private": + privates_ub4 += 1 + + async for i in ASS_CLI_5.iter_dialogs(): + t = i.chat.type + total_ub5 += 1 + if t in ["supergroup", "group"]: + groups_ub5 += 1 + elif t == "channel": + channels_ub5 += 1 + elif t == "bot": + bots_ub5 += 1 + elif t == "private": + privates_ub5 += 1 + smex = f""" [โข]Assistant Stats +Assistant One: **Dialogs:** {total_ub} -**Groups:** {groups_ub} -**Channels:** {channels_ub} +**Groups:** {groups_ub} +**Channels:** {channels_ub} **Bots:** {bots_ub} -**Users:** {privates_ub}""" +**Users:** {privates_ub} + +Assistant Two: +**Dialogs:** {total_ub2} +**Groups:** {groups_ub2} +**Channels:** {channels_ub2} +**Bots:** {bots_ub2} +**Users:** {privates_ub2} + +Assistant Three: +**Dialogs:** {total_ub3} +**Groups:** {groups_ub3} +**Channels:** {channels_ub3} +**Bots:** {bots_ub3} +**Users:** {privates_ub3} + +Assistant Four: +**Dialogs:** {total_ub4} +**Groups:** {groups_ub4} +**Channels:** {channels_ub4} +**Bots:** {bots_ub4} +**Users:** {privates_ub4} + +Assistant Five: +**Dialogs:** {total_ub5} +**Groups:** {groups_ub5} +**Channels:** {channels_ub5} +**Bots:** {bots_ub5} +**Users:** {privates_ub5}""" await CallbackQuery.edit_message_text(smex, reply_markup=stats6) if command == "gen_stats": start = datetime.now() From e102f65fce14bab7fbe398dba79d61613c592582 Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Mon, 20 Dec 2021 12:33:31 +0530 Subject: [PATCH 46/79] Shadow Music --- ShadowMusic/Plugins/SudoUsers.py | 36 ++++++++------------------------ 1 file changed, 9 insertions(+), 27 deletions(-) diff --git a/ShadowMusic/Plugins/SudoUsers.py b/ShadowMusic/Plugins/SudoUsers.py index 8fd5c31..3644ef0 100644 --- a/ShadowMusic/Plugins/SudoUsers.py +++ b/ShadowMusic/Plugins/SudoUsers.py @@ -17,33 +17,15 @@ __MODULE__ = "SudoUsers" __HELP__ = """ - - -/sudolist - Check the sudo user list of Bot. - - -**Note:** -Only for Sudo Users. - - -/addsudo [Username or Reply to a user] -- To Add A User In Bot's Sudo Users. - -/delsudo [Username or Reply to a user] -- To Remove A User from Bot's Sudo Users. - -/restart -- Restart Bot [All downloads, cache, raw files will be cleared too]. - -/maintenance [enable / disable] -- When enabled Bot goes under maintenance mode. No one can play Music now! - -/update -- Fetch Updates from Server. - -/clean -- Clean Temp Files and Logs. +/sudolist: Check the sudo user list of Bot. + +**Only for Sudo Users** +- /addsudo [Username or Reply to a user]: To Add A User In Bot's Sudo Users. +- /delsudo [Username or Reply to a user]: To Remove A User from Bot's Sudo Users. +- /restart: Restart Bot [All downloads, cache, raw files will be cleared too]. +- /maintenance [enable / disable]: When enabled Bot goes under maintenance mode. No one can play Music now! +- /update: Fetch Updates from Server. +- /clean: Clean Temp Files and Logs. """ # Add Sudo Users! From 35b0aa5913d3a2b1b200c6b2771358af783530ec Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Mon, 20 Dec 2021 12:34:39 +0530 Subject: [PATCH 47/79] Shadow Music --- ShadowMusic/Plugins/Theme.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/ShadowMusic/Plugins/Theme.py b/ShadowMusic/Plugins/Theme.py index 8c1d809..af83e28 100644 --- a/ShadowMusic/Plugins/Theme.py +++ b/ShadowMusic/Plugins/Theme.py @@ -31,13 +31,8 @@ __MODULE__ = "Theme" __HELP__ = """ - - -/settheme -- Set a theme for thumbnails. - -/theme -- Check Theme for your chat. +- /settheme: Set a theme for thumbnails. +- /theme: Check Theme for your chat. """ From 361637d6ec78388e6a0ea392a5bdc229bd2205c7 Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Mon, 20 Dec 2021 12:54:48 +0530 Subject: [PATCH 48/79] Shadow Music --- ShadowMusic/Inline/assistant.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 ShadowMusic/Inline/assistant.py diff --git a/ShadowMusic/Inline/assistant.py b/ShadowMusic/Inline/assistant.py new file mode 100644 index 0000000..805dc36 --- /dev/null +++ b/ShadowMusic/Inline/assistant.py @@ -0,0 +1,21 @@ +from pyrogram.types import InlineKeyboardButton + + +def leaveall_markup(user_id): + buttons = [ + [ + InlineKeyboardButton(text="Assistant 1", callback_data="Assistant_1"), + InlineKeyboardButton(text="Assistant 2", callback_data="Assistant_2"), + ], + [ + InlineKeyboardButton(text="Assistant 3", callback_data="Assistant_3"), + InlineKeyboardButton(text="Assistant 4", callback_data="Assistant_4"), + ], + [ + InlineKeyboardButton(text="Assistant 5", callback_data="Assistant_5"), + ], + [ + InlineKeyboardButton(text="๐ Close", callback_data=f"close"), + ] + ] + return buttons From 8ee080cb4e92b489025a0845aa719066011b0ad7 Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Mon, 20 Dec 2021 12:55:26 +0530 Subject: [PATCH 49/79] Shadow Music --- ShadowMusic/Inline/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/ShadowMusic/Inline/__init__.py b/ShadowMusic/Inline/__init__.py index 84e3d7e..06a5001 100644 --- a/ShadowMusic/Inline/__init__.py +++ b/ShadowMusic/Inline/__init__.py @@ -1,3 +1,4 @@ +from .assistant import leaveall_markup from .others import download_markup, others_markup from .play import (audio_markup, audio_markup2, audio_timer_markup_start, primary_markup, search_markup, search_markup2, From e1f11977d614f47d0a7455ba3abf78accad881f8 Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Mon, 20 Dec 2021 13:26:43 +0530 Subject: [PATCH 50/79] Shadow --- ShadowMusic/Plugins/Voicechat.py | 160 +++++++++++++++++++++---------- 1 file changed, 111 insertions(+), 49 deletions(-) diff --git a/ShadowMusic/Plugins/Voicechat.py b/ShadowMusic/Plugins/Voicechat.py index 4e21b7c..b86152d 100644 --- a/ShadowMusic/Plugins/Voicechat.py +++ b/ShadowMusic/Plugins/Voicechat.py @@ -4,40 +4,29 @@ import subprocess from sys import version as pyver -from config import get_queue from pyrogram import Client, filters -from pyrogram.types import Message - -from ShadowMusic import SUDOERS, app, db_mem, userbot -from ShadowMusic.Database import get_active_chats, is_active_chat -from ShadowMusic.Decorators.checker import checker, checkerCB -from ShadowMusic.Inline import primary_markup - from pyrogram.types import (InlineKeyboardMarkup, InputMediaPhoto, Message, Voice) +from config import get_queue +from ShadowMusic import SUDOERS, app, db_mem, ASS_CLI_1, ASS_CLI_2, ASS_CLI_3, ASS_CLI_4, ASS_CLI_5 +from ShadowMusic.Database import (get_active_chats, get_assistant, is_active_chat, + save_assistant) +from ShadowMusic.Decorators.checker import checker, checkerCB +from ShadowMusic.Inline import primary_markup, leaveall_markup +from ShadowMusic.Utilities.assistant import get_assistant_details, random_assistant + loop = asyncio.get_event_loop() __MODULE__ = "Join/Leave" __HELP__ = """ - -**Note:** -Only for Sudo Users - - -/joinassistant [Chat Username or Chat ID] -- Join assistant to a group. - -/leaveassistant [Chat Username or Chat ID] -- Assistant will leave the particular group. - -/leavebot [Chat Username or Chat ID] -- Bot will leave the particular chat. - +**Only for Sudo Users** +- /joinassistant [Chat Username or Chat ID]: Join assistant to a group. +- /leaveassistant [Chat Username or Chat ID]: Assistant will leave the particular group. +- /leavebot [Chat Username or Chat ID]: Bot will leave the particular chat. """ - @app.on_callback_query(filters.regex("pr_go_back_timer")) async def pr_go_back_timer(_, CallbackQuery): await CallbackQuery.answer() @@ -49,10 +38,10 @@ async def pr_go_back_timer(_, CallbackQuery): dur_left = db_mem[CallbackQuery.message.chat.id]["left"] duration_min = db_mem[CallbackQuery.message.chat.id]["total"] buttons = primary_markup(videoid, user_id, dur_left, duration_min) - await CallbackQuery.edit_message_reply_markup(reply_markup=InlineKeyboardMarkup(buttons)) - - - + await CallbackQuery.edit_message_reply_markup( + reply_markup=InlineKeyboardMarkup(buttons) + ) + @app.on_callback_query(filters.regex("timer_checkup_markup")) async def timer_checkup_markup(_, CallbackQuery): @@ -167,7 +156,23 @@ async def basffy(_, message): return chat = message.text.split(None, 2)[1] try: - await userbot.join_chat(chat) + chat_id = (await app.get_chat(chat)).id + except: + return await message.reply_text( + "Add Bot to this Chat First.. Unknown Chat for the bot" + ) + _assistant = await get_assistant(chat_id, "assistant") + if not _assistant: + return await message.reply_text( + "No Pre-Saved Assistant Found.\n\nYou can set Assistant Via /play inside {Chat}'s Group" + ) + else: + ran_ass = _assistant["saveassistant"] + ASS_ID, ASS_NAME, ASS_USERNAME, ASS_ACC = await get_assistant_details( + ran_ass + ) + try: + await ASS_ACC.join_chat(chat_id) except Exception as e: await message.reply_text(f"Failed\n**Possible reason could be**:{e}") return @@ -200,31 +205,88 @@ async def baujaf(_, message): return chat = message.text.split(None, 2)[1] try: - await userbot.leave_chat(chat) + chat_id = (await app.get_chat(chat)).id + except: + return await message.reply_text( + "Add Bot to this Chat First.. Unknown Chat for the bot" + ) + _assistant = await get_assistant(chat, "assistant") + if not _assistant: + return await message.reply_text( + "No Pre-Saved Assistant Found.\n\nYou can set Assistant Via /play inside {Chat}'s Group" + ) + else: + ran_ass = _assistant["saveassistant"] + ASS_ID, ASS_NAME, ASS_USERNAME, ASS_ACC = await get_assistant_details( + ran_ass + ) + try: + await ASS_ACC.leave_chat(chat_id) except Exception as e: await message.reply_text(f"Failed\n**Possible reason could be**:{e}") return await message.reply_text("Left.") -@app.on_message(filters.command(["leaveall"])) + +@app.on_message(filters.command(["leaveall"]) & filters.private) async def bye(client, message): + user_id = message.from_user.id + sed = await message.reply("**Processing...**") if message.from_user.id in SUDOERS: - left = 0 - failed = 0 - lol = await message.reply("Assistant Leaving all chats") - async for dialog in userbot.iter_dialogs(): - try: - await userbot.leave_chat(dialog.chat.id) - left = left + 1 - await lol.edit( - f"Assistant leaving... Left: {left} chats. Failed: {failed} chats." - ) - except: - failed = failed + 1 - await lol.edit( - f"Assistant leaving... Left: {left} chats. Failed: {failed} chats." - ) - await asyncio.sleep(0.7) - await client.send_message( - message.chat.id, f"Left {left} chats. Failed {failed} chats." - ) + buttons = leaveall_markup(user_id) + await sed.edit("Choose the assistant...", reply_markup=InlineKeyboardMarkup(buttons)) + else: + return await sed.edit("You aren't allowed") + + +@app.on_callback_query(filters.regex(pattern=r"^(Assistant_1|Assistant_2|Assistant_3|Assistant_4|Assistant_5)$")) +async def leaveall(b, cb): + + data = cb.matches[0].group(1) + + if data == "Assistant_1": + userbot = ASS_CLI_1 + text = "Assistant 1 Leaving all chats" + await cb.answer(f"{text}") + + if data == "Assistant_2": + userbot = ASS_CLI_2 + text = "Assistant 2 Leaving all chats" + await cb.answer(f"{text}") + + if data == "Assistant_3": + userbot = ASS_CLI_3 + text = "Assistant 3 Leaving all chats" + await cb.answer(f"{text}") + + if data == "Assistant_4": + userbot = ASS_CLI_4 + text = "Assistant 4 Leaving all chats" + await cb.answer(f"{text}") + + if data == "Assistant_5": + userbot = ASS_CLI_5 + text = "Assistant 5 Leaving all chats" + await cb.answer(f"{text}") + + await cb.message.delete() + lol = await cb.message.reply(f"{text}") + + left = 0 + failed = 0 + + async for dialog in userbot.iter_dialogs(): + try: + await userbot.leave_chat(dialog.chat.id) + left = left + 1 + await lol.edit( + f"{text[:11]}... Left: {left} chats. Failed: {failed} chats." + ) + except: + failed = failed + 1 + await lol.edit( + f"{text[:11]}... Left: {left} chats. Failed: {failed} chats." + ) + await asyncio.sleep(0.7) + await lol.delete() + await client.send_message(cb.message.chat.id, f"Left {left} chats. Failed {failed} chats.") From 169ad6ff23a8e26b3d4e6f4c4215e4e59d8854ae Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Mon, 20 Dec 2021 13:27:59 +0530 Subject: [PATCH 51/79] Shadow Music --- ShadowMusic/Plugins/Voicechat.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ShadowMusic/Plugins/Voicechat.py b/ShadowMusic/Plugins/Voicechat.py index b86152d..e05e957 100644 --- a/ShadowMusic/Plugins/Voicechat.py +++ b/ShadowMusic/Plugins/Voicechat.py @@ -5,8 +5,7 @@ from sys import version as pyver from pyrogram import Client, filters -from pyrogram.types import (InlineKeyboardMarkup, InputMediaPhoto, Message, - Voice) +from pyrogram.types import (InlineKeyboardMarkup, InputMediaPhoto, Message, Voice) from config import get_queue from ShadowMusic import SUDOERS, app, db_mem, ASS_CLI_1, ASS_CLI_2, ASS_CLI_3, ASS_CLI_4, ASS_CLI_5 From 057a9b3d7c1f416a8fcd84323427aa3249862cad Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Mon, 20 Dec 2021 13:37:31 +0530 Subject: [PATCH 52/79] Shadow Music --- config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.py b/config.py index 50f3f94..db3b661 100644 --- a/config.py +++ b/config.py @@ -15,7 +15,7 @@ BOT_TOKEN = getenv("BOT_TOKEN") API_ID = int(getenv("API_ID", "")) API_HASH = getenv("API_HASH") -DURATION_LIMIT_MIN = int(getenv("DURATION_LIMIT", "10")) +DURATION_LIMIT_MIN = int(getenv("DURATION_LIMIT", "3600")) ASSISTANT_PREFIX = list(getenv("ASSISTANT_PREFIX", ".").split()) MONGO_DB_URI = getenv("MONGO_DB_URI") SUDO_USERS = list(map(int, getenv("SUDO_USERS", "").split())) From cbf5dc9fd195e3e7d3b933601243228a935fa2d3 Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Fri, 31 Dec 2021 15:42:10 +0530 Subject: [PATCH 53/79] Shadow Music --- ShadowMusic/__main__.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/ShadowMusic/__main__.py b/ShadowMusic/__main__.py index d92fd83..c939284 100644 --- a/ShadowMusic/__main__.py +++ b/ShadowMusic/__main__.py @@ -16,7 +16,7 @@ ASSNAME3, ASSNAME4, ASSNAME5, BOT_ID, BOT_NAME, app) from ShadowMusic.Core.Logger.Log import (startup_delete_last, startup_edit_last, startup_send_new) -from ShadowMusic.Core.PyTgCalls.Yukki import (pytgcalls1, pytgcalls2, pytgcalls3, +from ShadowMusic.Core.PyTgCalls.Shadow import (pytgcalls1, pytgcalls2, pytgcalls3, pytgcalls4, pytgcalls5) from ShadowMusic.Database import get_active_chats, get_sudoers, remove_active_chat from ShadowMusic.Inline import private_panel @@ -102,7 +102,7 @@ async def initiate_bot(): try: await ASS_CLI_1.send_message( LOG_GROUP_ID, - "โ Assistant Client 1๏ธโฃ successfully!", + "โ Assistant Client 1๏ธโฃ started successfully!", ) except Exception as e: print( @@ -113,12 +113,13 @@ async def initiate_bot(): try: await ASS_CLI_1.join_chat("ShadowSupport_Official") await ASS_CLI_1.join_chat("ShadowBotUpdates") + await ASS_CLI_1.join_chat("ShadowBotChat") except: pass try: await ASS_CLI_2.send_message( LOG_GROUP_ID, - "โ Assistant Client 2๏ธโฃ successfully!", + "โ Assistant Client 2๏ธโฃ started successfully!", ) except Exception as e: print( @@ -129,12 +130,13 @@ async def initiate_bot(): try: await ASS_CLI_2.join_chat("ShadowSupport_Official") await ASS_CLI_2.join_chat("ShadowBotUpdates") + await ASS_CLI_2.join_chat("ShadowBotChat") except: pass try: await ASS_CLI_3.send_message( LOG_GROUP_ID, - "โ Assistant Client 3๏ธโฃ successfully!", + "โ Assistant Client 3๏ธโฃ started successfully!", ) except Exception as e: print( @@ -145,12 +147,13 @@ async def initiate_bot(): try: await ASS_CLI_3.join_chat("ShadowSupport_Official") await ASS_CLI_3.join_chat("ShadowBotUpdates") + await ASS_CLI_3.join_chat("ShadowBotChat") except: pass try: await ASS_CLI_4.send_message( LOG_GROUP_ID, - "โ Assistant Client 4๏ธโฃ successfully!", + "โ Assistant Client 4๏ธโฃ started successfully!", ) except Exception as e: print( @@ -161,12 +164,13 @@ async def initiate_bot(): try: await ASS_CLI_4.join_chat("ShadowSupport_Official") await ASS_CLI_4.join_chat("ShadowBotUpdates") + await ASS_CLI_4.join_chat("ShadowBotChat") except: pass try: await ASS_CLI_5.send_message( LOG_GROUP_ID, - "โ Assistant Client 5๏ธโฃ successfully!", + "โ Assistant Client 5๏ธโฃ started successfully!", ) except Exception as e: print( @@ -177,6 +181,7 @@ async def initiate_bot(): try: await ASS_CLI_5.join_chat("ShadowSupport_Official") await ASS_CLI_5.join_chat("ShadowBotUpdates") + await ASS_CLI_5.join_chat("ShadowBotChat") except: pass console.print(f"\nโ[red] Bot Started as {BOT_NAME}!") From 27cae9a53e62c12b4f9b10fe8139e0690ab9e269 Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Fri, 31 Dec 2021 16:27:19 +0530 Subject: [PATCH 54/79] Shadow Music --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index dd2251f..d5b3f6a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,7 @@ aiofiles asyncio ffmpeg-python pillow -pyrogram +git+https://github.com/pyrogram/pyrogram@master hachoir lyricsgenius py-tgcalls==0.8.1 From d06214c8f40654462940a7154d74af3180534a56 Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Fri, 31 Dec 2021 16:28:58 +0530 Subject: [PATCH 55/79] Shadow Music --- app.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app.json b/app.json index 2450f33..e42ed10 100644 --- a/app.json +++ b/app.json @@ -73,22 +73,22 @@ "STRING_SESSION2": { "description": "A Pyrogram String Session of Assistant Account.", "value": "", - "required": false + "required": true }, "STRING_SESSION3": { "description": "A Pyrogram String Session of Assistant Account.", "value": "", - "required": false + "required": true }, "STRING_SESSION4": { "description": "A Pyrogram String Session of Assistant Account.", "value": "", - "required": false + "required": true }, "STRING_SESSION5": { "description": "A Pyrogram String Session of Assistant Account.", "value": "", - "required": false + "required": true }, "LOG_GROUP_ID": { "description": "Your Log Group ID, add your bot and promote as an admin with full rights!. Use only Group. Please don't use Channel ID.", From abb3d5725294cd35715e4ca0a4edcafa96c469ea Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Fri, 31 Dec 2021 16:48:53 +0530 Subject: [PATCH 56/79] Shadow Music --- ShadowMusic/Plugins/Admins.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ShadowMusic/Plugins/Admins.py b/ShadowMusic/Plugins/Admins.py index 0581112..cea0972 100644 --- a/ShadowMusic/Plugins/Admins.py +++ b/ShadowMusic/Plugins/Admins.py @@ -13,7 +13,7 @@ from ShadowMusic.Core.PyTgCalls import Queues from ShadowMusic.Core.PyTgCalls.Converter import convert from ShadowMusic.Core.PyTgCalls.Downloader import download -from ShadowMusic.Core.PyTgCalls.Yukki import (pause_stream, resume_stream, +from ShadowMusic.Core.PyTgCalls.Shadow import (pause_stream, resume_stream, skip_stream, stop_stream) from ShadowMusic.Database import (is_active_chat, is_music_playing, music_off, music_on, remove_active_chat) From c3a7f6c354a626b8aa4f71d07bfd795b61a1906d Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Fri, 31 Dec 2021 17:09:57 +0530 Subject: [PATCH 57/79] Shadow Music --- ShadowMusic/Utilities/assistant.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ShadowMusic/Utilities/assistant.py b/ShadowMusic/Utilities/assistant.py index 659442c..9927a57 100644 --- a/ShadowMusic/Utilities/assistant.py +++ b/ShadowMusic/Utilities/assistant.py @@ -1,4 +1,4 @@ -from Shadow import (ASS_CLI_1, ASS_CLI_2, ASS_CLI_3, ASS_CLI_4, ASS_CLI_5, +from ShadowMusic import (ASS_CLI_1, ASS_CLI_2, ASS_CLI_3, ASS_CLI_4, ASS_CLI_5, ASSID1, ASSID2, ASSID3, ASSID4, ASSID5, ASSNAME1, ASSNAME2, ASSNAME3, ASSNAME4, ASSNAME5, ASSUSERNAME1, ASSUSERNAME2, ASSUSERNAME3, ASSUSERNAME4, ASSUSERNAME5) From 3f04d2fc52bbb2b96e5d5f7ca8a88b0a20e667e8 Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Fri, 31 Dec 2021 20:21:18 +0530 Subject: [PATCH 58/79] Shadow Music --- ShadowMusic/Decorators/assistant.py | 1 + 1 file changed, 1 insertion(+) diff --git a/ShadowMusic/Decorators/assistant.py b/ShadowMusic/Decorators/assistant.py index 89b3acf..e5bcbb1 100644 --- a/ShadowMusic/Decorators/assistant.py +++ b/ShadowMusic/Decorators/assistant.py @@ -1,3 +1,4 @@ +import asyncio import random from typing import Dict, List, Union From 74b581a994a0f595cac87708456fa8a88835302b Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Fri, 31 Dec 2021 20:22:06 +0530 Subject: [PATCH 59/79] Shadow Music --- ShadowMusic/Inline/others.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/ShadowMusic/Inline/others.py b/ShadowMusic/Inline/others.py index 402ec60..10ffb58 100644 --- a/ShadowMusic/Inline/others.py +++ b/ShadowMusic/Inline/others.py @@ -9,12 +9,6 @@ def others_markup(videoid, user_id): db_mem[videoid] = {} db_mem[videoid]["check"] = 1 buttons = [ - [ - InlineKeyboardButton( - text="๐ Search Lyrics", - callback_data=f"lyrics {videoid}|{user_id}", - ) - ], [ InlineKeyboardButton( text="โ Your Playlist", From eae5311d2d98f399e2b03e7e1243e50c1ca0b7b8 Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Fri, 31 Dec 2021 20:24:41 +0530 Subject: [PATCH 60/79] Shadow Music --- ShadowMusic/Inline/play.py | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/ShadowMusic/Inline/play.py b/ShadowMusic/Inline/play.py index 15a3d6f..07f7e9c 100644 --- a/ShadowMusic/Inline/play.py +++ b/ShadowMusic/Inline/play.py @@ -8,7 +8,7 @@ def url_markup(videoid, duration, user_id, query, query_type): buttons = [ [ InlineKeyboardButton( - text="ยซ", + text="โฌ ๏ธ", callback_data=f"slider B|{query_type}|{query}|{user_id}", ), InlineKeyboardButton( @@ -16,7 +16,7 @@ def url_markup(videoid, duration, user_id, query, query_type): callback_data=f"ShadowMusic {videoid}|{duration}|{user_id}", ), InlineKeyboardButton( - text="ยป", + text="โก๏ธ", callback_data=f"slider F|{query_type}|{query}|{user_id}", ), ], @@ -86,10 +86,10 @@ def search_markup( ], [ InlineKeyboardButton( - text="ยซ", callback_data=f"popat 1|{query}|{user_id}" + text="โฌ ๏ธ", callback_data=f"popat 1|{query}|{user_id}" ), InlineKeyboardButton( - text="ยป", callback_data=f"popat 1|{query}|{user_id}" + text="โก๏ธ", callback_data=f"popat 1|{query}|{user_id}" ), ], [ @@ -142,10 +142,10 @@ def search_markup2( ], [ InlineKeyboardButton( - text="ยซ", callback_data=f"popat 2|{query}|{user_id}" + text="โฌ ๏ธ", callback_data=f"popat 2|{query}|{user_id}" ), InlineKeyboardButton( - text="ยป", callback_data=f"popat 2|{query}|{user_id}" + text="โก๏ธ", callback_data=f"popat 2|{query}|{user_id}" ), ], [ @@ -166,6 +166,10 @@ def secondary_markup(videoid, user_id): InlineKeyboardButton(text="โน๏ธ", callback_data=f"stopcb"), ], [ + InlineKeyboardButton( + text="๐ Search Lyrics", + callback_data=f"lyrics {videoid}|{user_id}", + ) InlineKeyboardButton( text="๐ More Menu", callback_data=f"other {videoid}|{user_id}" ), @@ -193,6 +197,10 @@ def primary_markup(videoid, user_id, current_time, total_time): InlineKeyboardButton(text="โน๏ธ", callback_data=f"stopcb"), ], [ + InlineKeyboardButton( + text="๐ Search Lyrics", + callback_data=f"lyrics {videoid}|{user_id}", + ) InlineKeyboardButton( text="๐ More Menu", callback_data=f"other {videoid}|{user_id}" ), @@ -217,6 +225,10 @@ def timer_markup(videoid, user_id, current_time, total_time): InlineKeyboardButton(text="โน๏ธ", callback_data=f"stopcb"), ], [ + InlineKeyboardButton( + text="๐ Search Lyrics", + callback_data=f"lyrics {videoid}|{user_id}", + ) InlineKeyboardButton( text="๐ More Menu", callback_data=f"other {videoid}|{user_id}" ), From 26ad501b2da233b5a95feca1ff64ea77e0eb84e1 Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Sat, 1 Jan 2022 08:25:10 +0530 Subject: [PATCH 61/79] Shadow Music --- ShadowMusic/Inline/play.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ShadowMusic/Inline/play.py b/ShadowMusic/Inline/play.py index 07f7e9c..7057502 100644 --- a/ShadowMusic/Inline/play.py +++ b/ShadowMusic/Inline/play.py @@ -12,7 +12,7 @@ def url_markup(videoid, duration, user_id, query, query_type): callback_data=f"slider B|{query_type}|{query}|{user_id}", ), InlineKeyboardButton( - text="Play Now", + text="๐ถ Play Now", callback_data=f"ShadowMusic {videoid}|{duration}|{user_id}", ), InlineKeyboardButton( @@ -38,7 +38,7 @@ def url_markup2(videoid, duration, user_id): buttons = [ [ InlineKeyboardButton( - text="โถ๏ธ Play Now", + text="๐ถ Play Now", callback_data=f"ShadowMusic {videoid}|{duration}|{user_id}", ), InlineKeyboardButton( @@ -169,7 +169,7 @@ def secondary_markup(videoid, user_id): InlineKeyboardButton( text="๐ Search Lyrics", callback_data=f"lyrics {videoid}|{user_id}", - ) + ), InlineKeyboardButton( text="๐ More Menu", callback_data=f"other {videoid}|{user_id}" ), @@ -200,7 +200,7 @@ def primary_markup(videoid, user_id, current_time, total_time): InlineKeyboardButton( text="๐ Search Lyrics", callback_data=f"lyrics {videoid}|{user_id}", - ) + ), InlineKeyboardButton( text="๐ More Menu", callback_data=f"other {videoid}|{user_id}" ), @@ -228,7 +228,7 @@ def timer_markup(videoid, user_id, current_time, total_time): InlineKeyboardButton( text="๐ Search Lyrics", callback_data=f"lyrics {videoid}|{user_id}", - ) + ), InlineKeyboardButton( text="๐ More Menu", callback_data=f"other {videoid}|{user_id}" ), From 89b4b17568edce79bd8246cdbd57d7ffc1e9ba51 Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Sat, 1 Jan 2022 08:27:48 +0530 Subject: [PATCH 62/79] Shadow Music --- ShadowMusic/Inline/others.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ShadowMusic/Inline/others.py b/ShadowMusic/Inline/others.py index 10ffb58..4a4af03 100644 --- a/ShadowMusic/Inline/others.py +++ b/ShadowMusic/Inline/others.py @@ -21,7 +21,7 @@ def others_markup(videoid, user_id): ], [ InlineKeyboardButton( - text="โฌ๏ธ Download Audio/Video", + text="๐ฅ Download Audio/Video", callback_data=f"audio_video_download {videoid}|{user_id}", ) ], @@ -43,11 +43,11 @@ def download_markup(videoid, user_id): buttons = [ [ InlineKeyboardButton( - text="โฌ๏ธ Get Audio", + text="๐ฅ Get Audio", callback_data=f"gets audio|{videoid}|{user_id}", ), InlineKeyboardButton( - text="โฌ๏ธ Get Video", + text="๐ฅ Get Video", callback_data=f"gets video|{videoid}|{user_id}", ), ], From ba1f4928713331f64698de7be1161812943237ac Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Sat, 1 Jan 2022 08:44:54 +0530 Subject: [PATCH 63/79] Shadow Music --- ShadowMusic/Decorators/assistant.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ShadowMusic/Decorators/assistant.py b/ShadowMusic/Decorators/assistant.py index e5bcbb1..ef2a7ce 100644 --- a/ShadowMusic/Decorators/assistant.py +++ b/ShadowMusic/Decorators/assistant.py @@ -47,7 +47,7 @@ async def wrapper(_, message): inv_lnk = inv_lnk.replace("https://t.me/+","https://t.me/joinchat/") await asyncio.sleep(10) await ASS_ACC.join_chat(inv_lnk) - await message.reply(f"{ASSNAME} Joined Successfully") + await message.reply("Shadow Helper Joined Successfully") except UserAlreadyParticipant: pass except Exception as e: From 528e95b4381a301b1c1be3c4f70815810a52d745 Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Sat, 1 Jan 2022 08:50:10 +0530 Subject: [PATCH 64/79] Shadow Music --- ShadowMusic/Decorators/assistant.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ShadowMusic/Decorators/assistant.py b/ShadowMusic/Decorators/assistant.py index ef2a7ce..ad58eb9 100644 --- a/ShadowMusic/Decorators/assistant.py +++ b/ShadowMusic/Decorators/assistant.py @@ -47,7 +47,7 @@ async def wrapper(_, message): inv_lnk = inv_lnk.replace("https://t.me/+","https://t.me/joinchat/") await asyncio.sleep(10) await ASS_ACC.join_chat(inv_lnk) - await message.reply("Shadow Helper Joined Successfully") + await message.reply(f"{ASS_NAME} Joined Successfully") except UserAlreadyParticipant: pass except Exception as e: From baf8abee2222174a5a59265d734aa050efd990fa Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Sat, 1 Jan 2022 09:06:52 +0530 Subject: [PATCH 65/79] Shadow Music --- ShadowMusic/Inline/play.py | 169 +++++++++++-------------------------- 1 file changed, 48 insertions(+), 121 deletions(-) diff --git a/ShadowMusic/Inline/play.py b/ShadowMusic/Inline/play.py index 7057502..c47d2d7 100644 --- a/ShadowMusic/Inline/play.py +++ b/ShadowMusic/Inline/play.py @@ -7,28 +7,13 @@ def url_markup(videoid, duration, user_id, query, query_type): buttons = [ [ - InlineKeyboardButton( - text="โฌ ๏ธ", - callback_data=f"slider B|{query_type}|{query}|{user_id}", - ), - InlineKeyboardButton( - text="๐ถ Play Now", - callback_data=f"ShadowMusic {videoid}|{duration}|{user_id}", - ), - InlineKeyboardButton( - text="โก๏ธ", - callback_data=f"slider F|{query_type}|{query}|{user_id}", - ), + InlineKeyboardButton(text="โฌ ๏ธ", callback_data=f"slider B|{query_type}|{query}|{user_id}"), + InlineKeyboardButton(text="๐ถ Play Now", callback_data=f"ShadowMusic {videoid}|{duration}|{user_id}"), + InlineKeyboardButton(text="โก๏ธ", callback_data=f"slider F|{query_type}|{query}|{user_id}"), ], [ - InlineKeyboardButton( - text="๐ More Results", - callback_data=f"Search {query}|{user_id}", - ), - InlineKeyboardButton( - text="๐ Close Search", - callback_data=f"forceclose {query}|{user_id}", - ), + InlineKeyboardButton(text="๐ More Results", callback_data=f"Search {query}|{user_id}"), + InlineKeyboardButton(text="๐ Close Search", callback_data=f"forceclose {query}|{user_id}"), ], ] return buttons @@ -37,14 +22,8 @@ def url_markup(videoid, duration, user_id, query, query_type): def url_markup2(videoid, duration, user_id): buttons = [ [ - InlineKeyboardButton( - text="๐ถ Play Now", - callback_data=f"ShadowMusic {videoid}|{duration}|{user_id}", - ), - InlineKeyboardButton( - text="๐ Close Search", - callback_data=f"forceclose {videoid}|{user_id}", - ), + InlineKeyboardButton(text="๐ถ Play Now", callback_data=f"ShadowMusic {videoid}|{duration}|{user_id}"), + InlineKeyboardButton(text="๐ Close Search", callback_data=f"forceclose {videoid}|{user_id}"), ], ] return buttons @@ -66,36 +45,20 @@ def search_markup( ): buttons = [ [ - InlineKeyboardButton( - text="1๏ธโฃ", callback_data=f"ShadowMusic {ID1}|{duration1}|{user_id}" - ), - InlineKeyboardButton( - text="2๏ธโฃ", callback_data=f"ShadowMusic {ID2}|{duration2}|{user_id}" - ), - InlineKeyboardButton( - text="3๏ธโฃ", callback_data=f"ShadowMusic {ID3}|{duration3}|{user_id}" - ), + InlineKeyboardButton(text="1๏ธโฃ", callback_data=f"ShadowMusic {ID1}|{duration1}|{user_id}"), + InlineKeyboardButton(text="2๏ธโฃ", callback_data=f"ShadowMusic {ID2}|{duration2}|{user_id}"), + InlineKeyboardButton(text="3๏ธโฃ", callback_data=f"ShadowMusic {ID3}|{duration3}|{user_id}"), ], [ - InlineKeyboardButton( - text="4๏ธโฃ", callback_data=f"ShadowMusic {ID4}|{duration4}|{user_id}" - ), - InlineKeyboardButton( - text="5๏ธโฃ", callback_data=f"ShadowMusic {ID5}|{duration5}|{user_id}" - ), + InlineKeyboardButton(text="4๏ธโฃ", callback_data=f"ShadowMusic {ID4}|{duration4}|{user_id}"), + InlineKeyboardButton(text="5๏ธโฃ", callback_data=f"ShadowMusic {ID5}|{duration5}|{user_id}"), ], [ - InlineKeyboardButton( - text="โฌ ๏ธ", callback_data=f"popat 1|{query}|{user_id}" - ), - InlineKeyboardButton( - text="โก๏ธ", callback_data=f"popat 1|{query}|{user_id}" - ), + InlineKeyboardButton(text="โฌ ๏ธ", callback_data=f"popat 1|{query}|{user_id}"), + InlineKeyboardButton(text="โก๏ธ", callback_data=f"popat 1|{query}|{user_id}"), ], [ - InlineKeyboardButton( - text="๐ Close", callback_data=f"forceclose {query}|{user_id}" - ), + InlineKeyboardButton(text="๐ Close", callback_data=f"forceclose {query}|{user_id}"), ], ] return buttons @@ -117,41 +80,20 @@ def search_markup2( ): buttons = [ [ - InlineKeyboardButton( - text="6๏ธโฃ", - callback_data=f"ShadowMusic2 {ID6}|{duration6}|{user_id}", - ), - InlineKeyboardButton( - text="7๏ธโฃ", - callback_data=f"ShadowMusic2 {ID7}|{duration7}|{user_id}", - ), - InlineKeyboardButton( - text="8๏ธโฃ", - callback_data=f"ShadowMusic2 {ID8}|{duration8}|{user_id}", - ), + InlineKeyboardButton(text="6๏ธโฃ", callback_data=f"ShadowMusic2 {ID6}|{duration6}|{user_id}"), + InlineKeyboardButton(text="7๏ธโฃ", callback_data=f"ShadowMusic2 {ID7}|{duration7}|{user_id}"), + InlineKeyboardButton(text="8๏ธโฃ", callback_data=f"ShadowMusic2 {ID8}|{duration8}|{user_id}"), ], [ - InlineKeyboardButton( - text="9๏ธโฃ", - callback_data=f"ShadowMusic2 {ID9}|{duration9}|{user_id}", - ), - InlineKeyboardButton( - text="๐", - callback_data=f"ShadowMusic2 {ID10}|{duration10}|{user_id}", - ), + InlineKeyboardButton(text="9๏ธโฃ", callback_data=f"ShadowMusic2 {ID9}|{duration9}|{user_id}"), + InlineKeyboardButton(text="๐", callback_data=f"ShadowMusic2 {ID10}|{duration10}|{user_id}"), ], [ - InlineKeyboardButton( - text="โฌ ๏ธ", callback_data=f"popat 2|{query}|{user_id}" - ), - InlineKeyboardButton( - text="โก๏ธ", callback_data=f"popat 2|{query}|{user_id}" - ), + InlineKeyboardButton(text="โฌ ๏ธ", callback_data=f"popat 2|{query}|{user_id}"), + InlineKeyboardButton(text="โก๏ธ", callback_data=f"popat 2|{query}|{user_id}"), ], [ - InlineKeyboardButton( - text="๐ Close", callback_data=f"forceclose {query}|{user_id}" - ), + InlineKeyboardButton(text="๐ Close", callback_data=f"forceclose {query}|{user_id}"), ], ] return buttons @@ -166,13 +108,10 @@ def secondary_markup(videoid, user_id): InlineKeyboardButton(text="โน๏ธ", callback_data=f"stopcb"), ], [ - InlineKeyboardButton( - text="๐ Search Lyrics", - callback_data=f"lyrics {videoid}|{user_id}", - ), - InlineKeyboardButton( - text="๐ More Menu", callback_data=f"other {videoid}|{user_id}" - ), + InlineKeyboardButton(text="๐ Search Lyrics", callback_data=f"lyrics {videoid}|{user_id}"), + InlineKeyboardButton(text="๐ More Menu", callback_data=f"other {videoid}|{user_id}"), + ], + [ InlineKeyboardButton(text="๐ Close Menu", callback_data=f"close"), ], ] @@ -185,10 +124,7 @@ def primary_markup(videoid, user_id, current_time, total_time): db_mem[videoid]["check"] = 2 buttons = [ [ - InlineKeyboardButton( - text=f"{total_time} ------------------ {current_time}", - callback_data=f"timer_checkup_markup {videoid}|{user_id}", - ) + InlineKeyboardButton(text=f"{total_time} ------------------ {current_time}", callback_data=f"timer_checkup_markup {videoid}|{user_id}") ], [ InlineKeyboardButton(text="โถ๏ธ", callback_data=f"resumecb"), @@ -197,13 +133,10 @@ def primary_markup(videoid, user_id, current_time, total_time): InlineKeyboardButton(text="โน๏ธ", callback_data=f"stopcb"), ], [ - InlineKeyboardButton( - text="๐ Search Lyrics", - callback_data=f"lyrics {videoid}|{user_id}", - ), - InlineKeyboardButton( - text="๐ More Menu", callback_data=f"other {videoid}|{user_id}" - ), + InlineKeyboardButton(text="๐ Search Lyrics", callback_data=f"lyrics {videoid}|{user_id}"), + InlineKeyboardButton(text="๐ More Menu", callback_data=f"other {videoid}|{user_id}"), + ], + [ InlineKeyboardButton(text="๐ Close Menu", callback_data=f"close"), ], ] @@ -213,10 +146,7 @@ def primary_markup(videoid, user_id, current_time, total_time): def timer_markup(videoid, user_id, current_time, total_time): buttons = [ [ - InlineKeyboardButton( - text=f"{total_time} ------------------ {current_time}", - callback_data=f"timer_checkup_markup {videoid}|{user_id}", - ) + InlineKeyboardButton(text=f"{total_time} ------------------ {current_time}", callback_data=f"timer_checkup_markup {videoid}|{user_id}") ], [ InlineKeyboardButton(text="โถ๏ธ", callback_data=f"resumecb"), @@ -225,13 +155,10 @@ def timer_markup(videoid, user_id, current_time, total_time): InlineKeyboardButton(text="โน๏ธ", callback_data=f"stopcb"), ], [ - InlineKeyboardButton( - text="๐ Search Lyrics", - callback_data=f"lyrics {videoid}|{user_id}", - ), - InlineKeyboardButton( - text="๐ More Menu", callback_data=f"other {videoid}|{user_id}" - ), + InlineKeyboardButton(text="๐ Search Lyrics", callback_data=f"lyrics {videoid}|{user_id}"), + InlineKeyboardButton(text="๐ More Menu", callback_data=f"other {videoid}|{user_id}"), + ], + [ InlineKeyboardButton(text="๐ Close Menu", callback_data=f"close"), ], ] @@ -244,10 +171,7 @@ def audio_markup(videoid, user_id, current_time, total_time): db_mem[videoid]["check"] = 2 buttons = [ [ - InlineKeyboardButton( - text=f"{total_time} ------------------ {current_time}", - callback_data=f"timer_checkup_markup {videoid}|{user_id}", - ) + InlineKeyboardButton(text=f"{total_time} ------------------ {current_time}", callback_data=f"timer_checkup_markup {videoid}|{user_id}") ], [ InlineKeyboardButton(text="โถ๏ธ", callback_data=f"resumecb"), @@ -255,7 +179,9 @@ def audio_markup(videoid, user_id, current_time, total_time): InlineKeyboardButton(text="โญ๏ธ", callback_data=f"skipcb"), InlineKeyboardButton(text="โน๏ธ", callback_data=f"stopcb"), ], - [InlineKeyboardButton(text="๐ Close Menu", callback_data=f"close")], + [ + InlineKeyboardButton(text="๐ Close Menu", callback_data=f"close") + ], ] return buttons @@ -263,10 +189,7 @@ def audio_markup(videoid, user_id, current_time, total_time): def audio_timer_markup_start(videoid, user_id, current_time, total_time): buttons = [ [ - InlineKeyboardButton( - text=f"{total_time} ------------------ {current_time}", - callback_data=f"timer_checkup_markup {videoid}|{user_id}", - ) + InlineKeyboardButton(text=f"{total_time} ------------------ {current_time}", callback_data=f"timer_checkup_markup {videoid}|{user_id}") ], [ InlineKeyboardButton(text="โถ๏ธ", callback_data=f"resumecb"), @@ -274,7 +197,9 @@ def audio_timer_markup_start(videoid, user_id, current_time, total_time): InlineKeyboardButton(text="โญ๏ธ", callback_data=f"skipcb"), InlineKeyboardButton(text="โน๏ธ", callback_data=f"stopcb"), ], - [InlineKeyboardButton(text="๐ Close Menu", callback_data=f"close")], + [ + InlineKeyboardButton(text="๐ Close Menu", callback_data=f"close") + ], ] return buttons @@ -287,6 +212,8 @@ def audio_timer_markup_start(videoid, user_id, current_time, total_time): InlineKeyboardButton(text="โญ๏ธ", callback_data=f"skipcb"), InlineKeyboardButton(text="โน๏ธ", callback_data=f"stopcb"), ], - [InlineKeyboardButton("๐ Close Menu", callback_data="close")], + [ + InlineKeyboardButton("๐ Close Menu", callback_data="close") + ], ] ) From e3fb1c0d9a86dc69358159453b812e6f941e3430 Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Sat, 1 Jan 2022 09:13:31 +0530 Subject: [PATCH 66/79] Shadow Music --- ShadowMusic/Inline/others.py | 39 ++++++++---------------------------- 1 file changed, 8 insertions(+), 31 deletions(-) diff --git a/ShadowMusic/Inline/others.py b/ShadowMusic/Inline/others.py index 4a4af03..9479302 100644 --- a/ShadowMusic/Inline/others.py +++ b/ShadowMusic/Inline/others.py @@ -10,30 +10,15 @@ def others_markup(videoid, user_id): db_mem[videoid]["check"] = 1 buttons = [ [ - InlineKeyboardButton( - text="โ Your Playlist", - callback_data=f"your_playlist {videoid}|{user_id}", - ), - InlineKeyboardButton( - text="โ Group Playlist", - callback_data=f"group_playlist {videoid}|{user_id}", - ), + InlineKeyboardButton(text="โ Your Playlist", callback_data=f"your_playlist {videoid}|{user_id}"), + InlineKeyboardButton(text="โ Group Playlist", callback_data=f"group_playlist {videoid}|{user_id}"), ], [ - InlineKeyboardButton( - text="๐ฅ Download Audio/Video", - callback_data=f"audio_video_download {videoid}|{user_id}", - ) + InlineKeyboardButton(text="๐ฅ Download Audio/Video", callback_data=f"audio_video_download {videoid}|{user_id}") ], [ - InlineKeyboardButton( - text="โฌ ๏ธ Go Back", - callback_data=f"pr_go_back_timer {videoid}|{user_id}", - ), - InlineKeyboardButton( - text="๐ Close Menu", - callback_data=f"close", - ), + InlineKeyboardButton(text="โฌ ๏ธ Go Back", callback_data=f"pr_go_back_timer {videoid}|{user_id}"), + InlineKeyboardButton(text="๐ Close Menu", callback_data=f"close"), ], ] return buttons @@ -42,19 +27,11 @@ def others_markup(videoid, user_id): def download_markup(videoid, user_id): buttons = [ [ - InlineKeyboardButton( - text="๐ฅ Get Audio", - callback_data=f"gets audio|{videoid}|{user_id}", - ), - InlineKeyboardButton( - text="๐ฅ Get Video", - callback_data=f"gets video|{videoid}|{user_id}", - ), + InlineKeyboardButton(text="๐ฅ Get Audio", callback_data=f"gets audio|{videoid}|{user_id}"), + InlineKeyboardButton(text="๐ฅ Get Video", callback_data=f"gets video|{videoid}|{user_id}"), ], [ - InlineKeyboardButton( - text="โฌ ๏ธ Go Back", callback_data=f"goback {videoid}|{user_id}" - ), + InlineKeyboardButton(text="โฌ ๏ธ Go Back", callback_data=f"goback {videoid}|{user_id}"), InlineKeyboardButton(text="๐ Close Menu", callback_data=f"close"), ], ] From 3780afd77757cb24656d4bc24d7cc93a20aa6923 Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Sat, 1 Jan 2022 09:22:47 +0530 Subject: [PATCH 67/79] Shadow Music --- ShadowMusic/Inline/playlist.py | 73 +++++++++------------------------- 1 file changed, 19 insertions(+), 54 deletions(-) diff --git a/ShadowMusic/Inline/playlist.py b/ShadowMusic/Inline/playlist.py index aeb778c..caa0f65 100644 --- a/ShadowMusic/Inline/playlist.py +++ b/ShadowMusic/Inline/playlist.py @@ -5,16 +5,12 @@ def check_markup(user_name, user_id, videoid): buttons = [ [ - InlineKeyboardButton( - text=f"Group's Playlist", - callback_data=f"playlist_check {user_id}|Group|{videoid}", - ), - InlineKeyboardButton( - text=f"{user_name[:10]}'s Playlist", - callback_data=f"playlist_check {user_id}|Personal|{videoid}", - ), + InlineKeyboardButton(text=f"Group's Playlist", callback_data=f"playlist_check {user_id}|Group|{videoid}"), + InlineKeyboardButton(text=f"{user_name[:10]}'s Playlist", callback_data=f"playlist_check {user_id}|Personal|{videoid}"), + ], + [ + InlineKeyboardButton(text="๐ Close Menu", callback_data="close") ], - [InlineKeyboardButton(text="๐ Close Menu", callback_data="close")], ] return buttons @@ -22,16 +18,12 @@ def check_markup(user_name, user_id, videoid): def playlist_markup(user_name, user_id, videoid): buttons = [ [ - InlineKeyboardButton( - text=f"Group's Playlist", - callback_data=f"show_genre {user_id}|Group|{videoid}", - ), - InlineKeyboardButton( - text=f"{user_name[:10]}'s Playlist", - callback_data=f"show_genre {user_id}|Personal|{videoid}", - ), + InlineKeyboardButton(text=f"Group's Playlist", callback_data=f"show_genre {user_id}|Group|{videoid}"), + InlineKeyboardButton(text=f"{user_name[:10]}'s Playlist", callback_data=f"show_genre {user_id}|Personal|{videoid}"), + ], + [ + InlineKeyboardButton(text="๐ Close Menu", callback_data="close") ], - [InlineKeyboardButton(text="๐ Close Menu", callback_data="close")], ] return buttons @@ -39,50 +31,23 @@ def playlist_markup(user_name, user_id, videoid): def play_genre_playlist(user_id, type, videoid): buttons = [ [ - InlineKeyboardButton( - text=f"Bollywood", - callback_data=f"play_playlist {user_id}|{type}|Bollywood", - ), - InlineKeyboardButton( - text=f"Hollywood", - callback_data=f"play_playlist {user_id}|{type}|Hollywood", - ), + InlineKeyboardButton(text=f"Bollywood", callback_data=f"play_playlist {user_id}|{type}|Bollywood"), + InlineKeyboardButton(text=f"Hollywood", callback_data=f"play_playlist {user_id}|{type}|Hollywood"), ], [ - InlineKeyboardButton( - text=f"Party", - callback_data=f"play_playlist {user_id}|{type}|Party", - ), - InlineKeyboardButton( - text=f"Lofi", - callback_data=f"play_playlist {user_id}|{type}|Lofi", - ), + InlineKeyboardButton(text=f"Party", callback_data=f"play_playlist {user_id}|{type}|Party"), + InlineKeyboardButton(text=f"Lofi", callback_data=f"play_playlist {user_id}|{type}|Lofi"), ], [ - InlineKeyboardButton( - text=f"Sad", - callback_data=f"play_playlist {user_id}|{type}|Sad", - ), - InlineKeyboardButton( - text=f"Weeb", - callback_data=f"play_playlist {user_id}|{type}|Weeb", - ), + InlineKeyboardButton(text=f"Sad", callback_data=f"play_playlist {user_id}|{type}|Sad"), + InlineKeyboardButton(text=f"Weeb", callback_data=f"play_playlist {user_id}|{type}|Weeb"), ], [ - InlineKeyboardButton( - text=f"Punjabi", - callback_data=f"play_playlist {user_id}|{type}|Punjabi", - ), - InlineKeyboardButton( - text=f"Others", - callback_data=f"play_playlist {user_id}|{type}|Others", - ), + InlineKeyboardButton(text=f"Punjabi", callback_data=f"play_playlist {user_id}|{type}|Punjabi"), + InlineKeyboardButton(text=f"Others", callback_data=f"play_playlist {user_id}|{type}|Others"), ], [ - InlineKeyboardButton( - text="โฌ ๏ธ Go Back", - callback_data=f"main_playlist {videoid}|{type}|{user_id}", - ), + InlineKeyboardButton(text="โฌ ๏ธ Go Back", callback_data=f"main_playlist {videoid}|{type}|{user_id}"), InlineKeyboardButton(text="๐ Close Menu", callback_data="close"), ], ] From ac300aea4f0637c858a669661914f589b4f851ba Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Sat, 1 Jan 2022 09:39:11 +0530 Subject: [PATCH 68/79] Shadow Music --- ShadowMusic/Inline/song.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ShadowMusic/Inline/song.py b/ShadowMusic/Inline/song.py index ea01571..41b46ee 100644 --- a/ShadowMusic/Inline/song.py +++ b/ShadowMusic/Inline/song.py @@ -6,15 +6,15 @@ def song_markup(videoid, duration, user_id, query, query_type): buttons = [ [ InlineKeyboardButton( - text="ยซ", + text="โฌ ๏ธ", callback_data=f"song_right B|{query_type}|{query}|{user_id}", ), InlineKeyboardButton( - text="Download", + text="๐ฅ Download", callback_data=f"qwertyuiopasdfghjkl {videoid}|{user_id}", ), InlineKeyboardButton( - text="ยป", + text="โก๏ธ", callback_data=f"song_right F|{query_type}|{query}|{user_id}", ), ], @@ -32,11 +32,11 @@ def song_download_markup(videoid, user_id): buttons = [ [ InlineKeyboardButton( - text="โฌ๏ธ Get Audio", + text="๐ฅ Get Audio", callback_data=f"gets audio|{videoid}|{user_id}", ), InlineKeyboardButton( - text="โฌ๏ธ Get Video", + text="๐ฅ Get Video", callback_data=f"gets video|{videoid}|{user_id}", ), ], From 4e3915f851704d6f1182a15f42c15acff33d6a94 Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Sat, 1 Jan 2022 09:44:17 +0530 Subject: [PATCH 69/79] Shadow Music --- ShadowMusic/__main__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ShadowMusic/__main__.py b/ShadowMusic/__main__.py index c939284..8ece7e2 100644 --- a/ShadowMusic/__main__.py +++ b/ShadowMusic/__main__.py @@ -347,10 +347,10 @@ async def help_button(client, query): [ [ InlineKeyboardButton( - text="โช๏ธ Back", callback_data="help_back" + text="๐ Back", callback_data="help_back" ), InlineKeyboardButton( - text="๐ Close", callback_data="close" + text="๐ Close", callback_data="close" ), ], ] From bd054e966997178dd18ec7b7eda3d97b4790302e Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Sat, 1 Jan 2022 09:55:58 +0530 Subject: [PATCH 70/79] Shadow Music --- ShadowMusic/Utilities/inline.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ShadowMusic/Utilities/inline.py b/ShadowMusic/Utilities/inline.py index 3f35f49..fcc67e4 100644 --- a/ShadowMusic/Utilities/inline.py +++ b/ShadowMusic/Utilities/inline.py @@ -69,15 +69,15 @@ def paginate_modules(page_n, module_dict, prefix, chat=None): ] + [ ( EqInlineKeyboardButton( - "โฎ", + "โฌ ๏ธ", callback_data="{}_prev({})".format(prefix, modulo_page), ), EqInlineKeyboardButton( - "Close", + "๐ Close", callback_data="close", ), EqInlineKeyboardButton( - "โฏ", + "โฌ ๏ธ", callback_data="{}_next({})".format(prefix, modulo_page), ), ) From 6ced75bc64caaf80b5be1f2ff02d7181d2489d71 Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Sat, 1 Jan 2022 10:48:06 +0530 Subject: [PATCH 71/79] Shadow Music --- ShadowMusic/Utilities/inline.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ShadowMusic/Utilities/inline.py b/ShadowMusic/Utilities/inline.py index fcc67e4..1bab4dd 100644 --- a/ShadowMusic/Utilities/inline.py +++ b/ShadowMusic/Utilities/inline.py @@ -77,7 +77,7 @@ def paginate_modules(page_n, module_dict, prefix, chat=None): callback_data="close", ), EqInlineKeyboardButton( - "โฌ ๏ธ", + "โก๏ธ", callback_data="{}_next({})".format(prefix, modulo_page), ), ) From a35a339be598a7cbb8c73662ca4cbe03b3c649ea Mon Sep 17 00:00:00 2001 From: Deshadeeth Thisarana <77653060+Deshadeeth-Thisarana@users.noreply.github.com> Date: Sat, 1 Jan 2022 11:07:50 +0530 Subject: [PATCH 72/79] Shadow Music --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d6b44b0..498acc9 100644 --- a/README.md +++ b/README.md @@ -21,10 +21,14 @@
A Support Group, Updates Channel and ready-to-use running instance of this bot can be found on Telegram
Bot |
- Support Group
+ Support Group |
Updates Channel