diff --git a/.dockerignore b/.dockerignore
index db2c5c5..dfd6569 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -10,4 +10,3 @@ raw_files/
.gitignore
runtime.txt
__pycache__/
-
diff --git a/README.md b/README.md
index d6b44b0..26c161e 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
+
+ Full Music Help Guide: Here
+
+
Requirements
@@ -40,7 +44,6 @@
Install Locally Or On A VPS
-
```console
$ git clone https://github.com/TeamOfShadow/ShadowMusic
$ cd ShadowMusic
@@ -65,7 +68,6 @@ $ bash start
-Deploy
Generating Pyrogram Session
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)
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_}")
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)
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
-
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]:
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
+ )
diff --git a/ShadowMusic/Decorators/assistant.py b/ShadowMusic/Decorators/assistant.py
index c8a85d5..ad58eb9 100644
--- a/ShadowMusic/Decorators/assistant.py
+++ b/ShadowMusic/Decorators/assistant.py
@@ -1,23 +1,38 @@
+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:
@@ -27,17 +42,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 ASS_ACC.join_chat(inv_lnk)
+ await message.reply(f"{ASS_NAME} Joined Successfully")
except UserAlreadyParticipant:
pass
except Exception as e:
diff --git a/ShadowMusic/Inline/__init__.py b/ShadowMusic/Inline/__init__.py
index f2df822..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,
@@ -8,5 +9,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
diff --git a/ShadowMusic/Inline/others.py b/ShadowMusic/Inline/others.py
index 7b87403..9479302 100644
--- a/ShadowMusic/Inline/others.py
+++ b/ShadowMusic/Inline/others.py
@@ -10,36 +10,15 @@ def others_markup(videoid, user_id):
db_mem[videoid]["check"] = 1
buttons = [
[
- InlineKeyboardButton(
- text="๐ Search Lyrics",
- callback_data=f"lyrics {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="โ 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
@@ -48,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"),
],
]
diff --git a/ShadowMusic/Inline/play.py b/ShadowMusic/Inline/play.py
index 15a3d6f..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,9 +108,10 @@ def secondary_markup(videoid, user_id):
InlineKeyboardButton(text="โน๏ธ", callback_data=f"stopcb"),
],
[
- 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"),
],
]
@@ -181,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"),
@@ -193,9 +133,10 @@ def primary_markup(videoid, user_id, current_time, total_time):
InlineKeyboardButton(text="โน๏ธ", callback_data=f"stopcb"),
],
[
- 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"),
],
]
@@ -205,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"),
@@ -217,9 +155,10 @@ def timer_markup(videoid, user_id, current_time, total_time):
InlineKeyboardButton(text="โน๏ธ", callback_data=f"stopcb"),
],
[
- 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"),
],
]
@@ -232,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"),
@@ -243,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
@@ -251,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"),
@@ -262,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
@@ -275,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")
+ ],
]
)
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"),
],
]
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}",
),
],
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 = [
[
diff --git a/ShadowMusic/Plugins/Admins.py b/ShadowMusic/Plugins/Admins.py
index 517a978..cea0972 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.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)
+ 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"]
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):
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.
"""
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
"""
diff --git a/ShadowMusic/Plugins/Callback.py b/ShadowMusic/Plugins/Callback.py
index bc07ae2..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"]
@@ -279,7 +266,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}"
@@ -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."
)
@@ -480,7 +457,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"
@@ -535,7 +512,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}"
)
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`")
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"
)
],
[
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)
-
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} "
+ )
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)
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)}"
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.
"""
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.
"""
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",
diff --git a/ShadowMusic/Plugins/Stats.py b/ShadowMusic/Plugins/Stats.py
index 703d13e..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**
-**Yukki 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()
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!
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.
"""
diff --git a/ShadowMusic/Plugins/Voicechat.py b/ShadowMusic/Plugins/Voicechat.py
index 95e94ff..1d6e2d9 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 pyrogram.types import (InlineKeyboardMarkup, InputMediaPhoto, Message, Voice)
-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 config import get_queue
-from pyrogram.types import (InlineKeyboardMarkup, InputMediaPhoto, Message,
- Voice)
+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,7 +205,23 @@ 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
diff --git a/ShadowMusic/Utilities/assistant.py b/ShadowMusic/Utilities/assistant.py
new file mode 100644
index 0000000..9927a57
--- /dev/null
+++ b/ShadowMusic/Utilities/assistant.py
@@ -0,0 +1,35 @@
+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)
+
+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
diff --git a/ShadowMusic/Utilities/inline.py b/ShadowMusic/Utilities/inline.py
index 3f35f49..1bab4dd 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),
),
)
diff --git a/ShadowMusic/Utilities/stream.py b/ShadowMusic/Utilities/stream.py
index ac22c5c..d97737c 100644
--- a/ShadowMusic/Utilities/stream.py
+++ b/ShadowMusic/Utilities/stream.py
@@ -2,17 +2,16 @@
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)
+ 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()
@@ -54,7 +53,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}!"
),
@@ -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."
)
@@ -135,7 +124,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}!"
),
@@ -144,21 +133,10 @@ 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
@@ -174,7 +152,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,
)
@@ -183,8 +161,7 @@ async def start_stream_audio(
duration_min,
duration_sec,
final_output,
- CallbackQuery.message.chat.id,
- CallbackQuery.from_user.id,
+ message.chat.id,
+ message.from_user.id,
1,
)
-
diff --git a/ShadowMusic/Utilities/thumbnails.py b/ShadowMusic/Utilities/thumbnails.py
index daf8ff7..b5fdea8 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[:15]}...",
+ 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")
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()
-
diff --git a/ShadowMusic/__main__.py b/ShadowMusic/__main__.py
index 854e26c..1483135 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.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
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,38 +100,114 @@ 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,
- "Congrats!! Assistant has started successfully!",
+ "โ
Assistant Client 1๏ธโฃ started 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 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 userbot.join_chat("ShadowBotUpdates")
+ 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 userbot.join_chat("ShadowSupport_Official")
+ await ASS_CLI_2.send_message(
+ LOG_GROUP_ID,
+ "โ
Assistant Client 2๏ธโฃ started 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")
+ await ASS_CLI_2.join_chat("ShadowBotChat")
except:
- pass
-
+ pass
+ try:
+ await ASS_CLI_3.send_message(
+ LOG_GROUP_ID,
+ "โ
Assistant Client 3๏ธโฃ started 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")
+ await ASS_CLI_3.join_chat("ShadowBotChat")
+ except:
+ pass
+ try:
+ await ASS_CLI_4.send_message(
+ LOG_GROUP_ID,
+ "โ
Assistant Client 4๏ธโฃ started successfully!",
+ )
+ except Exception as e:
+ print(
+ "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 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๏ธโฃ started 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")
+ await ASS_CLI_5.join_chat("ShadowBotChat")
+ except:
+ 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: / """
@@ -140,17 +219,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:
@@ -221,7 +294,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 +306,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 +332,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:
@@ -272,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"
),
],
]
@@ -336,4 +411,3 @@ async def help_button(client, query):
if __name__ == "__main__":
loop.run_until_complete(initiate_bot())
-
diff --git a/app.json b/app.json
index efa5f1c..e42ed10 100644
--- a/app.json
+++ b/app.json
@@ -65,8 +65,28 @@
"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": true
+ },
+ "STRING_SESSION3": {
+ "description": "A Pyrogram String Session of Assistant Account.",
+ "value": "",
+ "required": true
+ },
+ "STRING_SESSION4": {
+ "description": "A Pyrogram String Session of Assistant Account.",
+ "value": "",
+ "required": true
+ },
+ "STRING_SESSION5": {
+ "description": "A Pyrogram String Session of Assistant Account.",
"value": "",
"required": true
},
diff --git a/config.py b/config.py
index c882cc2..db3b661 100644
--- a/config.py
+++ b/config.py
@@ -1,4 +1,5 @@
from os import getenv
+
from dotenv import load_dotenv
load_dotenv()
@@ -6,18 +7,21 @@
# 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")
-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()))
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:
diff --git a/requirements.txt b/requirements.txt
index 7a9ebdf..d5b3f6a 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -2,21 +2,20 @@ aiohttp
aiofiles
asyncio
ffmpeg-python
-Pillow
+pillow
git+https://github.com/pyrogram/pyrogram@master
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