taslim19
commited on
Commit
·
a8e9b84
0
Parent(s):
MusicV2
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .dockerignore +10 -0
- .gitattributes +1 -0
- .github/README.md +29 -0
- .gitignore +10 -0
- Dockerfile +12 -0
- DragMusic/Mongo/afkdb.py +33 -0
- DragMusic/Mongo/nightmodedb.py +24 -0
- DragMusic/Mongo/readable_time.py +23 -0
- DragMusic/__init__.py +27 -0
- DragMusic/__main__.py +61 -0
- DragMusic/assets/font.ttf +3 -0
- DragMusic/assets/font2.ttf +3 -0
- DragMusic/core/bot.py +54 -0
- DragMusic/core/call.py +635 -0
- DragMusic/core/dir.py +20 -0
- DragMusic/core/git.py +71 -0
- DragMusic/core/mongo.py +14 -0
- DragMusic/core/userbot.py +170 -0
- DragMusic/logging.py +19 -0
- DragMusic/misc.py +75 -0
- DragMusic/platforms/Apple.py +71 -0
- DragMusic/platforms/Carbon.py +106 -0
- DragMusic/platforms/Resso.py +54 -0
- DragMusic/platforms/Soundcloud.py +39 -0
- DragMusic/platforms/Spotify.py +98 -0
- DragMusic/platforms/Telegram.py +176 -0
- DragMusic/platforms/Youtube.py +470 -0
- DragMusic/platforms/__init__.py +7 -0
- DragMusic/plugins/__init__.py +19 -0
- DragMusic/plugins/admins/auth.py +89 -0
- DragMusic/plugins/admins/callback.py +397 -0
- DragMusic/plugins/admins/loop.py +46 -0
- DragMusic/plugins/admins/pause.py +21 -0
- DragMusic/plugins/admins/resume.py +21 -0
- DragMusic/plugins/admins/seek.py +75 -0
- DragMusic/plugins/admins/shuffle.py +33 -0
- DragMusic/plugins/admins/skip.py +232 -0
- DragMusic/plugins/admins/speed.py +112 -0
- DragMusic/plugins/admins/stop.py +23 -0
- DragMusic/plugins/admins/tagall.py +290 -0
- DragMusic/plugins/admins/zombies.py +184 -0
- DragMusic/plugins/bot/approve.text +28 -0
- DragMusic/plugins/bot/fakeinfo.py +47 -0
- DragMusic/plugins/bot/help.py +90 -0
- DragMusic/plugins/bot/inline.py +68 -0
- DragMusic/plugins/bot/mustjoin.py +61 -0
- DragMusic/plugins/bot/settings.py +391 -0
- DragMusic/plugins/bot/start.py +169 -0
- DragMusic/plugins/goodnight.py +42 -0
- DragMusic/plugins/misc/autoleave.py +74 -0
.dockerignore
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.env
|
2 |
+
.cache
|
3 |
+
log.txt
|
4 |
+
.DS_Store
|
5 |
+
*.session
|
6 |
+
raw_files/
|
7 |
+
cache/
|
8 |
+
downloads/
|
9 |
+
__pycache__/
|
10 |
+
*.session-journal
|
.gitattributes
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
*.ttf filter=lfs diff=lfs merge=lfs -text
|
.github/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
- Upgrade and Update by :
|
2 |
+
`sudo apt-get update && sudo apt-get upgrade -y`
|
3 |
+
- Install Ffmpeg by :
|
4 |
+
`sudo apt-get install python3-pip ffmpeg -y`
|
5 |
+
- Install required packages by :
|
6 |
+
`sudo apt-get install python3 python3-pip -y`
|
7 |
+
- Install pip by :
|
8 |
+
`sudo pip3 install -U pip`
|
9 |
+
- Install Node js by :
|
10 |
+
`curl -fssL https://deb.nodesource.com/setup_19.x | sudo -E bash - && sudo apt-get install nodejs -y && npm i -g npm`
|
11 |
+
- Clone the repository by :
|
12 |
+
`git clone https://github.com/xteam-cloner/Wleowleo && cd Wleowleo`
|
13 |
+
- Install requirements by :
|
14 |
+
`pip3 install -U -r requirements.txt`
|
15 |
+
- Fill your variables in the env by :
|
16 |
+
`vi sample.env`<br>
|
17 |
+
Press `I` on the keyboard for editing env<br>
|
18 |
+
Press `Ctrl+C` when you're done with editing env and `:wq` to save the env<br>
|
19 |
+
- Rename the env file by :
|
20 |
+
`mv sample.env .env`
|
21 |
+
- Install tmux to keep running your bot when you close the terminal by :
|
22 |
+
`sudo apt install tmux && tmux`
|
23 |
+
- Finally run the bot by :
|
24 |
+
`bash start`
|
25 |
+
- For getting out from tmux session : Press `Ctrl+b` and then `d`<br>
|
26 |
+
|
27 |
+
|
28 |
+
|
29 |
+
|
.gitignore
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.env
|
2 |
+
.cache
|
3 |
+
log.txt
|
4 |
+
.DS_Store
|
5 |
+
*.session
|
6 |
+
raw_files/
|
7 |
+
cache/
|
8 |
+
downloads/
|
9 |
+
__pycache__/
|
10 |
+
*.session-journal
|
Dockerfile
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM nikolaik/python-nodejs:python3.10-nodejs19
|
2 |
+
|
3 |
+
RUN apt-get update \
|
4 |
+
&& apt-get install -y --no-install-recommends ffmpeg \
|
5 |
+
&& apt-get clean \
|
6 |
+
&& rm -rf /var/lib/apt/lists/*
|
7 |
+
|
8 |
+
COPY . /app/
|
9 |
+
WORKDIR /app/
|
10 |
+
RUN pip3 install --no-cache-dir -U -r requirements.txt
|
11 |
+
|
12 |
+
CMD bash start
|
DragMusic/Mongo/afkdb.py
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from DragMusic.core.mongo import mongodb
|
2 |
+
|
3 |
+
afkdb = mongodb.afk
|
4 |
+
|
5 |
+
|
6 |
+
async def is_afk(user_id: int) -> bool:
|
7 |
+
user = await afkdb.find_one({"user_id": user_id})
|
8 |
+
if not user:
|
9 |
+
return False, {}
|
10 |
+
return True, user["reason"]
|
11 |
+
|
12 |
+
|
13 |
+
async def add_afk(user_id: int, mode):
|
14 |
+
await afkdb.update_one(
|
15 |
+
{"user_id": user_id}, {"$set": {"reason": mode}}, upsert=True
|
16 |
+
)
|
17 |
+
|
18 |
+
|
19 |
+
async def remove_afk(user_id: int):
|
20 |
+
user = await afkdb.find_one({"user_id": user_id})
|
21 |
+
if user:
|
22 |
+
return await afkdb.delete_one({"user_id": user_id})
|
23 |
+
|
24 |
+
|
25 |
+
async def get_afk_users() -> list:
|
26 |
+
users = afkdb.find({"user_id": {"$gt": 0}})
|
27 |
+
if not users:
|
28 |
+
return []
|
29 |
+
users_list = []
|
30 |
+
for user in await users.to_list(length=1000000000):
|
31 |
+
users_list.append(user)
|
32 |
+
return users_list
|
33 |
+
|
DragMusic/Mongo/nightmodedb.py
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from typing import Dict, List, Union
|
2 |
+
from config import MONGO_DB_URI
|
3 |
+
from motor.motor_asyncio import AsyncIOMotorClient as MongoCli
|
4 |
+
|
5 |
+
|
6 |
+
mongo = MongoCli(MONGO_DB_URI).Rankings
|
7 |
+
|
8 |
+
nightdb = mongo.nightmode
|
9 |
+
|
10 |
+
|
11 |
+
async def nightmode_on(chat_id : int) :
|
12 |
+
return nightdb.insert_one({"chat_id" : chat_id})
|
13 |
+
|
14 |
+
async def nightmode_off(chat_id : int):
|
15 |
+
return nightdb.delete_one({"chat_id" : chat_id})
|
16 |
+
|
17 |
+
async def get_nightchats() -> list:
|
18 |
+
chats = nightdb.find({"chat_id": {"$lt": 0}})
|
19 |
+
if not chats:
|
20 |
+
return []
|
21 |
+
chats_list = []
|
22 |
+
for chat in await chats.to_list(length=1000000000):
|
23 |
+
chats_list.append(chat)
|
24 |
+
return chats_list
|
DragMusic/Mongo/readable_time.py
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
def get_readable_time(seconds: int) -> str:
|
2 |
+
count = 0
|
3 |
+
readable_time = ""
|
4 |
+
time_list = []
|
5 |
+
time_suffix_list = ["s", "ᴍ", "ʜ", "ᴅᴀʏs"]
|
6 |
+
|
7 |
+
while count < 4:
|
8 |
+
count += 1
|
9 |
+
remainder, result = divmod(seconds, 60) if count < 3 else divmod(seconds, 24)
|
10 |
+
if seconds == 0 and remainder == 0:
|
11 |
+
break
|
12 |
+
time_list.append(int(result))
|
13 |
+
seconds = int(remainder)
|
14 |
+
|
15 |
+
for x in range(len(time_list)):
|
16 |
+
time_list[x] = str(time_list[x]) + time_suffix_list[x]
|
17 |
+
if len(time_list) == 4:
|
18 |
+
readable_time += time_list.pop() + ", "
|
19 |
+
|
20 |
+
time_list.reverse()
|
21 |
+
readable_time += ":".join(time_list)
|
22 |
+
|
23 |
+
return readable_time
|
DragMusic/__init__.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from DragMusic.core.bot import Drag
|
2 |
+
from DragMusic.core.dir import dirr
|
3 |
+
from DragMusic.core.git import git
|
4 |
+
from DragMusic.core.userbot import Userbot
|
5 |
+
from DragMusic.misc import dbb, heroku
|
6 |
+
|
7 |
+
from .logging import LOGGER
|
8 |
+
|
9 |
+
dirr()
|
10 |
+
#git()
|
11 |
+
dbb()
|
12 |
+
heroku()
|
13 |
+
|
14 |
+
app = Drag()
|
15 |
+
userbot = Userbot()
|
16 |
+
|
17 |
+
|
18 |
+
from .platforms import *
|
19 |
+
|
20 |
+
Apple = AppleAPI()
|
21 |
+
Carbon = CarbonAPI()
|
22 |
+
SoundCloud = SoundAPI()
|
23 |
+
Spotify = SpotifyAPI()
|
24 |
+
Resso = RessoAPI()
|
25 |
+
Telegram = TeleAPI()
|
26 |
+
YouTube = YouTubeAPI()
|
27 |
+
|
DragMusic/__main__.py
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import asyncio
|
2 |
+
import importlib
|
3 |
+
|
4 |
+
from pyrogram import idle
|
5 |
+
from pytgcalls.exceptions import NoActiveGroupCall
|
6 |
+
|
7 |
+
import config
|
8 |
+
from DragMusic import LOGGER, app, userbot
|
9 |
+
from DragMusic.core.call import Drag
|
10 |
+
from DragMusic.misc import sudo
|
11 |
+
from DragMusic.plugins import ALL_MODULES
|
12 |
+
from DragMusic.utils.database import get_banned_users, get_gbanned
|
13 |
+
from config import BANNED_USERS
|
14 |
+
|
15 |
+
|
16 |
+
async def init():
|
17 |
+
if (
|
18 |
+
not config.STRING1
|
19 |
+
and not config.STRING2
|
20 |
+
and not config.STRING3
|
21 |
+
and not config.STRING4
|
22 |
+
and not config.STRING5
|
23 |
+
):
|
24 |
+
LOGGER(__name__).error("Assɪsᴛᴀɴᴛ ᴄʟɪᴇɴᴛ ᴠᴀʀɪᴀʙʟᴇs ɴᴏᴛ ᴅᴇғɪɴᴇᴅ, ᴇxɪᴛɪɴɢ...")
|
25 |
+
exit()
|
26 |
+
await sudo()
|
27 |
+
try:
|
28 |
+
users = await get_gbanned()
|
29 |
+
for user_id in users:
|
30 |
+
BANNED_USERS.add(user_id)
|
31 |
+
users = await get_banned_users()
|
32 |
+
for user_id in users:
|
33 |
+
BANNED_USERS.add(user_id)
|
34 |
+
except:
|
35 |
+
pass
|
36 |
+
await app.start()
|
37 |
+
for all_module in ALL_MODULES:
|
38 |
+
importlib.import_module("DragMusic.plugins" + all_module)
|
39 |
+
LOGGER("DragMusic.plugins").info("Sᴜᴄᴄᴇssғᴜʟʟʏ Iᴍᴘᴏʀᴛᴇᴅ Mᴏᴅᴜʟᴇs...")
|
40 |
+
await userbot.start()
|
41 |
+
await Drag.start()
|
42 |
+
try:
|
43 |
+
await Drag.stream_call("https://telegra.ph/file/cba632240b79207bf8a9c.mp4")
|
44 |
+
except NoActiveGroupCall:
|
45 |
+
LOGGER("DragMusic").error(
|
46 |
+
"Pʟᴇᴀsᴇ ᴛᴜʀɴ ᴏɴ ᴛʜᴇ ᴠɪᴅᴇᴏᴄʜᴀᴛ ᴏғ ʏᴏᴜʀ ʟᴏɢ ɢʀᴏᴜᴘ\ᴄʜᴀɴɴᴇʟ\n\nsᴛᴏᴘᴘɪɴɢ Bᴏᴛ..."
|
47 |
+
)
|
48 |
+
exit()
|
49 |
+
except:
|
50 |
+
pass
|
51 |
+
await Drag.decorators()
|
52 |
+
LOGGER("DragMusic").info("\n 𝑴𝑨𝑫𝑬 𝑩𝒀 𝑫𝑹𝑨𝑮𝑮𝑮 \n")
|
53 |
+
|
54 |
+
await idle()
|
55 |
+
await app.stop()
|
56 |
+
await userbot.stop()
|
57 |
+
LOGGER("DragMusic").info("\n 𝑴𝑨𝑫𝑬 𝑩𝒀 𝑫𝑹𝑨𝑮𝑮𝑮 \n")
|
58 |
+
|
59 |
+
|
60 |
+
if __name__ == "__main__":
|
61 |
+
asyncio.get_event_loop().run_until_complete(init())
|
DragMusic/assets/font.ttf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:2cb35ce1a08cfbff367f8f4d7960fe7754abc0460f0f4d7ac46d3af924a9d0f3
|
3 |
+
size 128248
|
DragMusic/assets/font2.ttf
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:e5d5b5672d46b4482346a6695121cae0110372568cb30ba723808886ecda4c12
|
3 |
+
size 22020
|
DragMusic/core/bot.py
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from pyrogram import Client, errors
|
2 |
+
from pyrogram.enums import ChatMemberStatus, ParseMode
|
3 |
+
|
4 |
+
import config
|
5 |
+
|
6 |
+
from ..logging import LOGGER
|
7 |
+
|
8 |
+
|
9 |
+
class Drag(Client):
|
10 |
+
def __init__(self):
|
11 |
+
LOGGER(__name__).info(f"Starting Bot...")
|
12 |
+
super().__init__(
|
13 |
+
name="DragMusic",
|
14 |
+
api_id=config.API_ID,
|
15 |
+
api_hash=config.API_HASH,
|
16 |
+
bot_token=config.BOT_TOKEN,
|
17 |
+
in_memory=True,
|
18 |
+
parse_mode=ParseMode.HTML,
|
19 |
+
max_concurrent_transmissions=7,
|
20 |
+
)
|
21 |
+
|
22 |
+
async def start(self):
|
23 |
+
await super().start()
|
24 |
+
self.id = self.me.id
|
25 |
+
self.name = self.me.first_name + " " + (self.me.last_name or "")
|
26 |
+
self.username = self.me.username
|
27 |
+
self.mention = self.me.mention
|
28 |
+
|
29 |
+
try:
|
30 |
+
await self.send_message(
|
31 |
+
chat_id=config.LOGGER_ID,
|
32 |
+
text=f"<u><b>» {self.mention} ʙᴏᴛ sᴛᴀʀᴛᴇᴅ :</b><u>\n\nɪᴅ : <code>{self.id}</code>\nɴᴀᴍᴇ : {self.name}\nᴜsᴇʀɴᴀᴍᴇ : @{self.username}",
|
33 |
+
)
|
34 |
+
except (errors.ChannelInvalid, errors.PeerIdInvalid):
|
35 |
+
LOGGER(__name__).error(
|
36 |
+
"Bot has failed to access the log group/channel. Make sure that you have added your bot to your log group/channel."
|
37 |
+
)
|
38 |
+
exit()
|
39 |
+
except Exception as ex:
|
40 |
+
LOGGER(__name__).error(
|
41 |
+
f"Bot has failed to access the log group/channel.\n Reason : {type(ex).__name__}."
|
42 |
+
)
|
43 |
+
exit()
|
44 |
+
|
45 |
+
a = await self.get_chat_member(config.LOGGER_ID, self.id)
|
46 |
+
if a.status != ChatMemberStatus.ADMINISTRATOR:
|
47 |
+
LOGGER(__name__).error(
|
48 |
+
"Please promote your bot as an admin in your log group/channel."
|
49 |
+
)
|
50 |
+
exit()
|
51 |
+
LOGGER(__name__).info(f"Music Bot Started as {self.name}")
|
52 |
+
|
53 |
+
async def stop(self):
|
54 |
+
await super().stop()
|
DragMusic/core/call.py
ADDED
@@ -0,0 +1,635 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import asyncio
|
2 |
+
import os
|
3 |
+
from datetime import datetime, timedelta
|
4 |
+
from typing import Union
|
5 |
+
|
6 |
+
from pyrogram import Client
|
7 |
+
from pyrogram.types import InlineKeyboardMarkup
|
8 |
+
from ntgcalls import TelegramServerError
|
9 |
+
from pytgcalls import PyTgCalls
|
10 |
+
from pytgcalls.exceptions import (
|
11 |
+
AlreadyJoinedError,
|
12 |
+
NoActiveGroupCall,
|
13 |
+
)
|
14 |
+
from pytgcalls.types import (
|
15 |
+
MediaStream,
|
16 |
+
AudioQuality,
|
17 |
+
VideoQuality,
|
18 |
+
Update,
|
19 |
+
)
|
20 |
+
from pytgcalls.types.stream import StreamAudioEnded
|
21 |
+
|
22 |
+
import config
|
23 |
+
from DragMusic import LOGGER, YouTube, app
|
24 |
+
from DragMusic.misc import db
|
25 |
+
from DragMusic.utils.database import (
|
26 |
+
add_active_chat,
|
27 |
+
add_active_video_chat,
|
28 |
+
get_lang,
|
29 |
+
get_loop,
|
30 |
+
group_assistant,
|
31 |
+
is_autoend,
|
32 |
+
music_on,
|
33 |
+
remove_active_chat,
|
34 |
+
remove_active_video_chat,
|
35 |
+
set_loop,
|
36 |
+
)
|
37 |
+
from DragMusic.utils.exceptions import AssistantErr
|
38 |
+
from DragMusic.utils.formatters import check_duration, seconds_to_min, speed_converter
|
39 |
+
from DragMusic.utils.inline.play import stream_markup
|
40 |
+
from DragMusic.utils.stream.autoclear import auto_clean
|
41 |
+
from DragMusic.utils.thumbnails import get_thumb
|
42 |
+
from strings import get_string
|
43 |
+
|
44 |
+
autoend = {}
|
45 |
+
counter = {}
|
46 |
+
loop = asyncio.get_event_loop_policy().get_event_loop()
|
47 |
+
|
48 |
+
|
49 |
+
async def _clear_(chat_id):
|
50 |
+
db[chat_id] = []
|
51 |
+
await remove_active_video_chat(chat_id)
|
52 |
+
await remove_active_chat(chat_id)
|
53 |
+
|
54 |
+
|
55 |
+
class Call(PyTgCalls):
|
56 |
+
def __init__(self):
|
57 |
+
self.userbot1 = Client(
|
58 |
+
name="AnonXAss1",
|
59 |
+
api_id=config.API_ID,
|
60 |
+
api_hash=config.API_HASH,
|
61 |
+
session_string=str(config.STRING1),
|
62 |
+
)
|
63 |
+
self.one = PyTgCalls(
|
64 |
+
self.userbot1,
|
65 |
+
cache_duration=100,
|
66 |
+
)
|
67 |
+
self.userbot2 = Client(
|
68 |
+
name="AnonXAss2",
|
69 |
+
api_id=config.API_ID,
|
70 |
+
api_hash=config.API_HASH,
|
71 |
+
session_string=str(config.STRING2),
|
72 |
+
)
|
73 |
+
self.two = PyTgCalls(
|
74 |
+
self.userbot2,
|
75 |
+
cache_duration=100,
|
76 |
+
)
|
77 |
+
self.userbot3 = Client(
|
78 |
+
name="AnonXAss3",
|
79 |
+
api_id=config.API_ID,
|
80 |
+
api_hash=config.API_HASH,
|
81 |
+
session_string=str(config.STRING3),
|
82 |
+
)
|
83 |
+
self.three = PyTgCalls(
|
84 |
+
self.userbot3,
|
85 |
+
cache_duration=100,
|
86 |
+
)
|
87 |
+
self.userbot4 = Client(
|
88 |
+
name="AnonXAss4",
|
89 |
+
api_id=config.API_ID,
|
90 |
+
api_hash=config.API_HASH,
|
91 |
+
session_string=str(config.STRING4),
|
92 |
+
)
|
93 |
+
self.four = PyTgCalls(
|
94 |
+
self.userbot4,
|
95 |
+
cache_duration=100,
|
96 |
+
)
|
97 |
+
self.userbot5 = Client(
|
98 |
+
name="AnonXAss5",
|
99 |
+
api_id=config.API_ID,
|
100 |
+
api_hash=config.API_HASH,
|
101 |
+
session_string=str(config.STRING5),
|
102 |
+
)
|
103 |
+
self.five = PyTgCalls(
|
104 |
+
self.userbot5,
|
105 |
+
cache_duration=100,
|
106 |
+
)
|
107 |
+
|
108 |
+
async def pause_stream(self, chat_id: int):
|
109 |
+
assistant = await group_assistant(self, chat_id)
|
110 |
+
await assistant.pause_stream(chat_id)
|
111 |
+
|
112 |
+
async def mute_stream(self, chat_id: int):
|
113 |
+
assistant = await group_assistant(self, chat_id)
|
114 |
+
await assistant.mute_stream(chat_id)
|
115 |
+
|
116 |
+
async def unmute_stream(self, chat_id: int):
|
117 |
+
assistant = await group_assistant(self, chat_id)
|
118 |
+
await assistant.unmute_stream(chat_id)
|
119 |
+
|
120 |
+
async def get_participant(self, chat_id: int):
|
121 |
+
assistant = await group_assistant(self, chat_id)
|
122 |
+
participant = await assistant.get_participants(chat_id)
|
123 |
+
return participant
|
124 |
+
|
125 |
+
async def resume_stream(self, chat_id: int):
|
126 |
+
assistant = await group_assistant(self, chat_id)
|
127 |
+
await assistant.resume_stream(chat_id)
|
128 |
+
|
129 |
+
async def stop_stream(self, chat_id: int):
|
130 |
+
assistant = await group_assistant(self, chat_id)
|
131 |
+
try:
|
132 |
+
await _clear_(chat_id)
|
133 |
+
await assistant.leave_group_call(chat_id)
|
134 |
+
except:
|
135 |
+
pass
|
136 |
+
|
137 |
+
async def stop_stream_force(self, chat_id: int):
|
138 |
+
try:
|
139 |
+
if config.STRING1:
|
140 |
+
await self.one.leave_group_call(chat_id)
|
141 |
+
except:
|
142 |
+
pass
|
143 |
+
try:
|
144 |
+
if config.STRING2:
|
145 |
+
await self.two.leave_group_call(chat_id)
|
146 |
+
except:
|
147 |
+
pass
|
148 |
+
try:
|
149 |
+
if config.STRING3:
|
150 |
+
await self.three.leave_group_call(chat_id)
|
151 |
+
except:
|
152 |
+
pass
|
153 |
+
try:
|
154 |
+
if config.STRING4:
|
155 |
+
await self.four.leave_group_call(chat_id)
|
156 |
+
except:
|
157 |
+
pass
|
158 |
+
try:
|
159 |
+
if config.STRING5:
|
160 |
+
await self.five.leave_group_call(chat_id)
|
161 |
+
except:
|
162 |
+
pass
|
163 |
+
try:
|
164 |
+
await _clear_(chat_id)
|
165 |
+
except:
|
166 |
+
pass
|
167 |
+
|
168 |
+
async def speedup_stream(self, chat_id: int, file_path, speed, playing):
|
169 |
+
assistant = await group_assistant(self, chat_id)
|
170 |
+
if str(speed) != "1.0":
|
171 |
+
base = os.path.basename(file_path)
|
172 |
+
chatdir = os.path.join(os.getcwd(), "playback", str(speed))
|
173 |
+
if not os.path.isdir(chatdir):
|
174 |
+
os.makedirs(chatdir)
|
175 |
+
out = os.path.join(chatdir, base)
|
176 |
+
if not os.path.isfile(out):
|
177 |
+
if str(speed) == "0.5":
|
178 |
+
vs = 2.0
|
179 |
+
if str(speed) == "0.75":
|
180 |
+
vs = 1.35
|
181 |
+
if str(speed) == "1.5":
|
182 |
+
vs = 0.68
|
183 |
+
if str(speed) == "2.0":
|
184 |
+
vs = 0.5
|
185 |
+
proc = await asyncio.create_subprocess_shell(
|
186 |
+
cmd=(
|
187 |
+
"ffmpeg "
|
188 |
+
"-i "
|
189 |
+
f"{file_path} "
|
190 |
+
"-filter:v "
|
191 |
+
f"setpts={vs}*PTS "
|
192 |
+
"-filter:a "
|
193 |
+
f"atempo={speed} "
|
194 |
+
f"{out}"
|
195 |
+
),
|
196 |
+
stdin=asyncio.subprocess.PIPE,
|
197 |
+
stderr=asyncio.subprocess.PIPE,
|
198 |
+
)
|
199 |
+
await proc.communicate()
|
200 |
+
else:
|
201 |
+
out = file_path
|
202 |
+
dur = await loop.run_in_executor(None, check_duration, out)
|
203 |
+
dur = int(dur)
|
204 |
+
played, con_seconds = speed_converter(playing[0]["played"], speed)
|
205 |
+
duration = seconds_to_min(dur)
|
206 |
+
stream = (
|
207 |
+
MediaStream(
|
208 |
+
out,
|
209 |
+
audio_parameters=AudioQuality.HIGH,
|
210 |
+
video_parameters=VideoQuality.SD_480p,
|
211 |
+
ffmpeg_parameters=f"-ss {played} -to {duration}",
|
212 |
+
)
|
213 |
+
if playing[0]["streamtype"] == "video"
|
214 |
+
else MediaStream(
|
215 |
+
out,
|
216 |
+
audio_parameters=AudioQuality.HIGH,
|
217 |
+
ffmpeg_parameters=f"-ss {played} -to {duration}",
|
218 |
+
video_flags=MediaStream.IGNORE,
|
219 |
+
)
|
220 |
+
)
|
221 |
+
if str(db[chat_id][0]["file"]) == str(file_path):
|
222 |
+
await assistant.change_stream(chat_id, stream)
|
223 |
+
else:
|
224 |
+
raise AssistantErr("Umm")
|
225 |
+
if str(db[chat_id][0]["file"]) == str(file_path):
|
226 |
+
exis = (playing[0]).get("old_dur")
|
227 |
+
if not exis:
|
228 |
+
db[chat_id][0]["old_dur"] = db[chat_id][0]["dur"]
|
229 |
+
db[chat_id][0]["old_second"] = db[chat_id][0]["seconds"]
|
230 |
+
db[chat_id][0]["played"] = con_seconds
|
231 |
+
db[chat_id][0]["dur"] = duration
|
232 |
+
db[chat_id][0]["seconds"] = dur
|
233 |
+
db[chat_id][0]["speed_path"] = out
|
234 |
+
db[chat_id][0]["speed"] = speed
|
235 |
+
|
236 |
+
async def force_stop_stream(self, chat_id: int):
|
237 |
+
assistant = await group_assistant(self, chat_id)
|
238 |
+
try:
|
239 |
+
check = db.get(chat_id)
|
240 |
+
check.pop(0)
|
241 |
+
except:
|
242 |
+
pass
|
243 |
+
await remove_active_video_chat(chat_id)
|
244 |
+
await remove_active_chat(chat_id)
|
245 |
+
try:
|
246 |
+
await assistant.leave_group_call(chat_id)
|
247 |
+
except:
|
248 |
+
pass
|
249 |
+
|
250 |
+
async def skip_stream(
|
251 |
+
self,
|
252 |
+
chat_id: int,
|
253 |
+
link: str,
|
254 |
+
video: Union[bool, str] = None,
|
255 |
+
image: Union[bool, str] = None,
|
256 |
+
):
|
257 |
+
assistant = await group_assistant(self, chat_id)
|
258 |
+
if video:
|
259 |
+
stream = MediaStream(
|
260 |
+
link,
|
261 |
+
audio_parameters=AudioQuality.HIGH,
|
262 |
+
video_parameters=VideoQuality.SD_480p,
|
263 |
+
)
|
264 |
+
else:
|
265 |
+
stream = MediaStream(
|
266 |
+
link,
|
267 |
+
audio_parameters=AudioQuality.HIGH,
|
268 |
+
video_flags=MediaStream.IGNORE,
|
269 |
+
)
|
270 |
+
await assistant.change_stream(
|
271 |
+
chat_id,
|
272 |
+
stream,
|
273 |
+
)
|
274 |
+
|
275 |
+
async def seek_stream(self, chat_id, file_path, to_seek, duration, mode):
|
276 |
+
assistant = await group_assistant(self, chat_id)
|
277 |
+
stream = (
|
278 |
+
MediaStream(
|
279 |
+
file_path,
|
280 |
+
audio_parameters=AudioQuality.HIGH,
|
281 |
+
video_parameters=VideoQuality.SD_480p,
|
282 |
+
ffmpeg_parameters=f"-ss {to_seek} -to {duration}",
|
283 |
+
)
|
284 |
+
if mode == "video"
|
285 |
+
else MediaStream(
|
286 |
+
file_path,
|
287 |
+
audio_parameters=AudioQuality.HIGH,
|
288 |
+
ffmpeg_parameters=f"-ss {to_seek} -to {duration}",
|
289 |
+
video_flags=MediaStream.IGNORE,
|
290 |
+
)
|
291 |
+
)
|
292 |
+
await assistant.change_stream(chat_id, stream)
|
293 |
+
|
294 |
+
async def stream_call(self, link):
|
295 |
+
assistant = await group_assistant(self, config.LOGGER_ID)
|
296 |
+
await assistant.join_group_call(
|
297 |
+
config.LOGGER_ID,
|
298 |
+
MediaStream(link),
|
299 |
+
)
|
300 |
+
await asyncio.sleep(0.2)
|
301 |
+
await assistant.leave_group_call(config.LOGGER_ID)
|
302 |
+
|
303 |
+
async def join_call(
|
304 |
+
self,
|
305 |
+
chat_id: int,
|
306 |
+
original_chat_id: int,
|
307 |
+
link,
|
308 |
+
video: Union[bool, str] = None,
|
309 |
+
image: Union[bool, str] = None,
|
310 |
+
):
|
311 |
+
assistant = await group_assistant(self, chat_id)
|
312 |
+
language = await get_lang(chat_id)
|
313 |
+
_ = get_string(language)
|
314 |
+
if video:
|
315 |
+
stream = MediaStream(
|
316 |
+
link,
|
317 |
+
audio_parameters=AudioQuality.HIGH,
|
318 |
+
video_parameters=VideoQuality.SD_480p,
|
319 |
+
)
|
320 |
+
else:
|
321 |
+
stream = (
|
322 |
+
MediaStream(
|
323 |
+
link,
|
324 |
+
audio_parameters=AudioQuality.HIGH,
|
325 |
+
video_parameters=VideoQuality.SD_480p,
|
326 |
+
)
|
327 |
+
if video
|
328 |
+
else MediaStream(
|
329 |
+
link,
|
330 |
+
audio_parameters=AudioQuality.HIGH,
|
331 |
+
video_flags=MediaStream.IGNORE,
|
332 |
+
)
|
333 |
+
)
|
334 |
+
try:
|
335 |
+
await assistant.join_group_call(
|
336 |
+
chat_id,
|
337 |
+
stream,
|
338 |
+
)
|
339 |
+
except NoActiveGroupCall:
|
340 |
+
raise AssistantErr(_["call_8"])
|
341 |
+
except AlreadyJoinedError:
|
342 |
+
raise AssistantErr(_["call_9"])
|
343 |
+
except TelegramServerError:
|
344 |
+
raise AssistantErr(_["call_10"])
|
345 |
+
except Exception as e:
|
346 |
+
if "phone.CreateGroupCall" in str(e):
|
347 |
+
raise AssistantErr(_["call_8"])
|
348 |
+
await add_active_chat(chat_id)
|
349 |
+
await music_on(chat_id)
|
350 |
+
if video:
|
351 |
+
await add_active_video_chat(chat_id)
|
352 |
+
if await is_autoend():
|
353 |
+
counter[chat_id] = {}
|
354 |
+
users = len(await assistant.get_participants(chat_id))
|
355 |
+
if users == 1:
|
356 |
+
autoend[chat_id] = datetime.now() + timedelta(minutes=1)
|
357 |
+
|
358 |
+
async def change_stream(self, client, chat_id):
|
359 |
+
check = db.get(chat_id)
|
360 |
+
popped = None
|
361 |
+
loop = await get_loop(chat_id)
|
362 |
+
try:
|
363 |
+
if loop == 0:
|
364 |
+
popped = check.pop(0)
|
365 |
+
else:
|
366 |
+
loop = loop - 1
|
367 |
+
await set_loop(chat_id, loop)
|
368 |
+
await auto_clean(popped)
|
369 |
+
if not check:
|
370 |
+
await _clear_(chat_id)
|
371 |
+
return await client.leave_group_call(chat_id)
|
372 |
+
except:
|
373 |
+
try:
|
374 |
+
await _clear_(chat_id)
|
375 |
+
return await client.leave_group_call(chat_id)
|
376 |
+
except:
|
377 |
+
return
|
378 |
+
else:
|
379 |
+
queued = check[0]["file"]
|
380 |
+
language = await get_lang(chat_id)
|
381 |
+
_ = get_string(language)
|
382 |
+
title = (check[0]["title"]).title()
|
383 |
+
user = check[0]["by"]
|
384 |
+
original_chat_id = check[0]["chat_id"]
|
385 |
+
streamtype = check[0]["streamtype"]
|
386 |
+
videoid = check[0]["vidid"]
|
387 |
+
db[chat_id][0]["played"] = 0
|
388 |
+
if exis := (check[0]).get("old_dur"):
|
389 |
+
db[chat_id][0]["dur"] = exis
|
390 |
+
db[chat_id][0]["seconds"] = check[0]["old_second"]
|
391 |
+
db[chat_id][0]["speed_path"] = None
|
392 |
+
db[chat_id][0]["speed"] = 1.0
|
393 |
+
video = str(streamtype) == "video"
|
394 |
+
if "live_" in queued:
|
395 |
+
n, link = await YouTube.video(videoid, True)
|
396 |
+
if n == 0:
|
397 |
+
return await app.send_message(
|
398 |
+
original_chat_id,
|
399 |
+
text=_["call_6"],
|
400 |
+
)
|
401 |
+
if video:
|
402 |
+
stream = MediaStream(
|
403 |
+
link,
|
404 |
+
audio_parameters=AudioQuality.HIGH,
|
405 |
+
video_parameters=VideoQuality.SD_480p,
|
406 |
+
)
|
407 |
+
else:
|
408 |
+
stream = MediaStream(
|
409 |
+
link,
|
410 |
+
audio_parameters=AudioQuality.HIGH,
|
411 |
+
video_flags=MediaStream.IGNORE,
|
412 |
+
)
|
413 |
+
try:
|
414 |
+
await client.change_stream(chat_id, stream)
|
415 |
+
except Exception:
|
416 |
+
return await app.send_message(
|
417 |
+
original_chat_id,
|
418 |
+
text=_["call_6"],
|
419 |
+
)
|
420 |
+
img = await get_thumb(videoid)
|
421 |
+
button = stream_markup2(_, chat_id)
|
422 |
+
run = await app.send_photo(
|
423 |
+
chat_id=original_chat_id,
|
424 |
+
photo=img,
|
425 |
+
caption=_["stream_1"].format(
|
426 |
+
f"https://t.me/{app.username}?start=info_{videoid}",
|
427 |
+
title[:23],
|
428 |
+
check[0]["dur"],
|
429 |
+
user,
|
430 |
+
),
|
431 |
+
reply_markup=InlineKeyboardMarkup(button),
|
432 |
+
)
|
433 |
+
db[chat_id][0]["mystic"] = run
|
434 |
+
db[chat_id][0]["markup"] = "tg"
|
435 |
+
elif "vid_" in queued:
|
436 |
+
mystic = await app.send_message(original_chat_id, _["call_7"])
|
437 |
+
try:
|
438 |
+
file_path, direct = await YouTube.download(
|
439 |
+
videoid,
|
440 |
+
mystic,
|
441 |
+
videoid=True,
|
442 |
+
video=str(streamtype) == "video",
|
443 |
+
)
|
444 |
+
except:
|
445 |
+
return await mystic.edit_text(
|
446 |
+
_["call_6"], disable_web_page_preview=True
|
447 |
+
)
|
448 |
+
if video:
|
449 |
+
stream = MediaStream(
|
450 |
+
file_path,
|
451 |
+
audio_parameters=AudioQuality.HIGH,
|
452 |
+
video_parameters=VideoQuality.SD_480p,
|
453 |
+
)
|
454 |
+
else:
|
455 |
+
stream = MediaStream(
|
456 |
+
file_path,
|
457 |
+
audio_parameters=AudioQuality.HIGH,
|
458 |
+
video_flags=MediaStream.IGNORE,
|
459 |
+
)
|
460 |
+
try:
|
461 |
+
await client.change_stream(chat_id, stream)
|
462 |
+
except:
|
463 |
+
return await app.send_message(
|
464 |
+
original_chat_id,
|
465 |
+
text=_["call_6"],
|
466 |
+
)
|
467 |
+
img = await get_thumb(videoid)
|
468 |
+
button = stream_markup(_, videoid, chat_id)
|
469 |
+
await mystic.delete()
|
470 |
+
run = await app.send_photo(
|
471 |
+
chat_id=original_chat_id,
|
472 |
+
photo=img,
|
473 |
+
caption=_["stream_1"].format(
|
474 |
+
f"https://t.me/{app.username}?start=info_{videoid}",
|
475 |
+
title[:23],
|
476 |
+
check[0]["dur"],
|
477 |
+
user,
|
478 |
+
),
|
479 |
+
reply_markup=InlineKeyboardMarkup(button),
|
480 |
+
)
|
481 |
+
db[chat_id][0]["mystic"] = run
|
482 |
+
db[chat_id][0]["markup"] = "stream"
|
483 |
+
elif "index_" in queued:
|
484 |
+
stream = (
|
485 |
+
MediaStream(
|
486 |
+
videoid,
|
487 |
+
audio_parameters=AudioQuality.HIGH,
|
488 |
+
video_parameters=VideoQuality.SD_480p,
|
489 |
+
)
|
490 |
+
if str(streamtype) == "video"
|
491 |
+
else MediaStream(
|
492 |
+
videoid,
|
493 |
+
audio_parameters=AudioQuality.HIGH,
|
494 |
+
video_flags=MediaStream.IGNORE,
|
495 |
+
)
|
496 |
+
)
|
497 |
+
try:
|
498 |
+
await client.change_stream(chat_id, stream)
|
499 |
+
except:
|
500 |
+
return await app.send_message(
|
501 |
+
original_chat_id,
|
502 |
+
text=_["call_6"],
|
503 |
+
)
|
504 |
+
button = stream_markup2(_, chat_id)
|
505 |
+
run = await app.send_photo(
|
506 |
+
chat_id=original_chat_id,
|
507 |
+
photo=config.STREAM_IMG_URL,
|
508 |
+
caption=_["stream_2"].format(user),
|
509 |
+
reply_markup=InlineKeyboardMarkup(button),
|
510 |
+
)
|
511 |
+
db[chat_id][0]["mystic"] = run
|
512 |
+
db[chat_id][0]["markup"] = "tg"
|
513 |
+
else:
|
514 |
+
if video:
|
515 |
+
stream = MediaStream(
|
516 |
+
queued,
|
517 |
+
audio_parameters=AudioQuality.HIGH,
|
518 |
+
video_parameters=VideoQuality.SD_480p,
|
519 |
+
)
|
520 |
+
else:
|
521 |
+
stream = MediaStream(
|
522 |
+
queued,
|
523 |
+
audio_parameters=AudioQuality.HIGH,
|
524 |
+
video_flags=MediaStream.IGNORE,
|
525 |
+
)
|
526 |
+
try:
|
527 |
+
await client.change_stream(chat_id, stream)
|
528 |
+
except:
|
529 |
+
return await app.send_message(
|
530 |
+
original_chat_id,
|
531 |
+
text=_["call_6"],
|
532 |
+
)
|
533 |
+
if videoid == "telegram":
|
534 |
+
button = stream_markup2(_, chat_id)
|
535 |
+
run = await app.send_photo(
|
536 |
+
chat_id=original_chat_id,
|
537 |
+
photo=(
|
538 |
+
config.TELEGRAM_AUDIO_URL
|
539 |
+
if str(streamtype) == "audio"
|
540 |
+
else config.TELEGRAM_VIDEO_URL
|
541 |
+
),
|
542 |
+
caption=_["stream_1"].format(
|
543 |
+
config.SUPPORT_CHAT, title[:23], check[0]["dur"], user
|
544 |
+
),
|
545 |
+
reply_markup=InlineKeyboardMarkup(button),
|
546 |
+
)
|
547 |
+
db[chat_id][0]["mystic"] = run
|
548 |
+
db[chat_id][0]["markup"] = "tg"
|
549 |
+
elif videoid == "soundcloud":
|
550 |
+
button = stream_markup2(_, chat_id)
|
551 |
+
run = await app.send_photo(
|
552 |
+
chat_id=original_chat_id,
|
553 |
+
photo=config.SOUNCLOUD_IMG_URL,
|
554 |
+
caption=_["stream_1"].format(
|
555 |
+
config.SUPPORT_CHAT, title[:23], check[0]["dur"], user
|
556 |
+
),
|
557 |
+
reply_markup=InlineKeyboardMarkup(button),
|
558 |
+
)
|
559 |
+
db[chat_id][0]["mystic"] = run
|
560 |
+
db[chat_id][0]["markup"] = "tg"
|
561 |
+
else:
|
562 |
+
img = await get_thumb(videoid)
|
563 |
+
button = stream_markup(_, videoid, chat_id)
|
564 |
+
run = await app.send_photo(
|
565 |
+
chat_id=original_chat_id,
|
566 |
+
photo=img,
|
567 |
+
caption=_["stream_1"].format(
|
568 |
+
f"https://t.me/{app.username}?start=info_{videoid}",
|
569 |
+
title[:23],
|
570 |
+
check[0]["dur"],
|
571 |
+
user,
|
572 |
+
),
|
573 |
+
reply_markup=InlineKeyboardMarkup(button),
|
574 |
+
)
|
575 |
+
db[chat_id][0]["mystic"] = run
|
576 |
+
db[chat_id][0]["markup"] = "stream"
|
577 |
+
|
578 |
+
async def ping(self):
|
579 |
+
pings = []
|
580 |
+
if config.STRING1:
|
581 |
+
pings.append(await self.one.ping)
|
582 |
+
if config.STRING2:
|
583 |
+
pings.append(await self.two.ping)
|
584 |
+
if config.STRING3:
|
585 |
+
pings.append(await self.three.ping)
|
586 |
+
if config.STRING4:
|
587 |
+
pings.append(await self.four.ping)
|
588 |
+
if config.STRING5:
|
589 |
+
pings.append(await self.five.ping)
|
590 |
+
return str(round(sum(pings) / len(pings), 3))
|
591 |
+
|
592 |
+
async def start(self):
|
593 |
+
LOGGER(__name__).info("Starting PyTgCalls Client...\n")
|
594 |
+
if config.STRING1:
|
595 |
+
await self.one.start()
|
596 |
+
if config.STRING2:
|
597 |
+
await self.two.start()
|
598 |
+
if config.STRING3:
|
599 |
+
await self.three.start()
|
600 |
+
if config.STRING4:
|
601 |
+
await self.four.start()
|
602 |
+
if config.STRING5:
|
603 |
+
await self.five.start()
|
604 |
+
|
605 |
+
async def decorators(self):
|
606 |
+
@self.one.on_kicked()
|
607 |
+
@self.two.on_kicked()
|
608 |
+
@self.three.on_kicked()
|
609 |
+
@self.four.on_kicked()
|
610 |
+
@self.five.on_kicked()
|
611 |
+
@self.one.on_closed_voice_chat()
|
612 |
+
@self.two.on_closed_voice_chat()
|
613 |
+
@self.three.on_closed_voice_chat()
|
614 |
+
@self.four.on_closed_voice_chat()
|
615 |
+
@self.five.on_closed_voice_chat()
|
616 |
+
@self.one.on_left()
|
617 |
+
@self.two.on_left()
|
618 |
+
@self.three.on_left()
|
619 |
+
@self.four.on_left()
|
620 |
+
@self.five.on_left()
|
621 |
+
async def stream_services_handler(_, chat_id: int):
|
622 |
+
await self.stop_stream(chat_id)
|
623 |
+
|
624 |
+
@self.one.on_stream_end()
|
625 |
+
@self.two.on_stream_end()
|
626 |
+
@self.three.on_stream_end()
|
627 |
+
@self.four.on_stream_end()
|
628 |
+
@self.five.on_stream_end()
|
629 |
+
async def stream_end_handler(client, update: Update):
|
630 |
+
if not isinstance(update, StreamAudioEnded):
|
631 |
+
return
|
632 |
+
await self.change_stream(client, update.chat_id)
|
633 |
+
|
634 |
+
|
635 |
+
Drag= Call()
|
DragMusic/core/dir.py
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
|
3 |
+
from ..logging import LOGGER
|
4 |
+
|
5 |
+
|
6 |
+
def dirr():
|
7 |
+
for file in os.listdir():
|
8 |
+
if file.endswith(".jpg"):
|
9 |
+
os.remove(file)
|
10 |
+
elif file.endswith(".jpeg"):
|
11 |
+
os.remove(file)
|
12 |
+
elif file.endswith(".png"):
|
13 |
+
os.remove(file)
|
14 |
+
|
15 |
+
if "downloads" not in os.listdir():
|
16 |
+
os.mkdir("downloads")
|
17 |
+
if "cache" not in os.listdir():
|
18 |
+
os.mkdir("cache")
|
19 |
+
|
20 |
+
LOGGER(__name__).info("Directories Updated.")
|
DragMusic/core/git.py
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import asyncio
|
2 |
+
import shlex
|
3 |
+
from typing import Tuple
|
4 |
+
|
5 |
+
from git import Repo
|
6 |
+
from git.exc import GitCommandError, InvalidGitRepositoryError
|
7 |
+
|
8 |
+
import config
|
9 |
+
|
10 |
+
from ..logging import LOGGER
|
11 |
+
|
12 |
+
|
13 |
+
def install_req(cmd: str) -> Tuple[str, str, int, int]:
|
14 |
+
async def install_requirements():
|
15 |
+
args = shlex.split(cmd)
|
16 |
+
process = await asyncio.create_subprocess_exec(
|
17 |
+
*args,
|
18 |
+
stdout=asyncio.subprocess.PIPE,
|
19 |
+
stderr=asyncio.subprocess.PIPE,
|
20 |
+
)
|
21 |
+
stdout, stderr = await process.communicate()
|
22 |
+
return (
|
23 |
+
stdout.decode("utf-8", "replace").strip(),
|
24 |
+
stderr.decode("utf-8", "replace").strip(),
|
25 |
+
process.returncode,
|
26 |
+
process.pid,
|
27 |
+
)
|
28 |
+
|
29 |
+
return asyncio.get_event_loop().run_until_complete(install_requirements())
|
30 |
+
|
31 |
+
|
32 |
+
def git():
|
33 |
+
REPO_LINK = config.UPSTREAM_REPO
|
34 |
+
if config.GIT_TOKEN:
|
35 |
+
GIT_USERNAME = REPO_LINK.split("com/")[1].split("/")[0]
|
36 |
+
TEMP_REPO = REPO_LINK.split("https://")[1]
|
37 |
+
UPSTREAM_REPO = f"https://{GIT_USERNAME}:{config.GIT_TOKEN}@{TEMP_REPO}"
|
38 |
+
else:
|
39 |
+
UPSTREAM_REPO = config.UPSTREAM_REPO
|
40 |
+
try:
|
41 |
+
repo = Repo()
|
42 |
+
LOGGER(__name__).info(f"Git Client Found [VPS DEPLOYER]")
|
43 |
+
except GitCommandError:
|
44 |
+
LOGGER(__name__).info(f"Invalid Git Command")
|
45 |
+
except InvalidGitRepositoryError:
|
46 |
+
repo = Repo.init()
|
47 |
+
if "origin" in repo.remotes:
|
48 |
+
origin = repo.remote("origin")
|
49 |
+
else:
|
50 |
+
origin = repo.create_remote("origin", UPSTREAM_REPO)
|
51 |
+
origin.fetch()
|
52 |
+
repo.create_head(
|
53 |
+
config.UPSTREAM_BRANCH,
|
54 |
+
origin.refs[config.UPSTREAM_BRANCH],
|
55 |
+
)
|
56 |
+
repo.heads[config.UPSTREAM_BRANCH].set_tracking_branch(
|
57 |
+
origin.refs[config.UPSTREAM_BRANCH]
|
58 |
+
)
|
59 |
+
repo.heads[config.UPSTREAM_BRANCH].checkout(True)
|
60 |
+
try:
|
61 |
+
repo.create_remote("origin", config.UPSTREAM_REPO)
|
62 |
+
except BaseException:
|
63 |
+
pass
|
64 |
+
nrs = repo.remote("origin")
|
65 |
+
nrs.fetch(config.UPSTREAM_BRANCH)
|
66 |
+
try:
|
67 |
+
nrs.pull(config.UPSTREAM_BRANCH)
|
68 |
+
except GitCommandError:
|
69 |
+
repo.git.reset("--hard", "FETCH_HEAD")
|
70 |
+
install_req("pip3 install --no-cache-dir -r requirements.txt")
|
71 |
+
LOGGER(__name__).info(f"Fetching updates from upstream repository...")
|
DragMusic/core/mongo.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from motor.motor_asyncio import AsyncIOMotorClient
|
2 |
+
|
3 |
+
from config import MONGO_DB_URI
|
4 |
+
|
5 |
+
from ..logging import LOGGER
|
6 |
+
|
7 |
+
LOGGER(__name__).info("Connecting to your Mongo Database...")
|
8 |
+
try:
|
9 |
+
_mongo_async_ = AsyncIOMotorClient(MONGO_DB_URI)
|
10 |
+
mongodb = _mongo_async_.Anon
|
11 |
+
LOGGER(__name__).info("Connected to your Mongo Database.")
|
12 |
+
except:
|
13 |
+
LOGGER(__name__).error("Failed to connect to your Mongo Database.")
|
14 |
+
exit()
|
DragMusic/core/userbot.py
ADDED
@@ -0,0 +1,170 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from pyrogram import Client
|
2 |
+
|
3 |
+
import config
|
4 |
+
|
5 |
+
from ..logging import LOGGER
|
6 |
+
|
7 |
+
assistants = []
|
8 |
+
assistantids = []
|
9 |
+
|
10 |
+
|
11 |
+
class Userbot(Client):
|
12 |
+
def __init__(self):
|
13 |
+
self.one = Client(
|
14 |
+
name="AnonXAss1",
|
15 |
+
api_id=config.API_ID,
|
16 |
+
api_hash=config.API_HASH,
|
17 |
+
session_string=str(config.STRING1),
|
18 |
+
no_updates=True,
|
19 |
+
)
|
20 |
+
self.two = Client(
|
21 |
+
name="AnonXAss2",
|
22 |
+
api_id=config.API_ID,
|
23 |
+
api_hash=config.API_HASH,
|
24 |
+
session_string=str(config.STRING2),
|
25 |
+
no_updates=True,
|
26 |
+
)
|
27 |
+
self.three = Client(
|
28 |
+
name="AnonXAss3",
|
29 |
+
api_id=config.API_ID,
|
30 |
+
api_hash=config.API_HASH,
|
31 |
+
session_string=str(config.STRING3),
|
32 |
+
no_updates=True,
|
33 |
+
)
|
34 |
+
self.four = Client(
|
35 |
+
name="AnonXAss4",
|
36 |
+
api_id=config.API_ID,
|
37 |
+
api_hash=config.API_HASH,
|
38 |
+
session_string=str(config.STRING4),
|
39 |
+
no_updates=True,
|
40 |
+
)
|
41 |
+
self.five = Client(
|
42 |
+
name="AnonXAss5",
|
43 |
+
api_id=config.API_ID,
|
44 |
+
api_hash=config.API_HASH,
|
45 |
+
session_string=str(config.STRING5),
|
46 |
+
no_updates=True,
|
47 |
+
)
|
48 |
+
|
49 |
+
async def start(self):
|
50 |
+
LOGGER(__name__).info(f"Starting Assistants...")
|
51 |
+
if config.STRING1:
|
52 |
+
await self.one.start()
|
53 |
+
try:
|
54 |
+
await self.one.join_chat("dragbackup")
|
55 |
+
await self.one.join_chat("dragbackup")
|
56 |
+
except:
|
57 |
+
pass
|
58 |
+
assistants.append(1)
|
59 |
+
try:
|
60 |
+
await self.one.send_message(config.LOGGER_ID, "Assistant Started")
|
61 |
+
except:
|
62 |
+
LOGGER(__name__).error(
|
63 |
+
"Assistant Account 1 has failed to access the log Group. Make sure that you have added your assistant to your log group and promoted as admin!"
|
64 |
+
)
|
65 |
+
exit()
|
66 |
+
self.one.id = self.one.me.id
|
67 |
+
self.one.name = self.one.me.mention
|
68 |
+
self.one.username = self.one.me.username
|
69 |
+
assistantids.append(self.one.id)
|
70 |
+
LOGGER(__name__).info(f"Assistant Started as {self.one.name}")
|
71 |
+
|
72 |
+
if config.STRING2:
|
73 |
+
await self.two.start()
|
74 |
+
try:
|
75 |
+
await self.two.join_chat("dragbackup")
|
76 |
+
await self.two.join_chat("dragbackup")
|
77 |
+
except:
|
78 |
+
pass
|
79 |
+
assistants.append(2)
|
80 |
+
try:
|
81 |
+
await self.two.send_message(config.LOGGER_ID, "Assistant Started")
|
82 |
+
except:
|
83 |
+
LOGGER(__name__).error(
|
84 |
+
"Assistant Account 2 has failed to access the log Group. Make sure that you have added your assistant to your log group and promoted as admin!"
|
85 |
+
)
|
86 |
+
exit()
|
87 |
+
self.two.id = self.two.me.id
|
88 |
+
self.two.name = self.two.me.mention
|
89 |
+
self.two.username = self.two.me.username
|
90 |
+
assistantids.append(self.two.id)
|
91 |
+
LOGGER(__name__).info(f"Assistant Two Started as {self.two.name}")
|
92 |
+
|
93 |
+
if config.STRING3:
|
94 |
+
await self.three.start()
|
95 |
+
try:
|
96 |
+
await self.three.join_chat("dragbackup")
|
97 |
+
await self.three.join_chat("dragbackup")
|
98 |
+
except:
|
99 |
+
pass
|
100 |
+
assistants.append(3)
|
101 |
+
try:
|
102 |
+
await self.three.send_message(config.LOGGER_ID, "Assistant Started")
|
103 |
+
except:
|
104 |
+
LOGGER(__name__).error(
|
105 |
+
"Assistant Account 3 has failed to access the log Group. Make sure that you have added your assistant to your log group and promoted as admin! "
|
106 |
+
)
|
107 |
+
exit()
|
108 |
+
self.three.id = self.three.me.id
|
109 |
+
self.three.name = self.three.me.mention
|
110 |
+
self.three.username = self.three.me.username
|
111 |
+
assistantids.append(self.three.id)
|
112 |
+
LOGGER(__name__).info(f"Assistant Three Started as {self.three.name}")
|
113 |
+
|
114 |
+
if config.STRING4:
|
115 |
+
await self.four.start()
|
116 |
+
try:
|
117 |
+
await self.four.join_chat("dragbackup")
|
118 |
+
await self.four.join_chat("dragbackup")
|
119 |
+
except:
|
120 |
+
pass
|
121 |
+
assistants.append(4)
|
122 |
+
try:
|
123 |
+
await self.four.send_message(config.LOGGER_ID, "Assistant Started")
|
124 |
+
except:
|
125 |
+
LOGGER(__name__).error(
|
126 |
+
"Assistant Account 4 has failed to access the log Group. Make sure that you have added your assistant to your log group and promoted as admin! "
|
127 |
+
)
|
128 |
+
exit()
|
129 |
+
self.four.id = self.four.me.id
|
130 |
+
self.four.name = self.four.me.mention
|
131 |
+
self.four.username = self.four.me.username
|
132 |
+
assistantids.append(self.four.id)
|
133 |
+
LOGGER(__name__).info(f"Assistant Four Started as {self.four.name}")
|
134 |
+
|
135 |
+
if config.STRING5:
|
136 |
+
await self.five.start()
|
137 |
+
try:
|
138 |
+
await self.five.join_chat("dragbackup")
|
139 |
+
await self.five.join_chat("dragbackup")
|
140 |
+
except:
|
141 |
+
pass
|
142 |
+
assistants.append(5)
|
143 |
+
try:
|
144 |
+
await self.five.send_message(config.LOGGER_ID, "Assistant Started")
|
145 |
+
except:
|
146 |
+
LOGGER(__name__).error(
|
147 |
+
"Assistant Account 5 has failed to access the log Group. Make sure that you have added your assistant to your log group and promoted as admin! "
|
148 |
+
)
|
149 |
+
exit()
|
150 |
+
self.five.id = self.five.me.id
|
151 |
+
self.five.name = self.five.me.mention
|
152 |
+
self.five.username = self.five.me.username
|
153 |
+
assistantids.append(self.five.id)
|
154 |
+
LOGGER(__name__).info(f"Assistant Five Started as {self.five.name}")
|
155 |
+
|
156 |
+
async def stop(self):
|
157 |
+
LOGGER(__name__).info(f"Stopping Assistants...")
|
158 |
+
try:
|
159 |
+
if config.STRING1:
|
160 |
+
await self.one.stop()
|
161 |
+
if config.STRING2:
|
162 |
+
await self.two.stop()
|
163 |
+
if config.STRING3:
|
164 |
+
await self.three.stop()
|
165 |
+
if config.STRING4:
|
166 |
+
await self.four.stop()
|
167 |
+
if config.STRING5:
|
168 |
+
await self.five.stop()
|
169 |
+
except:
|
170 |
+
pass
|
DragMusic/logging.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import logging
|
2 |
+
|
3 |
+
logging.basicConfig(
|
4 |
+
level=logging.INFO,
|
5 |
+
format="[%(asctime)s - %(levelname)s] - %(name)s - %(message)s",
|
6 |
+
datefmt="%d-%b-%y %H:%M:%S",
|
7 |
+
handlers=[
|
8 |
+
logging.FileHandler("logs.txt"),
|
9 |
+
logging.StreamHandler(),
|
10 |
+
],
|
11 |
+
)
|
12 |
+
|
13 |
+
logging.getLogger("httpx").setLevel(logging.ERROR)
|
14 |
+
logging.getLogger("pyrogram").setLevel(logging.ERROR)
|
15 |
+
logging.getLogger("pytgcalls").setLevel(logging.ERROR)
|
16 |
+
|
17 |
+
|
18 |
+
def LOGGER(name: str) -> logging.Logger:
|
19 |
+
return logging.getLogger(name)
|
DragMusic/misc.py
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import socket
|
2 |
+
import time
|
3 |
+
|
4 |
+
import heroku3
|
5 |
+
from pyrogram import filters
|
6 |
+
|
7 |
+
import config
|
8 |
+
from DragMusic.core.mongo import mongodb
|
9 |
+
|
10 |
+
from .logging import LOGGER
|
11 |
+
|
12 |
+
SUDOERS = filters.user()
|
13 |
+
|
14 |
+
HAPP = None
|
15 |
+
_boot_ = time.time()
|
16 |
+
|
17 |
+
|
18 |
+
def is_heroku():
|
19 |
+
return "heroku" in socket.getfqdn()
|
20 |
+
|
21 |
+
|
22 |
+
XCB = [
|
23 |
+
"/",
|
24 |
+
"@",
|
25 |
+
".",
|
26 |
+
"com",
|
27 |
+
":",
|
28 |
+
"git",
|
29 |
+
"heroku",
|
30 |
+
"push",
|
31 |
+
str(config.HEROKU_API_KEY),
|
32 |
+
"https",
|
33 |
+
str(config.HEROKU_APP_NAME),
|
34 |
+
"HEAD",
|
35 |
+
"master",
|
36 |
+
]
|
37 |
+
|
38 |
+
|
39 |
+
def dbb():
|
40 |
+
global db
|
41 |
+
db = {}
|
42 |
+
LOGGER(__name__).info(f"Local Database Initialized.")
|
43 |
+
|
44 |
+
|
45 |
+
async def sudo():
|
46 |
+
global SUDOERS
|
47 |
+
SUDOERS.add(config.OWNER_ID)
|
48 |
+
sudoersdb = mongodb.sudoers
|
49 |
+
sudoers = await sudoersdb.find_one({"sudo": "sudo"})
|
50 |
+
sudoers = [] if not sudoers else sudoers["sudoers"]
|
51 |
+
if config.OWNER_ID not in sudoers:
|
52 |
+
sudoers.append(config.OWNER_ID)
|
53 |
+
await sudoersdb.update_one(
|
54 |
+
{"sudo": "sudo"},
|
55 |
+
{"$set": {"sudoers": sudoers}},
|
56 |
+
upsert=True,
|
57 |
+
)
|
58 |
+
if sudoers:
|
59 |
+
for user_id in sudoers:
|
60 |
+
SUDOERS.add(user_id)
|
61 |
+
LOGGER(__name__).info(f"Sudoers Loaded.")
|
62 |
+
|
63 |
+
|
64 |
+
def heroku():
|
65 |
+
global HAPP
|
66 |
+
if is_heroku:
|
67 |
+
if config.HEROKU_API_KEY and config.HEROKU_APP_NAME:
|
68 |
+
try:
|
69 |
+
Heroku = heroku3.from_key(config.HEROKU_API_KEY)
|
70 |
+
HAPP = Heroku.app(config.HEROKU_APP_NAME)
|
71 |
+
LOGGER(__name__).info(f"Heroku App Configured")
|
72 |
+
except BaseException:
|
73 |
+
LOGGER(__name__).warning(
|
74 |
+
f"Please make sure your Heroku API Key and Your App name are configured correctly in the heroku."
|
75 |
+
)
|
DragMusic/platforms/Apple.py
ADDED
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import re
|
2 |
+
from typing import Union
|
3 |
+
|
4 |
+
import aiohttp
|
5 |
+
from bs4 import BeautifulSoup
|
6 |
+
from youtubesearchpython.__future__ import VideosSearch
|
7 |
+
|
8 |
+
|
9 |
+
class AppleAPI:
|
10 |
+
def __init__(self):
|
11 |
+
self.regex = r"^(https:\/\/music.apple.com\/)(.*)$"
|
12 |
+
self.base = "https://music.apple.com/in/playlist/"
|
13 |
+
|
14 |
+
async def valid(self, link: str):
|
15 |
+
if re.search(self.regex, link):
|
16 |
+
return True
|
17 |
+
else:
|
18 |
+
return False
|
19 |
+
|
20 |
+
async def track(self, url, playid: Union[bool, str] = None):
|
21 |
+
if playid:
|
22 |
+
url = self.base + url
|
23 |
+
async with aiohttp.ClientSession() as session:
|
24 |
+
async with session.get(url) as response:
|
25 |
+
if response.status != 200:
|
26 |
+
return False
|
27 |
+
html = await response.text()
|
28 |
+
soup = BeautifulSoup(html, "html.parser")
|
29 |
+
search = None
|
30 |
+
for tag in soup.find_all("meta"):
|
31 |
+
if tag.get("property", None) == "og:title":
|
32 |
+
search = tag.get("content", None)
|
33 |
+
if search is None:
|
34 |
+
return False
|
35 |
+
results = VideosSearch(search, limit=1)
|
36 |
+
for result in (await results.next())["result"]:
|
37 |
+
title = result["title"]
|
38 |
+
ytlink = result["link"]
|
39 |
+
vidid = result["id"]
|
40 |
+
duration_min = result["duration"]
|
41 |
+
thumbnail = result["thumbnails"][0]["url"].split("?")[0]
|
42 |
+
track_details = {
|
43 |
+
"title": title,
|
44 |
+
"link": ytlink,
|
45 |
+
"vidid": vidid,
|
46 |
+
"duration_min": duration_min,
|
47 |
+
"thumb": thumbnail,
|
48 |
+
}
|
49 |
+
return track_details, vidid
|
50 |
+
|
51 |
+
async def playlist(self, url, playid: Union[bool, str] = None):
|
52 |
+
if playid:
|
53 |
+
url = self.base + url
|
54 |
+
playlist_id = url.split("playlist/")[1]
|
55 |
+
async with aiohttp.ClientSession() as session:
|
56 |
+
async with session.get(url) as response:
|
57 |
+
if response.status != 200:
|
58 |
+
return False
|
59 |
+
html = await response.text()
|
60 |
+
soup = BeautifulSoup(html, "html.parser")
|
61 |
+
applelinks = soup.find_all("meta", attrs={"property": "music:song"})
|
62 |
+
results = []
|
63 |
+
for item in applelinks:
|
64 |
+
try:
|
65 |
+
xx = (((item["content"]).split("album/")[1]).split("/")[0]).replace(
|
66 |
+
"-", " "
|
67 |
+
)
|
68 |
+
except:
|
69 |
+
xx = ((item["content"]).split("album/")[1]).split("/")[0]
|
70 |
+
results.append(xx)
|
71 |
+
return results, playlist_id
|
DragMusic/platforms/Carbon.py
ADDED
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import random
|
2 |
+
from os.path import realpath
|
3 |
+
|
4 |
+
import aiohttp
|
5 |
+
from aiohttp import client_exceptions
|
6 |
+
|
7 |
+
|
8 |
+
class UnableToFetchCarbon(Exception):
|
9 |
+
pass
|
10 |
+
|
11 |
+
|
12 |
+
themes = [
|
13 |
+
"3024-night",
|
14 |
+
"a11y-dark",
|
15 |
+
"blackboard",
|
16 |
+
"base16-dark",
|
17 |
+
"base16-light",
|
18 |
+
"cobalt",
|
19 |
+
"duotone-dark",
|
20 |
+
"dracula-pro",
|
21 |
+
"hopscotch",
|
22 |
+
"lucario",
|
23 |
+
"material",
|
24 |
+
"monokai",
|
25 |
+
"nightowl",
|
26 |
+
"nord",
|
27 |
+
"oceanic-next",
|
28 |
+
"one-light",
|
29 |
+
"one-dark",
|
30 |
+
"panda-syntax",
|
31 |
+
"parasio-dark",
|
32 |
+
"seti",
|
33 |
+
"shades-of-purple",
|
34 |
+
"solarized+dark",
|
35 |
+
"solarized+light",
|
36 |
+
"synthwave-84",
|
37 |
+
"twilight",
|
38 |
+
"verminal",
|
39 |
+
"vscode",
|
40 |
+
"yeti",
|
41 |
+
"zenburn",
|
42 |
+
]
|
43 |
+
|
44 |
+
colour = [
|
45 |
+
"#FF0000",
|
46 |
+
"#FF5733",
|
47 |
+
"#FFFF00",
|
48 |
+
"#008000",
|
49 |
+
"#0000FF",
|
50 |
+
"#800080",
|
51 |
+
"#A52A2A",
|
52 |
+
"#FF00FF",
|
53 |
+
"#D2B48C",
|
54 |
+
"#00FFFF",
|
55 |
+
"#808000",
|
56 |
+
"#800000",
|
57 |
+
"#00FFFF",
|
58 |
+
"#30D5C8",
|
59 |
+
"#00FF00",
|
60 |
+
"#008080",
|
61 |
+
"#4B0082",
|
62 |
+
"#EE82EE",
|
63 |
+
"#FFC0CB",
|
64 |
+
"#000000",
|
65 |
+
"#FFFFFF",
|
66 |
+
"#808080",
|
67 |
+
]
|
68 |
+
|
69 |
+
|
70 |
+
class CarbonAPI:
|
71 |
+
def __init__(self):
|
72 |
+
self.language = "auto"
|
73 |
+
self.drop_shadow = True
|
74 |
+
self.drop_shadow_blur = "68px"
|
75 |
+
self.drop_shadow_offset = "20px"
|
76 |
+
self.font_family = "JetBrains Mono"
|
77 |
+
self.width_adjustment = True
|
78 |
+
self.watermark = False
|
79 |
+
|
80 |
+
async def generate(self, text: str, user_id):
|
81 |
+
async with aiohttp.ClientSession(
|
82 |
+
headers={"Content-Type": "application/json"},
|
83 |
+
) as ses:
|
84 |
+
params = {
|
85 |
+
"code": text,
|
86 |
+
}
|
87 |
+
params["backgroundColor"] = random.choice(colour)
|
88 |
+
params["theme"] = random.choice(themes)
|
89 |
+
params["dropShadow"] = self.drop_shadow
|
90 |
+
params["dropShadowOffsetY"] = self.drop_shadow_offset
|
91 |
+
params["dropShadowBlurRadius"] = self.drop_shadow_blur
|
92 |
+
params["fontFamily"] = self.font_family
|
93 |
+
params["language"] = self.language
|
94 |
+
params["watermark"] = self.watermark
|
95 |
+
params["widthAdjustment"] = self.width_adjustment
|
96 |
+
try:
|
97 |
+
request = await ses.post(
|
98 |
+
"https://carbonara.solopov.dev/api/cook",
|
99 |
+
json=params,
|
100 |
+
)
|
101 |
+
except client_exceptions.ClientConnectorError:
|
102 |
+
raise UnableToFetchCarbon("Can not reach the Host!")
|
103 |
+
resp = await request.read()
|
104 |
+
with open(f"cache/carbon{user_id}.jpg", "wb") as f:
|
105 |
+
f.write(resp)
|
106 |
+
return realpath(f.name)
|
DragMusic/platforms/Resso.py
ADDED
@@ -0,0 +1,54 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import re
|
2 |
+
from typing import Union
|
3 |
+
|
4 |
+
import aiohttp
|
5 |
+
from bs4 import BeautifulSoup
|
6 |
+
from youtubesearchpython.__future__ import VideosSearch
|
7 |
+
|
8 |
+
|
9 |
+
class RessoAPI:
|
10 |
+
def __init__(self):
|
11 |
+
self.regex = r"^(https:\/\/m.resso.com\/)(.*)$"
|
12 |
+
self.base = "https://m.resso.com/"
|
13 |
+
|
14 |
+
async def valid(self, link: str):
|
15 |
+
if re.search(self.regex, link):
|
16 |
+
return True
|
17 |
+
else:
|
18 |
+
return False
|
19 |
+
|
20 |
+
async def track(self, url, playid: Union[bool, str] = None):
|
21 |
+
if playid:
|
22 |
+
url = self.base + url
|
23 |
+
async with aiohttp.ClientSession() as session:
|
24 |
+
async with session.get(url) as response:
|
25 |
+
if response.status != 200:
|
26 |
+
return False
|
27 |
+
html = await response.text()
|
28 |
+
soup = BeautifulSoup(html, "html.parser")
|
29 |
+
for tag in soup.find_all("meta"):
|
30 |
+
if tag.get("property", None) == "og:title":
|
31 |
+
title = tag.get("content", None)
|
32 |
+
if tag.get("property", None) == "og:description":
|
33 |
+
des = tag.get("content", None)
|
34 |
+
try:
|
35 |
+
des = des.split("·")[0]
|
36 |
+
except:
|
37 |
+
pass
|
38 |
+
if des == "":
|
39 |
+
return
|
40 |
+
results = VideosSearch(title, limit=1)
|
41 |
+
for result in (await results.next())["result"]:
|
42 |
+
title = result["title"]
|
43 |
+
ytlink = result["link"]
|
44 |
+
vidid = result["id"]
|
45 |
+
duration_min = result["duration"]
|
46 |
+
thumbnail = result["thumbnails"][0]["url"].split("?")[0]
|
47 |
+
track_details = {
|
48 |
+
"title": title,
|
49 |
+
"link": ytlink,
|
50 |
+
"vidid": vidid,
|
51 |
+
"duration_min": duration_min,
|
52 |
+
"thumb": thumbnail,
|
53 |
+
}
|
54 |
+
return track_details, vidid
|
DragMusic/platforms/Soundcloud.py
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from os import path
|
2 |
+
|
3 |
+
from yt_dlp import YoutubeDL
|
4 |
+
|
5 |
+
from DragMusic.utils.formatters import seconds_to_min
|
6 |
+
|
7 |
+
|
8 |
+
class SoundAPI:
|
9 |
+
def __init__(self):
|
10 |
+
self.opts = {
|
11 |
+
"outtmpl": "downloads/%(id)s.%(ext)s",
|
12 |
+
"format": "best",
|
13 |
+
"retries": 3,
|
14 |
+
"nooverwrites": False,
|
15 |
+
"continuedl": True,
|
16 |
+
}
|
17 |
+
|
18 |
+
async def valid(self, link: str):
|
19 |
+
if "soundcloud" in link:
|
20 |
+
return True
|
21 |
+
else:
|
22 |
+
return False
|
23 |
+
|
24 |
+
async def download(self, url):
|
25 |
+
d = YoutubeDL(self.opts)
|
26 |
+
try:
|
27 |
+
info = d.extract_info(url)
|
28 |
+
except:
|
29 |
+
return False
|
30 |
+
xyz = path.join("downloads", f"{info['id']}.{info['ext']}")
|
31 |
+
duration_min = seconds_to_min(info["duration"])
|
32 |
+
track_details = {
|
33 |
+
"title": info["title"],
|
34 |
+
"duration_sec": info["duration"],
|
35 |
+
"duration_min": duration_min,
|
36 |
+
"uploader": info["uploader"],
|
37 |
+
"filepath": xyz,
|
38 |
+
}
|
39 |
+
return track_details, xyz
|
DragMusic/platforms/Spotify.py
ADDED
@@ -0,0 +1,98 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import re
|
2 |
+
|
3 |
+
import spotipy
|
4 |
+
from spotipy.oauth2 import SpotifyClientCredentials
|
5 |
+
from youtubesearchpython.__future__ import VideosSearch
|
6 |
+
|
7 |
+
import config
|
8 |
+
|
9 |
+
|
10 |
+
class SpotifyAPI:
|
11 |
+
def __init__(self):
|
12 |
+
self.regex = r"^(https:\/\/open.spotify.com\/)(.*)$"
|
13 |
+
self.client_id = config.SPOTIFY_CLIENT_ID
|
14 |
+
self.client_secret = config.SPOTIFY_CLIENT_SECRET
|
15 |
+
if config.SPOTIFY_CLIENT_ID and config.SPOTIFY_CLIENT_SECRET:
|
16 |
+
self.client_credentials_manager = SpotifyClientCredentials(
|
17 |
+
self.client_id, self.client_secret
|
18 |
+
)
|
19 |
+
self.spotify = spotipy.Spotify(
|
20 |
+
client_credentials_manager=self.client_credentials_manager
|
21 |
+
)
|
22 |
+
else:
|
23 |
+
self.spotify = None
|
24 |
+
|
25 |
+
async def valid(self, link: str):
|
26 |
+
if re.search(self.regex, link):
|
27 |
+
return True
|
28 |
+
else:
|
29 |
+
return False
|
30 |
+
|
31 |
+
async def track(self, link: str):
|
32 |
+
track = self.spotify.track(link)
|
33 |
+
info = track["name"]
|
34 |
+
for artist in track["artists"]:
|
35 |
+
fetched = f' {artist["name"]}'
|
36 |
+
if "Various Artists" not in fetched:
|
37 |
+
info += fetched
|
38 |
+
results = VideosSearch(info, limit=1)
|
39 |
+
for result in (await results.next())["result"]:
|
40 |
+
ytlink = result["link"]
|
41 |
+
title = result["title"]
|
42 |
+
vidid = result["id"]
|
43 |
+
duration_min = result["duration"]
|
44 |
+
thumbnail = result["thumbnails"][0]["url"].split("?")[0]
|
45 |
+
track_details = {
|
46 |
+
"title": title,
|
47 |
+
"link": ytlink,
|
48 |
+
"vidid": vidid,
|
49 |
+
"duration_min": duration_min,
|
50 |
+
"thumb": thumbnail,
|
51 |
+
}
|
52 |
+
return track_details, vidid
|
53 |
+
|
54 |
+
async def playlist(self, url):
|
55 |
+
playlist = self.spotify.playlist(url)
|
56 |
+
playlist_id = playlist["id"]
|
57 |
+
results = []
|
58 |
+
for item in playlist["tracks"]["items"]:
|
59 |
+
music_track = item["track"]
|
60 |
+
info = music_track["name"]
|
61 |
+
for artist in music_track["artists"]:
|
62 |
+
fetched = f' {artist["name"]}'
|
63 |
+
if "Various Artists" not in fetched:
|
64 |
+
info += fetched
|
65 |
+
results.append(info)
|
66 |
+
return results, playlist_id
|
67 |
+
|
68 |
+
async def album(self, url):
|
69 |
+
album = self.spotify.album(url)
|
70 |
+
album_id = album["id"]
|
71 |
+
results = []
|
72 |
+
for item in album["tracks"]["items"]:
|
73 |
+
info = item["name"]
|
74 |
+
for artist in item["artists"]:
|
75 |
+
fetched = f' {artist["name"]}'
|
76 |
+
if "Various Artists" not in fetched:
|
77 |
+
info += fetched
|
78 |
+
results.append(info)
|
79 |
+
|
80 |
+
return (
|
81 |
+
results,
|
82 |
+
album_id,
|
83 |
+
)
|
84 |
+
|
85 |
+
async def artist(self, url):
|
86 |
+
artistinfo = self.spotify.artist(url)
|
87 |
+
artist_id = artistinfo["id"]
|
88 |
+
results = []
|
89 |
+
artisttoptracks = self.spotify.artist_top_tracks(url)
|
90 |
+
for item in artisttoptracks["tracks"]:
|
91 |
+
info = item["name"]
|
92 |
+
for artist in item["artists"]:
|
93 |
+
fetched = f' {artist["name"]}'
|
94 |
+
if "Various Artists" not in fetched:
|
95 |
+
info += fetched
|
96 |
+
results.append(info)
|
97 |
+
|
98 |
+
return results, artist_id
|
DragMusic/platforms/Telegram.py
ADDED
@@ -0,0 +1,176 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import asyncio
|
2 |
+
import os
|
3 |
+
import time
|
4 |
+
from typing import Union
|
5 |
+
|
6 |
+
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Voice
|
7 |
+
|
8 |
+
import config
|
9 |
+
from DragMusic import app
|
10 |
+
from DragMusic.utils.formatters import (
|
11 |
+
check_duration,
|
12 |
+
convert_bytes,
|
13 |
+
get_readable_time,
|
14 |
+
seconds_to_min,
|
15 |
+
)
|
16 |
+
|
17 |
+
|
18 |
+
class TeleAPI:
|
19 |
+
def __init__(self):
|
20 |
+
self.chars_limit = 4096
|
21 |
+
self.sleep = 5
|
22 |
+
|
23 |
+
async def send_split_text(self, message, string):
|
24 |
+
n = self.chars_limit
|
25 |
+
out = [(string[i : i + n]) for i in range(0, len(string), n)]
|
26 |
+
j = 0
|
27 |
+
for x in out:
|
28 |
+
if j <= 2:
|
29 |
+
j += 1
|
30 |
+
await message.reply_text(x, disable_web_page_preview=True)
|
31 |
+
return True
|
32 |
+
|
33 |
+
async def get_link(self, message):
|
34 |
+
return message.link
|
35 |
+
|
36 |
+
async def get_filename(self, file, audio: Union[bool, str] = None):
|
37 |
+
try:
|
38 |
+
file_name = file.file_name
|
39 |
+
if file_name is None:
|
40 |
+
file_name = "ᴛᴇʟᴇɢʀᴀᴍ ᴀᴜᴅɪᴏ" if audio else "ᴛᴇʟᴇɢʀᴀᴍ ᴠɪᴅᴇᴏ"
|
41 |
+
except:
|
42 |
+
file_name = "ᴛᴇʟᴇɢʀᴀᴍ ᴀᴜᴅɪᴏ" if audio else "ᴛᴇʟᴇɢʀᴀᴍ ᴠɪᴅᴇᴏ"
|
43 |
+
return file_name
|
44 |
+
|
45 |
+
async def get_duration(self, file):
|
46 |
+
try:
|
47 |
+
dur = seconds_to_min(file.duration)
|
48 |
+
except:
|
49 |
+
dur = "Unknown"
|
50 |
+
return dur
|
51 |
+
|
52 |
+
async def get_duration(self, filex, file_path):
|
53 |
+
try:
|
54 |
+
dur = seconds_to_min(filex.duration)
|
55 |
+
except:
|
56 |
+
try:
|
57 |
+
dur = await asyncio.get_event_loop().run_in_executor(
|
58 |
+
None, check_duration, file_path
|
59 |
+
)
|
60 |
+
dur = seconds_to_min(dur)
|
61 |
+
except:
|
62 |
+
return "Unknown"
|
63 |
+
return dur
|
64 |
+
|
65 |
+
async def get_filepath(
|
66 |
+
self,
|
67 |
+
audio: Union[bool, str] = None,
|
68 |
+
video: Union[bool, str] = None,
|
69 |
+
):
|
70 |
+
if audio:
|
71 |
+
try:
|
72 |
+
file_name = (
|
73 |
+
audio.file_unique_id
|
74 |
+
+ "."
|
75 |
+
+ (
|
76 |
+
(audio.file_name.split(".")[-1])
|
77 |
+
if (not isinstance(audio, Voice))
|
78 |
+
else "ogg"
|
79 |
+
)
|
80 |
+
)
|
81 |
+
except:
|
82 |
+
file_name = audio.file_unique_id + "." + "ogg"
|
83 |
+
file_name = os.path.join(os.path.realpath("downloads"), file_name)
|
84 |
+
if video:
|
85 |
+
try:
|
86 |
+
file_name = (
|
87 |
+
video.file_unique_id + "." + (video.file_name.split(".")[-1])
|
88 |
+
)
|
89 |
+
except:
|
90 |
+
file_name = video.file_unique_id + "." + "mp4"
|
91 |
+
file_name = os.path.join(os.path.realpath("downloads"), file_name)
|
92 |
+
return file_name
|
93 |
+
|
94 |
+
async def download(self, _, message, mystic, fname):
|
95 |
+
lower = [0, 8, 17, 38, 64, 77, 96]
|
96 |
+
higher = [5, 10, 20, 40, 66, 80, 99]
|
97 |
+
checker = [5, 10, 20, 40, 66, 80, 99]
|
98 |
+
speed_counter = {}
|
99 |
+
if os.path.exists(fname):
|
100 |
+
return True
|
101 |
+
|
102 |
+
async def down_load():
|
103 |
+
async def progress(current, total):
|
104 |
+
if current == total:
|
105 |
+
return
|
106 |
+
current_time = time.time()
|
107 |
+
start_time = speed_counter.get(message.id)
|
108 |
+
check_time = current_time - start_time
|
109 |
+
upl = InlineKeyboardMarkup(
|
110 |
+
[
|
111 |
+
[
|
112 |
+
InlineKeyboardButton(
|
113 |
+
text="ᴄᴀɴᴄᴇʟ",
|
114 |
+
callback_data="stop_downloading",
|
115 |
+
),
|
116 |
+
]
|
117 |
+
]
|
118 |
+
)
|
119 |
+
percentage = current * 100 / total
|
120 |
+
percentage = str(round(percentage, 2))
|
121 |
+
speed = current / check_time
|
122 |
+
eta = int((total - current) / speed)
|
123 |
+
eta = get_readable_time(eta)
|
124 |
+
if not eta:
|
125 |
+
eta = "0 sᴇᴄᴏɴᴅs"
|
126 |
+
total_size = convert_bytes(total)
|
127 |
+
completed_size = convert_bytes(current)
|
128 |
+
speed = convert_bytes(speed)
|
129 |
+
percentage = int((percentage.split("."))[0])
|
130 |
+
for counter in range(7):
|
131 |
+
low = int(lower[counter])
|
132 |
+
high = int(higher[counter])
|
133 |
+
check = int(checker[counter])
|
134 |
+
if low < percentage <= high:
|
135 |
+
if high == check:
|
136 |
+
try:
|
137 |
+
await mystic.edit_text(
|
138 |
+
text=_["tg_1"].format(
|
139 |
+
app.mention,
|
140 |
+
total_size,
|
141 |
+
completed_size,
|
142 |
+
percentage[:5],
|
143 |
+
speed,
|
144 |
+
eta,
|
145 |
+
),
|
146 |
+
reply_markup=upl,
|
147 |
+
)
|
148 |
+
checker[counter] = 100
|
149 |
+
except:
|
150 |
+
pass
|
151 |
+
|
152 |
+
speed_counter[message.id] = time.time()
|
153 |
+
try:
|
154 |
+
await app.download_media(
|
155 |
+
message.reply_to_message,
|
156 |
+
file_name=fname,
|
157 |
+
progress=progress,
|
158 |
+
)
|
159 |
+
try:
|
160 |
+
elapsed = get_readable_time(
|
161 |
+
int(int(time.time()) - int(speed_counter[message.id]))
|
162 |
+
)
|
163 |
+
except:
|
164 |
+
elapsed = "0 sᴇᴄᴏɴᴅs"
|
165 |
+
await mystic.edit_text(_["tg_2"].format(elapsed))
|
166 |
+
except:
|
167 |
+
await mystic.edit_text(_["tg_3"])
|
168 |
+
|
169 |
+
task = asyncio.create_task(down_load())
|
170 |
+
config.lyrical[mystic.id] = task
|
171 |
+
await task
|
172 |
+
verify = config.lyrical.get(mystic.id)
|
173 |
+
if not verify:
|
174 |
+
return False
|
175 |
+
config.lyrical.pop(mystic.id)
|
176 |
+
return True
|
DragMusic/platforms/Youtube.py
ADDED
@@ -0,0 +1,470 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import asyncio
|
2 |
+
import os
|
3 |
+
import re
|
4 |
+
import json
|
5 |
+
from typing import Union
|
6 |
+
import requests
|
7 |
+
import yt_dlp
|
8 |
+
from pyrogram.enums import MessageEntityType
|
9 |
+
from pyrogram.types import Message
|
10 |
+
from youtubesearchpython.__future__ import VideosSearch
|
11 |
+
from DragMusic.utils.database import is_on_off
|
12 |
+
from DragMusic.utils.formatters import time_to_seconds
|
13 |
+
import os
|
14 |
+
import glob
|
15 |
+
import random
|
16 |
+
import logging
|
17 |
+
import aiohttp
|
18 |
+
import config
|
19 |
+
from config import API_URL, API_KEY
|
20 |
+
|
21 |
+
|
22 |
+
def cookie_txt_file():
|
23 |
+
cookie_dir = f"{os.getcwd()}/cookies"
|
24 |
+
cookies_files = [f for f in os.listdir(cookie_dir) if f.endswith(".txt")]
|
25 |
+
|
26 |
+
cookie_file = os.path.join(cookie_dir, random.choice(cookies_files))
|
27 |
+
return cookie_file
|
28 |
+
|
29 |
+
|
30 |
+
async def download_song(link: str):
|
31 |
+
video_id = link.split('v=')[-1].split('&')[0]
|
32 |
+
|
33 |
+
download_folder = "downloads"
|
34 |
+
for ext in ["mp3", "m4a", "webm"]:
|
35 |
+
file_path = f"{download_folder}/{video_id}.{ext}"
|
36 |
+
if os.path.exists(file_path):
|
37 |
+
#print(f"File already exists: {file_path}")
|
38 |
+
return file_path
|
39 |
+
|
40 |
+
song_url = f"{API_URL}/song/{video_id}?api={API_KEY}"
|
41 |
+
async with aiohttp.ClientSession() as session:
|
42 |
+
while True:
|
43 |
+
try:
|
44 |
+
async with session.get(song_url) as response:
|
45 |
+
if response.status != 200:
|
46 |
+
raise Exception(f"API request failed with status code {response.status}")
|
47 |
+
data = await response.json()
|
48 |
+
status = data.get("status", "").lower()
|
49 |
+
if status == "downloading":
|
50 |
+
await asyncio.sleep(2)
|
51 |
+
continue
|
52 |
+
elif status == "error":
|
53 |
+
error_msg = data.get("error") or data.get("message") or "Unknown error"
|
54 |
+
raise Exception(f"API error: {error_msg}")
|
55 |
+
elif status == "done":
|
56 |
+
download_url = data.get("link")
|
57 |
+
if not download_url:
|
58 |
+
raise Exception("API response did not provide a download URL.")
|
59 |
+
break
|
60 |
+
else:
|
61 |
+
raise Exception(f"Unexpected status '{status}' from API.")
|
62 |
+
except Exception as e:
|
63 |
+
print(f"Error while checking API status: {e}")
|
64 |
+
return None
|
65 |
+
|
66 |
+
try:
|
67 |
+
file_format = data.get("format", "mp3")
|
68 |
+
file_extension = file_format.lower()
|
69 |
+
file_name = f"{video_id}.{file_extension}"
|
70 |
+
download_folder = "downloads"
|
71 |
+
os.makedirs(download_folder, exist_ok=True)
|
72 |
+
file_path = os.path.join(download_folder, file_name)
|
73 |
+
|
74 |
+
async with session.get(download_url) as file_response:
|
75 |
+
with open(file_path, 'wb') as f:
|
76 |
+
while True:
|
77 |
+
chunk = await file_response.content.read(8192)
|
78 |
+
if not chunk:
|
79 |
+
break
|
80 |
+
f.write(chunk)
|
81 |
+
return file_path
|
82 |
+
except aiohttp.ClientError as e:
|
83 |
+
print(f"Network or client error occurred while downloading: {e}")
|
84 |
+
return None
|
85 |
+
except Exception as e:
|
86 |
+
print(f"Error occurred while downloading song: {e}")
|
87 |
+
return None
|
88 |
+
return None
|
89 |
+
|
90 |
+
async def check_file_size(link):
|
91 |
+
async def get_format_info(link):
|
92 |
+
proc = await asyncio.create_subprocess_exec(
|
93 |
+
"yt-dlp",
|
94 |
+
"--cookies", cookie_txt_file(),
|
95 |
+
"-J",
|
96 |
+
link,
|
97 |
+
stdout=asyncio.subprocess.PIPE,
|
98 |
+
stderr=asyncio.subprocess.PIPE
|
99 |
+
)
|
100 |
+
stdout, stderr = await proc.communicate()
|
101 |
+
if proc.returncode != 0:
|
102 |
+
print(f'Error:\n{stderr.decode()}')
|
103 |
+
return None
|
104 |
+
return json.loads(stdout.decode())
|
105 |
+
|
106 |
+
def parse_size(formats):
|
107 |
+
total_size = 0
|
108 |
+
for format in formats:
|
109 |
+
if 'filesize' in format:
|
110 |
+
total_size += format['filesize']
|
111 |
+
return total_size
|
112 |
+
|
113 |
+
info = await get_format_info(link)
|
114 |
+
if info is None:
|
115 |
+
return None
|
116 |
+
|
117 |
+
formats = info.get('formats', [])
|
118 |
+
if not formats:
|
119 |
+
print("No formats found.")
|
120 |
+
return None
|
121 |
+
|
122 |
+
total_size = parse_size(formats)
|
123 |
+
return total_size
|
124 |
+
|
125 |
+
async def shell_cmd(cmd):
|
126 |
+
proc = await asyncio.create_subprocess_shell(
|
127 |
+
cmd,
|
128 |
+
stdout=asyncio.subprocess.PIPE,
|
129 |
+
stderr=asyncio.subprocess.PIPE,
|
130 |
+
)
|
131 |
+
out, errorz = await proc.communicate()
|
132 |
+
if errorz:
|
133 |
+
if "unavailable videos are hidden" in (errorz.decode("utf-8")).lower():
|
134 |
+
return out.decode("utf-8")
|
135 |
+
else:
|
136 |
+
return errorz.decode("utf-8")
|
137 |
+
return out.decode("utf-8")
|
138 |
+
|
139 |
+
|
140 |
+
class YouTubeAPI:
|
141 |
+
def __init__(self):
|
142 |
+
self.base = "https://www.youtube.com/watch?v="
|
143 |
+
self.regex = r"(?:youtube\.com|youtu\.be)"
|
144 |
+
self.status = "https://www.youtube.com/oembed?url="
|
145 |
+
self.listbase = "https://youtube.com/playlist?list="
|
146 |
+
self.reg = re.compile(r"\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])")
|
147 |
+
|
148 |
+
async def exists(self, link: str, videoid: Union[bool, str] = None):
|
149 |
+
if videoid:
|
150 |
+
link = self.base + link
|
151 |
+
if re.search(self.regex, link):
|
152 |
+
return True
|
153 |
+
else:
|
154 |
+
return False
|
155 |
+
|
156 |
+
async def url(self, message_1: Message) -> Union[str, None]:
|
157 |
+
messages = [message_1]
|
158 |
+
if message_1.reply_to_message:
|
159 |
+
messages.append(message_1.reply_to_message)
|
160 |
+
text = ""
|
161 |
+
offset = None
|
162 |
+
length = None
|
163 |
+
for message in messages:
|
164 |
+
if offset:
|
165 |
+
break
|
166 |
+
if message.entities:
|
167 |
+
for entity in message.entities:
|
168 |
+
if entity.type == MessageEntityType.URL:
|
169 |
+
text = message.text or message.caption
|
170 |
+
offset, length = entity.offset, entity.length
|
171 |
+
break
|
172 |
+
elif message.caption_entities:
|
173 |
+
for entity in message.caption_entities:
|
174 |
+
if entity.type == MessageEntityType.TEXT_LINK:
|
175 |
+
return entity.url
|
176 |
+
if offset in (None,):
|
177 |
+
return None
|
178 |
+
return text[offset : offset + length]
|
179 |
+
|
180 |
+
async def details(self, link: str, videoid: Union[bool, str] = None):
|
181 |
+
if videoid:
|
182 |
+
link = self.base + link
|
183 |
+
if "&" in link:
|
184 |
+
link = link.split("&")[0]
|
185 |
+
results = VideosSearch(link, limit=1)
|
186 |
+
for result in (await results.next())["result"]:
|
187 |
+
title = result["title"]
|
188 |
+
duration_min = result["duration"]
|
189 |
+
thumbnail = result["thumbnails"][0]["url"].split("?")[0]
|
190 |
+
vidid = result["id"]
|
191 |
+
if str(duration_min) == "None":
|
192 |
+
duration_sec = 0
|
193 |
+
else:
|
194 |
+
duration_sec = int(time_to_seconds(duration_min))
|
195 |
+
return title, duration_min, duration_sec, thumbnail, vidid
|
196 |
+
|
197 |
+
async def title(self, link: str, videoid: Union[bool, str] = None):
|
198 |
+
if videoid:
|
199 |
+
link = self.base + link
|
200 |
+
if "&" in link:
|
201 |
+
link = link.split("&")[0]
|
202 |
+
results = VideosSearch(link, limit=1)
|
203 |
+
for result in (await results.next())["result"]:
|
204 |
+
title = result["title"]
|
205 |
+
return title
|
206 |
+
|
207 |
+
async def duration(self, link: str, videoid: Union[bool, str] = None):
|
208 |
+
if videoid:
|
209 |
+
link = self.base + link
|
210 |
+
if "&" in link:
|
211 |
+
link = link.split("&")[0]
|
212 |
+
results = VideosSearch(link, limit=1)
|
213 |
+
for result in (await results.next())["result"]:
|
214 |
+
duration = result["duration"]
|
215 |
+
return duration
|
216 |
+
|
217 |
+
async def thumbnail(self, link: str, videoid: Union[bool, str] = None):
|
218 |
+
if videoid:
|
219 |
+
link = self.base + link
|
220 |
+
if "&" in link:
|
221 |
+
link = link.split("&")[0]
|
222 |
+
results = VideosSearch(link, limit=1)
|
223 |
+
for result in (await results.next())["result"]:
|
224 |
+
thumbnail = result["thumbnails"][0]["url"].split("?")[0]
|
225 |
+
return thumbnail
|
226 |
+
|
227 |
+
async def video(self, link: str, videoid: Union[bool, str] = None):
|
228 |
+
if videoid:
|
229 |
+
link = self.base + link
|
230 |
+
if "&" in link:
|
231 |
+
link = link.split("&")[0]
|
232 |
+
proc = await asyncio.create_subprocess_exec(
|
233 |
+
"yt-dlp",
|
234 |
+
"--cookies",cookie_txt_file(),
|
235 |
+
"-g",
|
236 |
+
"-f",
|
237 |
+
"best[height<=?720][width<=?1280]",
|
238 |
+
f"{link}",
|
239 |
+
stdout=asyncio.subprocess.PIPE,
|
240 |
+
stderr=asyncio.subprocess.PIPE,
|
241 |
+
)
|
242 |
+
stdout, stderr = await proc.communicate()
|
243 |
+
if stdout:
|
244 |
+
return 1, stdout.decode().split("\n")[0]
|
245 |
+
else:
|
246 |
+
return 0, stderr.decode()
|
247 |
+
|
248 |
+
async def playlist(self, link, limit, user_id, videoid: Union[bool, str] = None):
|
249 |
+
if videoid:
|
250 |
+
link = self.listbase + link
|
251 |
+
if "&" in link:
|
252 |
+
link = link.split("&")[0]
|
253 |
+
playlist = await shell_cmd(
|
254 |
+
f"yt-dlp -i --get-id --flat-playlist --cookies {cookie_txt_file()} --playlist-end {limit} --skip-download {link}"
|
255 |
+
)
|
256 |
+
try:
|
257 |
+
result = playlist.split("\n")
|
258 |
+
for key in result:
|
259 |
+
if key == "":
|
260 |
+
result.remove(key)
|
261 |
+
except:
|
262 |
+
result = []
|
263 |
+
return result
|
264 |
+
|
265 |
+
async def track(self, link: str, videoid: Union[bool, str] = None):
|
266 |
+
if videoid:
|
267 |
+
link = self.base + link
|
268 |
+
if "&" in link:
|
269 |
+
link = link.split("&")[0]
|
270 |
+
results = VideosSearch(link, limit=1)
|
271 |
+
for result in (await results.next())["result"]:
|
272 |
+
title = result["title"]
|
273 |
+
duration_min = result["duration"]
|
274 |
+
vidid = result["id"]
|
275 |
+
yturl = result["link"]
|
276 |
+
thumbnail = result["thumbnails"][0]["url"].split("?")[0]
|
277 |
+
track_details = {
|
278 |
+
"title": title,
|
279 |
+
"link": yturl,
|
280 |
+
"vidid": vidid,
|
281 |
+
"duration_min": duration_min,
|
282 |
+
"thumb": thumbnail,
|
283 |
+
}
|
284 |
+
return track_details, vidid
|
285 |
+
|
286 |
+
async def formats(self, link: str, videoid: Union[bool, str] = None):
|
287 |
+
if videoid:
|
288 |
+
link = self.base + link
|
289 |
+
if "&" in link:
|
290 |
+
link = link.split("&")[0]
|
291 |
+
ytdl_opts = {"quiet": True, "cookiefile" : cookie_txt_file()}
|
292 |
+
ydl = yt_dlp.YoutubeDL(ytdl_opts)
|
293 |
+
with ydl:
|
294 |
+
formats_available = []
|
295 |
+
r = ydl.extract_info(link, download=False)
|
296 |
+
for format in r["formats"]:
|
297 |
+
try:
|
298 |
+
str(format["format"])
|
299 |
+
except:
|
300 |
+
continue
|
301 |
+
if not "dash" in str(format["format"]).lower():
|
302 |
+
try:
|
303 |
+
format["format"]
|
304 |
+
format["filesize"]
|
305 |
+
format["format_id"]
|
306 |
+
format["ext"]
|
307 |
+
format["format_note"]
|
308 |
+
except:
|
309 |
+
continue
|
310 |
+
formats_available.append(
|
311 |
+
{
|
312 |
+
"format": format["format"],
|
313 |
+
"filesize": format["filesize"],
|
314 |
+
"format_id": format["format_id"],
|
315 |
+
"ext": format["ext"],
|
316 |
+
"format_note": format["format_note"],
|
317 |
+
"yturl": link,
|
318 |
+
}
|
319 |
+
)
|
320 |
+
return formats_available, link
|
321 |
+
|
322 |
+
async def slider(
|
323 |
+
self,
|
324 |
+
link: str,
|
325 |
+
query_type: int,
|
326 |
+
videoid: Union[bool, str] = None,
|
327 |
+
):
|
328 |
+
if videoid:
|
329 |
+
link = self.base + link
|
330 |
+
if "&" in link:
|
331 |
+
link = link.split("&")[0]
|
332 |
+
a = VideosSearch(link, limit=10)
|
333 |
+
result = (await a.next()).get("result")
|
334 |
+
title = result[query_type]["title"]
|
335 |
+
duration_min = result[query_type]["duration"]
|
336 |
+
vidid = result[query_type]["id"]
|
337 |
+
thumbnail = result[query_type]["thumbnails"][0]["url"].split("?")[0]
|
338 |
+
return title, duration_min, thumbnail, vidid
|
339 |
+
|
340 |
+
async def download(
|
341 |
+
self,
|
342 |
+
link: str,
|
343 |
+
mystic,
|
344 |
+
video: Union[bool, str] = None,
|
345 |
+
videoid: Union[bool, str] = None,
|
346 |
+
songaudio: Union[bool, str] = None,
|
347 |
+
songvideo: Union[bool, str] = None,
|
348 |
+
format_id: Union[bool, str] = None,
|
349 |
+
title: Union[bool, str] = None,
|
350 |
+
) -> str:
|
351 |
+
if videoid:
|
352 |
+
link = self.base + link
|
353 |
+
loop = asyncio.get_running_loop()
|
354 |
+
def audio_dl():
|
355 |
+
ydl_optssx = {
|
356 |
+
"format": "bestaudio/best",
|
357 |
+
"outtmpl": "downloads/%(id)s.%(ext)s",
|
358 |
+
"geo_bypass": True,
|
359 |
+
"nocheckcertificate": True,
|
360 |
+
"quiet": True,
|
361 |
+
"cookiefile" : cookie_txt_file(),
|
362 |
+
"no_warnings": True,
|
363 |
+
}
|
364 |
+
x = yt_dlp.YoutubeDL(ydl_optssx)
|
365 |
+
info = x.extract_info(link, False)
|
366 |
+
xyz = os.path.join("downloads", f"{info['id']}.{info['ext']}")
|
367 |
+
if os.path.exists(xyz):
|
368 |
+
return xyz
|
369 |
+
x.download([link])
|
370 |
+
return xyz
|
371 |
+
|
372 |
+
def video_dl():
|
373 |
+
ydl_optssx = {
|
374 |
+
"format": "(bestvideo[height<=?720][width<=?1280][ext=mp4])+(bestaudio[ext=m4a])",
|
375 |
+
"outtmpl": "downloads/%(id)s.%(ext)s",
|
376 |
+
"geo_bypass": True,
|
377 |
+
"nocheckcertificate": True,
|
378 |
+
"quiet": True,
|
379 |
+
"cookiefile" : cookie_txt_file(),
|
380 |
+
"no_warnings": True,
|
381 |
+
}
|
382 |
+
x = yt_dlp.YoutubeDL(ydl_optssx)
|
383 |
+
info = x.extract_info(link, False)
|
384 |
+
xyz = os.path.join("downloads", f"{info['id']}.{info['ext']}")
|
385 |
+
if os.path.exists(xyz):
|
386 |
+
return xyz
|
387 |
+
x.download([link])
|
388 |
+
return xyz
|
389 |
+
|
390 |
+
def song_video_dl():
|
391 |
+
formats = f"{format_id}+140"
|
392 |
+
fpath = f"downloads/{title}"
|
393 |
+
ydl_optssx = {
|
394 |
+
"format": formats,
|
395 |
+
"outtmpl": fpath,
|
396 |
+
"geo_bypass": True,
|
397 |
+
"nocheckcertificate": True,
|
398 |
+
"quiet": True,
|
399 |
+
"no_warnings": True,
|
400 |
+
"cookiefile" : cookie_txt_file(),
|
401 |
+
"prefer_ffmpeg": True,
|
402 |
+
"merge_output_format": "mp4",
|
403 |
+
}
|
404 |
+
x = yt_dlp.YoutubeDL(ydl_optssx)
|
405 |
+
x.download([link])
|
406 |
+
|
407 |
+
def song_audio_dl():
|
408 |
+
fpath = f"downloads/{title}.%(ext)s"
|
409 |
+
ydl_optssx = {
|
410 |
+
"format": format_id,
|
411 |
+
"outtmpl": fpath,
|
412 |
+
"geo_bypass": True,
|
413 |
+
"nocheckcertificate": True,
|
414 |
+
"quiet": True,
|
415 |
+
"no_warnings": True,
|
416 |
+
"cookiefile" : cookie_txt_file(),
|
417 |
+
"prefer_ffmpeg": True,
|
418 |
+
"postprocessors": [
|
419 |
+
{
|
420 |
+
"key": "FFmpegExtractAudio",
|
421 |
+
"preferredcodec": "mp3",
|
422 |
+
"preferredquality": "192",
|
423 |
+
}
|
424 |
+
],
|
425 |
+
}
|
426 |
+
x = yt_dlp.YoutubeDL(ydl_optssx)
|
427 |
+
x.download([link])
|
428 |
+
|
429 |
+
if songvideo:
|
430 |
+
await download_song(link)
|
431 |
+
fpath = f"downloads/{link}.mp3"
|
432 |
+
return fpath
|
433 |
+
elif songaudio:
|
434 |
+
await download_song(link)
|
435 |
+
fpath = f"downloads/{link}.mp3"
|
436 |
+
return fpath
|
437 |
+
elif video:
|
438 |
+
if await is_on_off(1):
|
439 |
+
direct = True
|
440 |
+
downloaded_file = await download_song(link)
|
441 |
+
else:
|
442 |
+
proc = await asyncio.create_subprocess_exec(
|
443 |
+
"yt-dlp",
|
444 |
+
"--cookies",cookie_txt_file(),
|
445 |
+
"-g",
|
446 |
+
"-f",
|
447 |
+
"best[height<=?720][width<=?1280]",
|
448 |
+
f"{link}",
|
449 |
+
stdout=asyncio.subprocess.PIPE,
|
450 |
+
stderr=asyncio.subprocess.PIPE,
|
451 |
+
)
|
452 |
+
stdout, stderr = await proc.communicate()
|
453 |
+
if stdout:
|
454 |
+
downloaded_file = stdout.decode().split("\n")[0]
|
455 |
+
direct = False
|
456 |
+
else:
|
457 |
+
file_size = await check_file_size(link)
|
458 |
+
if not file_size:
|
459 |
+
print("None file Size")
|
460 |
+
return
|
461 |
+
total_size_mb = file_size / (1024 * 1024)
|
462 |
+
if total_size_mb > 250:
|
463 |
+
print(f"File size {total_size_mb:.2f} MB exceeds the 100MB limit.")
|
464 |
+
return None
|
465 |
+
direct = True
|
466 |
+
downloaded_file = await loop.run_in_executor(None, video_dl)
|
467 |
+
else:
|
468 |
+
direct = True
|
469 |
+
downloaded_file = await download_song(link)
|
470 |
+
return downloaded_file, direct
|
DragMusic/platforms/__init__.py
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from .Apple import AppleAPI
|
2 |
+
from .Carbon import CarbonAPI
|
3 |
+
from .Resso import RessoAPI
|
4 |
+
from .Soundcloud import SoundAPI
|
5 |
+
from .Spotify import SpotifyAPI
|
6 |
+
from .Telegram import TeleAPI
|
7 |
+
from .Youtube import YouTubeAPI
|
DragMusic/plugins/__init__.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import glob
|
2 |
+
from os.path import dirname, isfile
|
3 |
+
|
4 |
+
|
5 |
+
def __list_all_modules():
|
6 |
+
work_dir = dirname(__file__)
|
7 |
+
mod_paths = glob.glob(work_dir + "/*/*.py")
|
8 |
+
|
9 |
+
all_modules = [
|
10 |
+
(((f.replace(work_dir, "")).replace("/", "."))[:-3])
|
11 |
+
for f in mod_paths
|
12 |
+
if isfile(f) and f.endswith(".py") and not f.endswith("__init__.py")
|
13 |
+
]
|
14 |
+
|
15 |
+
return all_modules
|
16 |
+
|
17 |
+
|
18 |
+
ALL_MODULES = sorted(__list_all_modules())
|
19 |
+
__all__ = ALL_MODULES + ["ALL_MODULES"]
|
DragMusic/plugins/admins/auth.py
ADDED
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from pyrogram import filters
|
2 |
+
from pyrogram.types import Message
|
3 |
+
|
4 |
+
from DragMusic import app
|
5 |
+
from DragMusic.utils import extract_user, int_to_alpha
|
6 |
+
from DragMusic.utils.database import (
|
7 |
+
delete_authuser,
|
8 |
+
get_authuser,
|
9 |
+
get_authuser_names,
|
10 |
+
save_authuser,
|
11 |
+
)
|
12 |
+
from DragMusic.utils.decorators import AdminActual, language
|
13 |
+
from DragMusic.utils.inline import close_markup
|
14 |
+
from config import BANNED_USERS, adminlist
|
15 |
+
|
16 |
+
|
17 |
+
@app.on_message(filters.command("auth") & filters.group & ~BANNED_USERS)
|
18 |
+
@AdminActual
|
19 |
+
async def auth(client, message: Message, _):
|
20 |
+
if not message.reply_to_message:
|
21 |
+
if len(message.command) != 2:
|
22 |
+
return await message.reply_text(_["general_1"])
|
23 |
+
user = await extract_user(message)
|
24 |
+
token = await int_to_alpha(user.id)
|
25 |
+
_check = await get_authuser_names(message.chat.id)
|
26 |
+
count = len(_check)
|
27 |
+
if int(count) == 25:
|
28 |
+
return await message.reply_text(_["auth_1"])
|
29 |
+
if token not in _check:
|
30 |
+
assis = {
|
31 |
+
"auth_user_id": user.id,
|
32 |
+
"auth_name": user.first_name,
|
33 |
+
"admin_id": message.from_user.id,
|
34 |
+
"admin_name": message.from_user.first_name,
|
35 |
+
}
|
36 |
+
get = adminlist.get(message.chat.id)
|
37 |
+
if get:
|
38 |
+
if user.id not in get:
|
39 |
+
get.append(user.id)
|
40 |
+
await save_authuser(message.chat.id, token, assis)
|
41 |
+
return await message.reply_text(_["auth_2"].format(user.mention))
|
42 |
+
else:
|
43 |
+
return await message.reply_text(_["auth_3"].format(user.mention))
|
44 |
+
|
45 |
+
|
46 |
+
@app.on_message(filters.command("unauth") & filters.group & ~BANNED_USERS)
|
47 |
+
@AdminActual
|
48 |
+
async def unauthusers(client, message: Message, _):
|
49 |
+
if not message.reply_to_message:
|
50 |
+
if len(message.command) != 2:
|
51 |
+
return await message.reply_text(_["general_1"])
|
52 |
+
user = await extract_user(message)
|
53 |
+
token = await int_to_alpha(user.id)
|
54 |
+
deleted = await delete_authuser(message.chat.id, token)
|
55 |
+
get = adminlist.get(message.chat.id)
|
56 |
+
if get:
|
57 |
+
if user.id in get:
|
58 |
+
get.remove(user.id)
|
59 |
+
if deleted:
|
60 |
+
return await message.reply_text(_["auth_4"].format(user.mention))
|
61 |
+
else:
|
62 |
+
return await message.reply_text(_["auth_5"].format(user.mention))
|
63 |
+
|
64 |
+
|
65 |
+
@app.on_message(
|
66 |
+
filters.command(["authlist", "authusers"]) & filters.group & ~BANNED_USERS
|
67 |
+
)
|
68 |
+
@language
|
69 |
+
async def authusers(client, message: Message, _):
|
70 |
+
_wtf = await get_authuser_names(message.chat.id)
|
71 |
+
if not _wtf:
|
72 |
+
return await message.reply_text(_["setting_4"])
|
73 |
+
else:
|
74 |
+
j = 0
|
75 |
+
mystic = await message.reply_text(_["auth_6"])
|
76 |
+
text = _["auth_7"].format(message.chat.title)
|
77 |
+
for umm in _wtf:
|
78 |
+
_umm = await get_authuser(message.chat.id, umm)
|
79 |
+
user_id = _umm["auth_user_id"]
|
80 |
+
admin_id = _umm["admin_id"]
|
81 |
+
admin_name = _umm["admin_name"]
|
82 |
+
try:
|
83 |
+
user = (await app.get_users(user_id)).first_name
|
84 |
+
j += 1
|
85 |
+
except:
|
86 |
+
continue
|
87 |
+
text += f"{j}➤ {user}[<code>{user_id}</code>]\n"
|
88 |
+
text += f" {_['auth_8']} {admin_name}[<code>{admin_id}</code>]\n\n"
|
89 |
+
await mystic.edit_text(text, reply_markup=close_markup(_))
|
DragMusic/plugins/admins/callback.py
ADDED
@@ -0,0 +1,397 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import asyncio
|
2 |
+
|
3 |
+
from pyrogram import filters
|
4 |
+
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
|
5 |
+
|
6 |
+
from DragMusic import YouTube, app
|
7 |
+
from DragMusic.core.call import Drag
|
8 |
+
from DragMusic.misc import SUDOERS, db
|
9 |
+
from DragMusic.utils.database import (
|
10 |
+
get_active_chats,
|
11 |
+
get_lang,
|
12 |
+
get_upvote_count,
|
13 |
+
is_active_chat,
|
14 |
+
is_music_playing,
|
15 |
+
is_nonadmin_chat,
|
16 |
+
music_off,
|
17 |
+
music_on,
|
18 |
+
set_loop,
|
19 |
+
)
|
20 |
+
from DragMusic.utils.decorators.language import languageCB
|
21 |
+
from DragMusic.utils.formatters import seconds_to_min
|
22 |
+
from DragMusic.utils.inline import close_markup, stream_markup, stream_markup_timer
|
23 |
+
from DragMusic.utils.stream.autoclear import auto_clean
|
24 |
+
from DragMusic.utils.thumbnails import get_thumb
|
25 |
+
from config import (
|
26 |
+
BANNED_USERS,
|
27 |
+
SUPPORT_CHAT,
|
28 |
+
SOUNCLOUD_IMG_URL,
|
29 |
+
STREAM_IMG_URL,
|
30 |
+
TELEGRAM_AUDIO_URL,
|
31 |
+
TELEGRAM_VIDEO_URL,
|
32 |
+
adminlist,
|
33 |
+
confirmer,
|
34 |
+
votemode,
|
35 |
+
)
|
36 |
+
from strings import get_string
|
37 |
+
|
38 |
+
checker = {}
|
39 |
+
upvoters = {}
|
40 |
+
|
41 |
+
|
42 |
+
@app.on_callback_query(filters.regex("ADMIN") & ~BANNED_USERS)
|
43 |
+
@languageCB
|
44 |
+
async def del_back_playlist(client, CallbackQuery, _):
|
45 |
+
callback_data = CallbackQuery.data.strip()
|
46 |
+
callback_request = callback_data.split(None, 1)[1]
|
47 |
+
command, chat = callback_request.split("|")
|
48 |
+
if "_" in str(chat):
|
49 |
+
bet = chat.split("_")
|
50 |
+
chat = bet[0]
|
51 |
+
counter = bet[1]
|
52 |
+
chat_id = int(chat)
|
53 |
+
if not await is_active_chat(chat_id):
|
54 |
+
return await CallbackQuery.answer(_["general_5"], show_alert=True)
|
55 |
+
mention = CallbackQuery.from_user.mention
|
56 |
+
if command == "UpVote":
|
57 |
+
if chat_id not in votemode:
|
58 |
+
votemode[chat_id] = {}
|
59 |
+
if chat_id not in upvoters:
|
60 |
+
upvoters[chat_id] = {}
|
61 |
+
|
62 |
+
voters = (upvoters[chat_id]).get(CallbackQuery.message.id)
|
63 |
+
if not voters:
|
64 |
+
upvoters[chat_id][CallbackQuery.message.id] = []
|
65 |
+
|
66 |
+
vote = (votemode[chat_id]).get(CallbackQuery.message.id)
|
67 |
+
if not vote:
|
68 |
+
votemode[chat_id][CallbackQuery.message.id] = 0
|
69 |
+
|
70 |
+
if CallbackQuery.from_user.id in upvoters[chat_id][CallbackQuery.message.id]:
|
71 |
+
(upvoters[chat_id][CallbackQuery.message.id]).remove(
|
72 |
+
CallbackQuery.from_user.id
|
73 |
+
)
|
74 |
+
votemode[chat_id][CallbackQuery.message.id] -= 1
|
75 |
+
else:
|
76 |
+
(upvoters[chat_id][CallbackQuery.message.id]).append(
|
77 |
+
CallbackQuery.from_user.id
|
78 |
+
)
|
79 |
+
votemode[chat_id][CallbackQuery.message.id] += 1
|
80 |
+
upvote = await get_upvote_count(chat_id)
|
81 |
+
get_upvotes = int(votemode[chat_id][CallbackQuery.message.id])
|
82 |
+
if get_upvotes >= upvote:
|
83 |
+
votemode[chat_id][CallbackQuery.message.id] = upvote
|
84 |
+
try:
|
85 |
+
exists = confirmer[chat_id][CallbackQuery.message.id]
|
86 |
+
current = db[chat_id][0]
|
87 |
+
except:
|
88 |
+
return await CallbackQuery.edit_message_text(f"ғᴀɪʟᴇᴅ.")
|
89 |
+
try:
|
90 |
+
if current["vidid"] != exists["vidid"]:
|
91 |
+
return await CallbackQuery.edit_message.text(_["admin_35"])
|
92 |
+
if current["file"] != exists["file"]:
|
93 |
+
return await CallbackQuery.edit_message.text(_["admin_35"])
|
94 |
+
except:
|
95 |
+
return await CallbackQuery.edit_message_text(_["admin_36"])
|
96 |
+
try:
|
97 |
+
await CallbackQuery.edit_message_text(_["admin_37"].format(upvote))
|
98 |
+
except:
|
99 |
+
pass
|
100 |
+
command = counter
|
101 |
+
mention = "ᴜᴘᴠᴏᴛᴇs"
|
102 |
+
else:
|
103 |
+
if (
|
104 |
+
CallbackQuery.from_user.id
|
105 |
+
in upvoters[chat_id][CallbackQuery.message.id]
|
106 |
+
):
|
107 |
+
await CallbackQuery.answer(_["admin_38"], show_alert=True)
|
108 |
+
else:
|
109 |
+
await CallbackQuery.answer(_["admin_39"], show_alert=True)
|
110 |
+
upl = InlineKeyboardMarkup(
|
111 |
+
[
|
112 |
+
[
|
113 |
+
InlineKeyboardButton(
|
114 |
+
text=f"👍 {get_upvotes}",
|
115 |
+
callback_data=f"ADMIN UpVote|{chat_id}_{counter}",
|
116 |
+
)
|
117 |
+
]
|
118 |
+
]
|
119 |
+
)
|
120 |
+
await CallbackQuery.answer(_["admin_40"], show_alert=True)
|
121 |
+
return await CallbackQuery.edit_message_reply_markup(reply_markup=upl)
|
122 |
+
else:
|
123 |
+
is_non_admin = await is_nonadmin_chat(CallbackQuery.message.chat.id)
|
124 |
+
if not is_non_admin:
|
125 |
+
if CallbackQuery.from_user.id not in SUDOERS:
|
126 |
+
admins = adminlist.get(CallbackQuery.message.chat.id)
|
127 |
+
if not admins:
|
128 |
+
return await CallbackQuery.answer(_["admin_13"], show_alert=True)
|
129 |
+
else:
|
130 |
+
if CallbackQuery.from_user.id not in admins:
|
131 |
+
return await CallbackQuery.answer(
|
132 |
+
_["admin_14"], show_alert=True
|
133 |
+
)
|
134 |
+
if command == "Pause":
|
135 |
+
if not await is_music_playing(chat_id):
|
136 |
+
return await CallbackQuery.answer(_["admin_1"], show_alert=True)
|
137 |
+
await CallbackQuery.answer()
|
138 |
+
await music_off(chat_id)
|
139 |
+
await Drag.pause_stream(chat_id)
|
140 |
+
await CallbackQuery.message.reply_text(
|
141 |
+
_["admin_2"].format(mention), reply_markup=close_markup(_)
|
142 |
+
)
|
143 |
+
elif command == "Resume":
|
144 |
+
if await is_music_playing(chat_id):
|
145 |
+
return await CallbackQuery.answer(_["admin_3"], show_alert=True)
|
146 |
+
await CallbackQuery.answer()
|
147 |
+
await music_on(chat_id)
|
148 |
+
await Drag.resume_stream(chat_id)
|
149 |
+
await CallbackQuery.message.reply_text(
|
150 |
+
_["admin_4"].format(mention), reply_markup=close_markup(_)
|
151 |
+
)
|
152 |
+
elif command == "Stop" or command == "End":
|
153 |
+
await CallbackQuery.answer()
|
154 |
+
await Drag.stop_stream(chat_id)
|
155 |
+
await set_loop(chat_id, 0)
|
156 |
+
await CallbackQuery.message.reply_text(
|
157 |
+
_["admin_5"].format(mention), reply_markup=close_markup(_)
|
158 |
+
)
|
159 |
+
await CallbackQuery.message.delete()
|
160 |
+
elif command == "Skip" or command == "Replay":
|
161 |
+
check = db.get(chat_id)
|
162 |
+
if command == "Skip":
|
163 |
+
txt = f"➻ sᴛʀᴇᴀᴍ sᴋɪᴩᴩᴇᴅ 🎄\n│ \n└ʙʏ : {mention} 🥀"
|
164 |
+
popped = None
|
165 |
+
try:
|
166 |
+
popped = check.pop(0)
|
167 |
+
if popped:
|
168 |
+
await auto_clean(popped)
|
169 |
+
if not check:
|
170 |
+
await CallbackQuery.edit_message_text(
|
171 |
+
f"➻ sᴛʀᴇᴀᴍ sᴋɪᴩᴩᴇᴅ 🎄\n│ \n└ʙʏ : {mention} 🥀"
|
172 |
+
)
|
173 |
+
await CallbackQuery.message.reply_text(
|
174 |
+
text=_["admin_6"].format(
|
175 |
+
mention, CallbackQuery.message.chat.title
|
176 |
+
),
|
177 |
+
reply_markup=close_markup(_),
|
178 |
+
)
|
179 |
+
try:
|
180 |
+
return await Drag.stop_stream(chat_id)
|
181 |
+
except:
|
182 |
+
return
|
183 |
+
except:
|
184 |
+
try:
|
185 |
+
await CallbackQuery.edit_message_text(
|
186 |
+
f"➻ sᴛʀᴇᴀᴍ sᴋɪᴩᴩᴇᴅ 🎄\n│ \n└ʙʏ : {mention} 🥀"
|
187 |
+
)
|
188 |
+
await CallbackQuery.message.reply_text(
|
189 |
+
text=_["admin_6"].format(
|
190 |
+
mention, CallbackQuery.message.chat.title
|
191 |
+
),
|
192 |
+
reply_markup=close_markup(_),
|
193 |
+
)
|
194 |
+
return await Drag.stop_stream(chat_id)
|
195 |
+
except:
|
196 |
+
return
|
197 |
+
else:
|
198 |
+
txt = f"➻ sᴛʀᴇᴀᴍ ʀᴇ-ᴘʟᴀʏᴇᴅ 🎄\n│ \n└ʙʏ : {mention} 🥀"
|
199 |
+
await CallbackQuery.answer()
|
200 |
+
queued = check[0]["file"]
|
201 |
+
title = (check[0]["title"]).title()
|
202 |
+
user = check[0]["by"]
|
203 |
+
duration = check[0]["dur"]
|
204 |
+
streamtype = check[0]["streamtype"]
|
205 |
+
videoid = check[0]["vidid"]
|
206 |
+
status = True if str(streamtype) == "video" else None
|
207 |
+
db[chat_id][0]["played"] = 0
|
208 |
+
exis = (check[0]).get("old_dur")
|
209 |
+
if exis:
|
210 |
+
db[chat_id][0]["dur"] = exis
|
211 |
+
db[chat_id][0]["seconds"] = check[0]["old_second"]
|
212 |
+
db[chat_id][0]["speed_path"] = None
|
213 |
+
db[chat_id][0]["speed"] = 1.0
|
214 |
+
if "live_" in queued:
|
215 |
+
n, link = await YouTube.video(videoid, True)
|
216 |
+
if n == 0:
|
217 |
+
return await CallbackQuery.message.reply_text(
|
218 |
+
text=_["admin_7"].format(title),
|
219 |
+
reply_markup=close_markup(_),
|
220 |
+
)
|
221 |
+
try:
|
222 |
+
image = await YouTube.thumbnail(videoid, True)
|
223 |
+
except:
|
224 |
+
image = None
|
225 |
+
try:
|
226 |
+
await Drag.skip_stream(chat_id, link, video=status, image=image)
|
227 |
+
except:
|
228 |
+
return await CallbackQuery.message.reply_text(_["call_6"])
|
229 |
+
button = stream_markup(_, chat_id)
|
230 |
+
img = await get_thumb(videoid)
|
231 |
+
run = await CallbackQuery.message.reply_photo(
|
232 |
+
photo=img,
|
233 |
+
caption=_["stream_1"].format(
|
234 |
+
f"https://t.me/{app.username}?start=info_{videoid}",
|
235 |
+
title[:23],
|
236 |
+
duration,
|
237 |
+
user,
|
238 |
+
),
|
239 |
+
reply_markup=InlineKeyboardMarkup(button),
|
240 |
+
)
|
241 |
+
db[chat_id][0]["mystic"] = run
|
242 |
+
db[chat_id][0]["markup"] = "tg"
|
243 |
+
await CallbackQuery.edit_message_text(txt, reply_markup=close_markup(_))
|
244 |
+
elif "vid_" in queued:
|
245 |
+
mystic = await CallbackQuery.message.reply_text(
|
246 |
+
_["call_7"], disable_web_page_preview=True
|
247 |
+
)
|
248 |
+
try:
|
249 |
+
file_path, direct = await YouTube.download(
|
250 |
+
videoid,
|
251 |
+
mystic,
|
252 |
+
videoid=True,
|
253 |
+
video=status,
|
254 |
+
)
|
255 |
+
except:
|
256 |
+
return await mystic.edit_text(_["call_6"])
|
257 |
+
try:
|
258 |
+
image = await YouTube.thumbnail(videoid, True)
|
259 |
+
except:
|
260 |
+
image = None
|
261 |
+
try:
|
262 |
+
await Drag.skip_stream(chat_id, file_path, video=status, image=image)
|
263 |
+
except:
|
264 |
+
return await mystic.edit_text(_["call_6"])
|
265 |
+
button = stream_markup(_, chat_id)
|
266 |
+
img = await get_thumb(videoid)
|
267 |
+
run = await CallbackQuery.message.reply_photo(
|
268 |
+
photo=img,
|
269 |
+
caption=_["stream_1"].format(
|
270 |
+
f"https://t.me/{app.username}?start=info_{videoid}",
|
271 |
+
title[:23],
|
272 |
+
duration,
|
273 |
+
user,
|
274 |
+
),
|
275 |
+
reply_markup=InlineKeyboardMarkup(button),
|
276 |
+
)
|
277 |
+
db[chat_id][0]["mystic"] = run
|
278 |
+
db[chat_id][0]["markup"] = "stream"
|
279 |
+
await CallbackQuery.edit_message_text(txt, reply_markup=close_markup(_))
|
280 |
+
await mystic.delete()
|
281 |
+
elif "index_" in queued:
|
282 |
+
try:
|
283 |
+
await Drag.skip_stream(chat_id, videoid, video=status)
|
284 |
+
except:
|
285 |
+
return await CallbackQuery.message.reply_text(_["call_6"])
|
286 |
+
button = stream_markup(_, chat_id)
|
287 |
+
run = await CallbackQuery.message.reply_photo(
|
288 |
+
photo=STREAM_IMG_URL,
|
289 |
+
caption=_["stream_2"].format(user),
|
290 |
+
reply_markup=InlineKeyboardMarkup(button),
|
291 |
+
)
|
292 |
+
db[chat_id][0]["mystic"] = run
|
293 |
+
db[chat_id][0]["markup"] = "tg"
|
294 |
+
await CallbackQuery.edit_message_text(txt, reply_markup=close_markup(_))
|
295 |
+
else:
|
296 |
+
if videoid == "telegram":
|
297 |
+
image = None
|
298 |
+
elif videoid == "soundcloud":
|
299 |
+
image = None
|
300 |
+
else:
|
301 |
+
try:
|
302 |
+
image = await YouTube.thumbnail(videoid, True)
|
303 |
+
except:
|
304 |
+
image = None
|
305 |
+
try:
|
306 |
+
await Drag.skip_stream(chat_id, queued, video=status, image=image)
|
307 |
+
except:
|
308 |
+
return await CallbackQuery.message.reply_text(_["call_6"])
|
309 |
+
if videoid == "telegram":
|
310 |
+
button = stream_markup(_, chat_id)
|
311 |
+
run = await CallbackQuery.message.reply_photo(
|
312 |
+
photo=TELEGRAM_AUDIO_URL
|
313 |
+
if str(streamtype) == "audio"
|
314 |
+
else TELEGRAM_VIDEO_URL,
|
315 |
+
caption=_["stream_1"].format(
|
316 |
+
SUPPORT_CHAT, title[:23], duration, user
|
317 |
+
),
|
318 |
+
reply_markup=InlineKeyboardMarkup(button),
|
319 |
+
)
|
320 |
+
db[chat_id][0]["mystic"] = run
|
321 |
+
db[chat_id][0]["markup"] = "tg"
|
322 |
+
elif videoid == "soundcloud":
|
323 |
+
button = stream_markup(_, chat_id)
|
324 |
+
run = await CallbackQuery.message.reply_photo(
|
325 |
+
photo=SOUNCLOUD_IMG_URL
|
326 |
+
if str(streamtype) == "audio"
|
327 |
+
else TELEGRAM_VIDEO_URL,
|
328 |
+
caption=_["stream_1"].format(
|
329 |
+
SUPPORT_CHAT, title[:23], duration, user
|
330 |
+
),
|
331 |
+
reply_markup=InlineKeyboardMarkup(button),
|
332 |
+
)
|
333 |
+
db[chat_id][0]["mystic"] = run
|
334 |
+
db[chat_id][0]["markup"] = "tg"
|
335 |
+
else:
|
336 |
+
button = stream_markup(_, chat_id)
|
337 |
+
img = await get_thumb(videoid)
|
338 |
+
run = await CallbackQuery.message.reply_photo(
|
339 |
+
photo=img,
|
340 |
+
caption=_["stream_1"].format(
|
341 |
+
f"https://t.me/{app.username}?start=info_{videoid}",
|
342 |
+
title[:23],
|
343 |
+
duration,
|
344 |
+
user,
|
345 |
+
),
|
346 |
+
reply_markup=InlineKeyboardMarkup(button),
|
347 |
+
)
|
348 |
+
db[chat_id][0]["mystic"] = run
|
349 |
+
db[chat_id][0]["markup"] = "stream"
|
350 |
+
await CallbackQuery.edit_message_text(txt, reply_markup=close_markup(_))
|
351 |
+
|
352 |
+
|
353 |
+
async def markup_timer():
|
354 |
+
while not await asyncio.sleep(7):
|
355 |
+
active_chats = await get_active_chats()
|
356 |
+
for chat_id in active_chats:
|
357 |
+
try:
|
358 |
+
if not await is_music_playing(chat_id):
|
359 |
+
continue
|
360 |
+
playing = db.get(chat_id)
|
361 |
+
if not playing:
|
362 |
+
continue
|
363 |
+
duration_seconds = int(playing[0]["seconds"])
|
364 |
+
if duration_seconds == 0:
|
365 |
+
continue
|
366 |
+
try:
|
367 |
+
mystic = playing[0]["mystic"]
|
368 |
+
except:
|
369 |
+
continue
|
370 |
+
try:
|
371 |
+
check = checker[chat_id][mystic.id]
|
372 |
+
if check is False:
|
373 |
+
continue
|
374 |
+
except:
|
375 |
+
pass
|
376 |
+
try:
|
377 |
+
language = await get_lang(chat_id)
|
378 |
+
_ = get_string(language)
|
379 |
+
except:
|
380 |
+
_ = get_string("en")
|
381 |
+
try:
|
382 |
+
buttons = stream_markup_timer(
|
383 |
+
_,
|
384 |
+
chat_id,
|
385 |
+
seconds_to_min(playing[0]["played"]),
|
386 |
+
playing[0]["dur"],
|
387 |
+
)
|
388 |
+
await mystic.edit_reply_markup(
|
389 |
+
reply_markup=InlineKeyboardMarkup(buttons)
|
390 |
+
)
|
391 |
+
except:
|
392 |
+
continue
|
393 |
+
except:
|
394 |
+
continue
|
395 |
+
|
396 |
+
|
397 |
+
asyncio.create_task(markup_timer())
|
DragMusic/plugins/admins/loop.py
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from pyrogram import filters
|
2 |
+
from pyrogram.types import Message
|
3 |
+
|
4 |
+
from DragMusic import app
|
5 |
+
from DragMusic.utils.database import get_loop, set_loop
|
6 |
+
from DragMusic.utils.decorators import AdminRightsCheck
|
7 |
+
from DragMusic.utils.inline import close_markup
|
8 |
+
from config import BANNED_USERS
|
9 |
+
|
10 |
+
|
11 |
+
@app.on_message(filters.command(["loop", "cloop"]) & filters.group & ~BANNED_USERS)
|
12 |
+
@AdminRightsCheck
|
13 |
+
async def admins(cli, message: Message, _, chat_id):
|
14 |
+
usage = _["admin_17"]
|
15 |
+
if len(message.command) != 2:
|
16 |
+
return await message.reply_text(usage)
|
17 |
+
state = message.text.split(None, 1)[1].strip()
|
18 |
+
if state.isnumeric():
|
19 |
+
state = int(state)
|
20 |
+
if 1 <= state <= 10:
|
21 |
+
got = await get_loop(chat_id)
|
22 |
+
if got != 0:
|
23 |
+
state = got + state
|
24 |
+
if int(state) > 10:
|
25 |
+
state = 10
|
26 |
+
await set_loop(chat_id, state)
|
27 |
+
return await message.reply_text(
|
28 |
+
text=_["admin_18"].format(state, message.from_user.mention),
|
29 |
+
reply_markup=close_markup(_),
|
30 |
+
)
|
31 |
+
else:
|
32 |
+
return await message.reply_text(_["admin_17"])
|
33 |
+
elif state.lower() == "enable":
|
34 |
+
await set_loop(chat_id, 10)
|
35 |
+
return await message.reply_text(
|
36 |
+
text=_["admin_18"].format(state, message.from_user.mention),
|
37 |
+
reply_markup=close_markup(_),
|
38 |
+
)
|
39 |
+
elif state.lower() == "disable":
|
40 |
+
await set_loop(chat_id, 0)
|
41 |
+
return await message.reply_text(
|
42 |
+
_["admin_19"].format(message.from_user.mention),
|
43 |
+
reply_markup=close_markup(_),
|
44 |
+
)
|
45 |
+
else:
|
46 |
+
return await message.reply_text(usage)
|
DragMusic/plugins/admins/pause.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from pyrogram import filters
|
2 |
+
from pyrogram.types import Message
|
3 |
+
|
4 |
+
from DragMusic import app
|
5 |
+
from DragMusic.core.call import Drag
|
6 |
+
from DragMusic.utils.database import is_music_playing, music_off
|
7 |
+
from DragMusic.utils.decorators import AdminRightsCheck
|
8 |
+
from DragMusic.utils.inline import close_markup
|
9 |
+
from config import BANNED_USERS
|
10 |
+
|
11 |
+
|
12 |
+
@app.on_message(filters.command(["pause", "cpause"]) & filters.group & ~BANNED_USERS)
|
13 |
+
@AdminRightsCheck
|
14 |
+
async def pause_admin(cli, message: Message, _, chat_id):
|
15 |
+
if not await is_music_playing(chat_id):
|
16 |
+
return await message.reply_text(_["admin_1"])
|
17 |
+
await music_off(chat_id)
|
18 |
+
await Drag.pause_stream(chat_id)
|
19 |
+
await message.reply_text(
|
20 |
+
_["admin_2"].format(message.from_user.mention), reply_markup=close_markup(_)
|
21 |
+
)
|
DragMusic/plugins/admins/resume.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from pyrogram import filters
|
2 |
+
from pyrogram.types import Message
|
3 |
+
|
4 |
+
from DragMusic import app
|
5 |
+
from DragMusic.core.call import Drag
|
6 |
+
from DragMusic.utils.database import is_music_playing, music_on
|
7 |
+
from DragMusic.utils.decorators import AdminRightsCheck
|
8 |
+
from DragMusic.utils.inline import close_markup
|
9 |
+
from config import BANNED_USERS
|
10 |
+
|
11 |
+
|
12 |
+
@app.on_message(filters.command(["resume", "cresume"]) & filters.group & ~BANNED_USERS)
|
13 |
+
@AdminRightsCheck
|
14 |
+
async def resume_com(cli, message: Message, _, chat_id):
|
15 |
+
if await is_music_playing(chat_id):
|
16 |
+
return await message.reply_text(_["admin_3"])
|
17 |
+
await music_on(chat_id)
|
18 |
+
await Drag.resume_stream(chat_id)
|
19 |
+
await message.reply_text(
|
20 |
+
_["admin_4"].format(message.from_user.mention), reply_markup=close_markup(_)
|
21 |
+
)
|
DragMusic/plugins/admins/seek.py
ADDED
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from pyrogram import filters
|
2 |
+
from pyrogram.types import Message
|
3 |
+
|
4 |
+
from DragMusic import YouTube, app
|
5 |
+
from DragMusic.core.call import Drag
|
6 |
+
from DragMusic.misc import db
|
7 |
+
from DragMusic.utils import AdminRightsCheck, seconds_to_min
|
8 |
+
from DragMusic.utils.inline import close_markup
|
9 |
+
from config import BANNED_USERS
|
10 |
+
|
11 |
+
|
12 |
+
@app.on_message(
|
13 |
+
filters.command(["seek", "cseek", "seekback", "cseekback"])
|
14 |
+
& filters.group
|
15 |
+
& ~BANNED_USERS
|
16 |
+
)
|
17 |
+
@AdminRightsCheck
|
18 |
+
async def seek_comm(cli, message: Message, _, chat_id):
|
19 |
+
if len(message.command) == 1:
|
20 |
+
return await message.reply_text(_["admin_20"])
|
21 |
+
query = message.text.split(None, 1)[1].strip()
|
22 |
+
if not query.isnumeric():
|
23 |
+
return await message.reply_text(_["admin_21"])
|
24 |
+
playing = db.get(chat_id)
|
25 |
+
if not playing:
|
26 |
+
return await message.reply_text(_["queue_2"])
|
27 |
+
duration_seconds = int(playing[0]["seconds"])
|
28 |
+
if duration_seconds == 0:
|
29 |
+
return await message.reply_text(_["admin_22"])
|
30 |
+
file_path = playing[0]["file"]
|
31 |
+
duration_played = int(playing[0]["played"])
|
32 |
+
duration_to_skip = int(query)
|
33 |
+
duration = playing[0]["dur"]
|
34 |
+
if message.command[0][-2] == "c":
|
35 |
+
if (duration_played - duration_to_skip) <= 10:
|
36 |
+
return await message.reply_text(
|
37 |
+
text=_["admin_23"].format(seconds_to_min(duration_played), duration),
|
38 |
+
reply_markup=close_markup(_),
|
39 |
+
)
|
40 |
+
to_seek = duration_played - duration_to_skip + 1
|
41 |
+
else:
|
42 |
+
if (duration_seconds - (duration_played + duration_to_skip)) <= 10:
|
43 |
+
return await message.reply_text(
|
44 |
+
text=_["admin_23"].format(seconds_to_min(duration_played), duration),
|
45 |
+
reply_markup=close_markup(_),
|
46 |
+
)
|
47 |
+
to_seek = duration_played + duration_to_skip + 1
|
48 |
+
mystic = await message.reply_text(_["admin_24"])
|
49 |
+
if "vid_" in file_path:
|
50 |
+
n, file_path = await YouTube.video(playing[0]["vidid"], True)
|
51 |
+
if n == 0:
|
52 |
+
return await message.reply_text(_["admin_22"])
|
53 |
+
check = (playing[0]).get("speed_path")
|
54 |
+
if check:
|
55 |
+
file_path = check
|
56 |
+
if "index_" in file_path:
|
57 |
+
file_path = playing[0]["vidid"]
|
58 |
+
try:
|
59 |
+
await Drag.seek_stream(
|
60 |
+
chat_id,
|
61 |
+
file_path,
|
62 |
+
seconds_to_min(to_seek),
|
63 |
+
duration,
|
64 |
+
playing[0]["streamtype"],
|
65 |
+
)
|
66 |
+
except:
|
67 |
+
return await mystic.edit_text(_["admin_26"], reply_markup=close_markup(_))
|
68 |
+
if message.command[0][-2] == "c":
|
69 |
+
db[chat_id][0]["played"] -= duration_to_skip
|
70 |
+
else:
|
71 |
+
db[chat_id][0]["played"] += duration_to_skip
|
72 |
+
await mystic.edit_text(
|
73 |
+
text=_["admin_25"].format(seconds_to_min(to_seek), message.from_user.mention),
|
74 |
+
reply_markup=close_markup(_),
|
75 |
+
)
|
DragMusic/plugins/admins/shuffle.py
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import random
|
2 |
+
|
3 |
+
from pyrogram import filters
|
4 |
+
from pyrogram.types import Message
|
5 |
+
|
6 |
+
from DragMusic import app
|
7 |
+
from DragMusic.misc import db
|
8 |
+
from DragMusic.utils.decorators import AdminRightsCheck
|
9 |
+
from DragMusic.utils.inline import close_markup
|
10 |
+
from config import BANNED_USERS
|
11 |
+
|
12 |
+
|
13 |
+
@app.on_message(
|
14 |
+
filters.command(["shuffle", "cshuffle"]) & filters.group & ~BANNED_USERS
|
15 |
+
)
|
16 |
+
@AdminRightsCheck
|
17 |
+
async def admins(Client, message: Message, _, chat_id):
|
18 |
+
check = db.get(chat_id)
|
19 |
+
if not check:
|
20 |
+
return await message.reply_text(_["queue_2"])
|
21 |
+
try:
|
22 |
+
popped = check.pop(0)
|
23 |
+
except:
|
24 |
+
return await message.reply_text(_["admin_15"], reply_markup=close_markup(_))
|
25 |
+
check = db.get(chat_id)
|
26 |
+
if not check:
|
27 |
+
check.insert(0, popped)
|
28 |
+
return await message.reply_text(_["admin_15"], reply_markup=close_markup(_))
|
29 |
+
random.shuffle(check)
|
30 |
+
check.insert(0, popped)
|
31 |
+
await message.reply_text(
|
32 |
+
_["admin_16"].format(message.from_user.mention), reply_markup=close_markup(_)
|
33 |
+
)
|
DragMusic/plugins/admins/skip.py
ADDED
@@ -0,0 +1,232 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from pyrogram import filters
|
2 |
+
from pyrogram.types import InlineKeyboardMarkup, Message
|
3 |
+
|
4 |
+
import config
|
5 |
+
from DragMusic import YouTube, app
|
6 |
+
from DragMusic.core.call import Drag
|
7 |
+
from DragMusic.misc import db
|
8 |
+
from DragMusic.utils.database import get_loop
|
9 |
+
from DragMusic.utils.decorators import AdminRightsCheck
|
10 |
+
from DragMusic.utils.inline import close_markup, stream_markup
|
11 |
+
from DragMusic.utils.stream.autoclear import auto_clean
|
12 |
+
from DragMusic.utils.thumbnails import get_thumb
|
13 |
+
from config import BANNED_USERS
|
14 |
+
|
15 |
+
|
16 |
+
@app.on_message(
|
17 |
+
filters.command(["skip", "cskip", "next", "cnext"]) & filters.group & ~BANNED_USERS
|
18 |
+
)
|
19 |
+
@AdminRightsCheck
|
20 |
+
async def skip(cli, message: Message, _, chat_id):
|
21 |
+
if not len(message.command) < 2:
|
22 |
+
loop = await get_loop(chat_id)
|
23 |
+
if loop != 0:
|
24 |
+
return await message.reply_text(_["admin_8"])
|
25 |
+
state = message.text.split(None, 1)[1].strip()
|
26 |
+
if state.isnumeric():
|
27 |
+
state = int(state)
|
28 |
+
check = db.get(chat_id)
|
29 |
+
if check:
|
30 |
+
count = len(check)
|
31 |
+
if count > 2:
|
32 |
+
count = int(count - 1)
|
33 |
+
if 1 <= state <= count:
|
34 |
+
for x in range(state):
|
35 |
+
popped = None
|
36 |
+
try:
|
37 |
+
popped = check.pop(0)
|
38 |
+
except:
|
39 |
+
return await message.reply_text(_["admin_12"])
|
40 |
+
if popped:
|
41 |
+
await auto_clean(popped)
|
42 |
+
if not check:
|
43 |
+
try:
|
44 |
+
await message.reply_text(
|
45 |
+
text=_["admin_6"].format(
|
46 |
+
message.from_user.mention,
|
47 |
+
message.chat.title,
|
48 |
+
),
|
49 |
+
reply_markup=close_markup(_),
|
50 |
+
)
|
51 |
+
await Drag.stop_stream(chat_id)
|
52 |
+
except:
|
53 |
+
return
|
54 |
+
break
|
55 |
+
else:
|
56 |
+
return await message.reply_text(_["admin_11"].format(count))
|
57 |
+
else:
|
58 |
+
return await message.reply_text(_["admin_10"])
|
59 |
+
else:
|
60 |
+
return await message.reply_text(_["queue_2"])
|
61 |
+
else:
|
62 |
+
return await message.reply_text(_["admin_9"])
|
63 |
+
else:
|
64 |
+
check = db.get(chat_id)
|
65 |
+
popped = None
|
66 |
+
try:
|
67 |
+
popped = check.pop(0)
|
68 |
+
if popped:
|
69 |
+
await auto_clean(popped)
|
70 |
+
if not check:
|
71 |
+
await message.reply_text(
|
72 |
+
text=_["admin_6"].format(
|
73 |
+
message.from_user.mention, message.chat.title
|
74 |
+
),
|
75 |
+
reply_markup=close_markup(_),
|
76 |
+
)
|
77 |
+
try:
|
78 |
+
return await Drag.stop_stream(chat_id)
|
79 |
+
except:
|
80 |
+
return
|
81 |
+
except:
|
82 |
+
try:
|
83 |
+
await message.reply_text(
|
84 |
+
text=_["admin_6"].format(
|
85 |
+
message.from_user.mention, message.chat.title
|
86 |
+
),
|
87 |
+
reply_markup=close_markup(_),
|
88 |
+
)
|
89 |
+
return await Drag.stop_stream(chat_id)
|
90 |
+
except:
|
91 |
+
return
|
92 |
+
queued = check[0]["file"]
|
93 |
+
title = (check[0]["title"]).title()
|
94 |
+
user = check[0]["by"]
|
95 |
+
streamtype = check[0]["streamtype"]
|
96 |
+
videoid = check[0]["vidid"]
|
97 |
+
status = True if str(streamtype) == "video" else None
|
98 |
+
db[chat_id][0]["played"] = 0
|
99 |
+
exis = (check[0]).get("old_dur")
|
100 |
+
if exis:
|
101 |
+
db[chat_id][0]["dur"] = exis
|
102 |
+
db[chat_id][0]["seconds"] = check[0]["old_second"]
|
103 |
+
db[chat_id][0]["speed_path"] = None
|
104 |
+
db[chat_id][0]["speed"] = 1.0
|
105 |
+
if "live_" in queued:
|
106 |
+
n, link = await YouTube.video(videoid, True)
|
107 |
+
if n == 0:
|
108 |
+
return await message.reply_text(_["admin_7"].format(title))
|
109 |
+
try:
|
110 |
+
image = await YouTube.thumbnail(videoid, True)
|
111 |
+
except:
|
112 |
+
image = None
|
113 |
+
try:
|
114 |
+
await Drag.skip_stream(chat_id, link, video=status, image=image)
|
115 |
+
except:
|
116 |
+
return await message.reply_text(_["call_6"])
|
117 |
+
button = stream_markup(_, chat_id)
|
118 |
+
img = await get_thumb(videoid)
|
119 |
+
run = await message.reply_photo(
|
120 |
+
photo=img,
|
121 |
+
caption=_["stream_1"].format(
|
122 |
+
f"https://t.me/{app.username}?start=info_{videoid}",
|
123 |
+
title[:23],
|
124 |
+
check[0]["dur"],
|
125 |
+
user,
|
126 |
+
),
|
127 |
+
reply_markup=InlineKeyboardMarkup(button),
|
128 |
+
)
|
129 |
+
db[chat_id][0]["mystic"] = run
|
130 |
+
db[chat_id][0]["markup"] = "tg"
|
131 |
+
elif "vid_" in queued:
|
132 |
+
mystic = await message.reply_text(_["call_7"], disable_web_page_preview=True)
|
133 |
+
try:
|
134 |
+
file_path, direct = await YouTube.download(
|
135 |
+
videoid,
|
136 |
+
mystic,
|
137 |
+
videoid=True,
|
138 |
+
video=status,
|
139 |
+
)
|
140 |
+
except:
|
141 |
+
return await mystic.edit_text(_["call_6"])
|
142 |
+
try:
|
143 |
+
image = await YouTube.thumbnail(videoid, True)
|
144 |
+
except:
|
145 |
+
image = None
|
146 |
+
try:
|
147 |
+
await Drag.skip_stream(chat_id, file_path, video=status, image=image)
|
148 |
+
except:
|
149 |
+
return await mystic.edit_text(_["call_6"])
|
150 |
+
button = stream_markup(_, chat_id)
|
151 |
+
img = await get_thumb(videoid)
|
152 |
+
run = await message.reply_photo(
|
153 |
+
photo=img,
|
154 |
+
caption=_["stream_1"].format(
|
155 |
+
f"https://t.me/{app.username}?start=info_{videoid}",
|
156 |
+
title[:23],
|
157 |
+
check[0]["dur"],
|
158 |
+
user,
|
159 |
+
),
|
160 |
+
reply_markup=InlineKeyboardMarkup(button),
|
161 |
+
)
|
162 |
+
db[chat_id][0]["mystic"] = run
|
163 |
+
db[chat_id][0]["markup"] = "stream"
|
164 |
+
await mystic.delete()
|
165 |
+
elif "index_" in queued:
|
166 |
+
try:
|
167 |
+
await Drag.skip_stream(chat_id, videoid, video=status)
|
168 |
+
except:
|
169 |
+
return await message.reply_text(_["call_6"])
|
170 |
+
button = stream_markup(_, chat_id)
|
171 |
+
run = await message.reply_photo(
|
172 |
+
photo=config.STREAM_IMG_URL,
|
173 |
+
caption=_["stream_2"].format(user),
|
174 |
+
reply_markup=InlineKeyboardMarkup(button),
|
175 |
+
)
|
176 |
+
db[chat_id][0]["mystic"] = run
|
177 |
+
db[chat_id][0]["markup"] = "tg"
|
178 |
+
else:
|
179 |
+
if videoid == "telegram":
|
180 |
+
image = None
|
181 |
+
elif videoid == "soundcloud":
|
182 |
+
image = None
|
183 |
+
else:
|
184 |
+
try:
|
185 |
+
image = await YouTube.thumbnail(videoid, True)
|
186 |
+
except:
|
187 |
+
image = None
|
188 |
+
try:
|
189 |
+
await Drag.skip_stream(chat_id, queued, video=status, image=image)
|
190 |
+
except:
|
191 |
+
return await message.reply_text(_["call_6"])
|
192 |
+
if videoid == "telegram":
|
193 |
+
button = stream_markup(_, chat_id)
|
194 |
+
run = await message.reply_photo(
|
195 |
+
photo=config.TELEGRAM_AUDIO_URL
|
196 |
+
if str(streamtype) == "audio"
|
197 |
+
else config.TELEGRAM_VIDEO_URL,
|
198 |
+
caption=_["stream_1"].format(
|
199 |
+
config.SUPPORT_CHAT, title[:23], check[0]["dur"], user
|
200 |
+
),
|
201 |
+
reply_markup=InlineKeyboardMarkup(button),
|
202 |
+
)
|
203 |
+
db[chat_id][0]["mystic"] = run
|
204 |
+
db[chat_id][0]["markup"] = "tg"
|
205 |
+
elif videoid == "soundcloud":
|
206 |
+
button = stream_markup(_, chat_id)
|
207 |
+
run = await message.reply_photo(
|
208 |
+
photo=config.SOUNCLOUD_IMG_URL
|
209 |
+
if str(streamtype) == "audio"
|
210 |
+
else config.TELEGRAM_VIDEO_URL,
|
211 |
+
caption=_["stream_1"].format(
|
212 |
+
config.SUPPORT_CHAT, title[:23], check[0]["dur"], user
|
213 |
+
),
|
214 |
+
reply_markup=InlineKeyboardMarkup(button),
|
215 |
+
)
|
216 |
+
db[chat_id][0]["mystic"] = run
|
217 |
+
db[chat_id][0]["markup"] = "tg"
|
218 |
+
else:
|
219 |
+
button = stream_markup(_, chat_id)
|
220 |
+
img = await get_thumb(videoid)
|
221 |
+
run = await message.reply_photo(
|
222 |
+
photo=img,
|
223 |
+
caption=_["stream_1"].format(
|
224 |
+
f"https://t.me/{app.username}?start=info_{videoid}",
|
225 |
+
title[:23],
|
226 |
+
check[0]["dur"],
|
227 |
+
user,
|
228 |
+
),
|
229 |
+
reply_markup=InlineKeyboardMarkup(button),
|
230 |
+
)
|
231 |
+
db[chat_id][0]["mystic"] = run
|
232 |
+
db[chat_id][0]["markup"] = "stream"
|
DragMusic/plugins/admins/speed.py
ADDED
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from pyrogram import filters
|
2 |
+
from pyrogram.types import Message
|
3 |
+
|
4 |
+
from DragMusic import app
|
5 |
+
from DragMusic.core.call import Drag
|
6 |
+
from DragMusic.misc import SUDOERS, db
|
7 |
+
from DragMusic.utils import AdminRightsCheck
|
8 |
+
from DragMusic.utils.database import is_active_chat, is_nonadmin_chat
|
9 |
+
from DragMusic.utils.decorators.language import languageCB
|
10 |
+
from DragMusic.utils.inline import close_markup, speed_markup
|
11 |
+
from config import BANNED_USERS, adminlist
|
12 |
+
|
13 |
+
checker = []
|
14 |
+
|
15 |
+
|
16 |
+
@app.on_message(
|
17 |
+
filters.command(["cspeed", "speed", "cslow", "slow", "playback", "cplayback"])
|
18 |
+
& filters.group
|
19 |
+
& ~BANNED_USERS
|
20 |
+
)
|
21 |
+
@AdminRightsCheck
|
22 |
+
async def playback(cli, message: Message, _, chat_id):
|
23 |
+
playing = db.get(chat_id)
|
24 |
+
if not playing:
|
25 |
+
return await message.reply_text(_["queue_2"])
|
26 |
+
duration_seconds = int(playing[0]["seconds"])
|
27 |
+
if duration_seconds == 0:
|
28 |
+
return await message.reply_text(_["admin_27"])
|
29 |
+
file_path = playing[0]["file"]
|
30 |
+
if "downloads" not in file_path:
|
31 |
+
return await message.reply_text(_["admin_27"])
|
32 |
+
upl = speed_markup(_, chat_id)
|
33 |
+
return await message.reply_text(
|
34 |
+
text=_["admin_28"].format(app.mention),
|
35 |
+
reply_markup=upl,
|
36 |
+
)
|
37 |
+
|
38 |
+
|
39 |
+
@app.on_callback_query(filters.regex("SpeedUP") & ~BANNED_USERS)
|
40 |
+
@languageCB
|
41 |
+
async def del_back_playlist(client, CallbackQuery, _):
|
42 |
+
callback_data = CallbackQuery.data.strip()
|
43 |
+
callback_request = callback_data.split(None, 1)[1]
|
44 |
+
chat, speed = callback_request.split("|")
|
45 |
+
chat_id = int(chat)
|
46 |
+
if not await is_active_chat(chat_id):
|
47 |
+
return await CallbackQuery.answer(_["general_5"], show_alert=True)
|
48 |
+
is_non_admin = await is_nonadmin_chat(CallbackQuery.message.chat.id)
|
49 |
+
if not is_non_admin:
|
50 |
+
if CallbackQuery.from_user.id not in SUDOERS:
|
51 |
+
admins = adminlist.get(CallbackQuery.message.chat.id)
|
52 |
+
if not admins:
|
53 |
+
return await CallbackQuery.answer(_["admin_13"], show_alert=True)
|
54 |
+
else:
|
55 |
+
if CallbackQuery.from_user.id not in admins:
|
56 |
+
return await CallbackQuery.answer(_["admin_14"], show_alert=True)
|
57 |
+
playing = db.get(chat_id)
|
58 |
+
if not playing:
|
59 |
+
return await CallbackQuery.answer(_["queue_2"], show_alert=True)
|
60 |
+
duration_seconds = int(playing[0]["seconds"])
|
61 |
+
if duration_seconds == 0:
|
62 |
+
return await CallbackQuery.answer(_["admin_27"], show_alert=True)
|
63 |
+
file_path = playing[0]["file"]
|
64 |
+
if "downloads" not in file_path:
|
65 |
+
return await CallbackQuery.answer(_["admin_27"], show_alert=True)
|
66 |
+
checkspeed = (playing[0]).get("speed")
|
67 |
+
if checkspeed:
|
68 |
+
if str(checkspeed) == str(speed):
|
69 |
+
if str(speed) == str("1.0"):
|
70 |
+
return await CallbackQuery.answer(
|
71 |
+
_["admin_29"],
|
72 |
+
show_alert=True,
|
73 |
+
)
|
74 |
+
else:
|
75 |
+
if str(speed) == str("1.0"):
|
76 |
+
return await CallbackQuery.answer(
|
77 |
+
_["admin_29"],
|
78 |
+
show_alert=True,
|
79 |
+
)
|
80 |
+
if chat_id in checker:
|
81 |
+
return await CallbackQuery.answer(
|
82 |
+
_["admin_30"],
|
83 |
+
show_alert=True,
|
84 |
+
)
|
85 |
+
else:
|
86 |
+
checker.append(chat_id)
|
87 |
+
try:
|
88 |
+
await CallbackQuery.answer(
|
89 |
+
_["admin_31"],
|
90 |
+
)
|
91 |
+
except:
|
92 |
+
pass
|
93 |
+
mystic = await CallbackQuery.edit_message_text(
|
94 |
+
text=_["admin_32"].format(CallbackQuery.from_user.mention),
|
95 |
+
)
|
96 |
+
try:
|
97 |
+
await Drag.speedup_stream(
|
98 |
+
chat_id,
|
99 |
+
file_path,
|
100 |
+
speed,
|
101 |
+
playing,
|
102 |
+
)
|
103 |
+
except:
|
104 |
+
if chat_id in checker:
|
105 |
+
checker.remove(chat_id)
|
106 |
+
return await mystic.edit_text(_["admin_33"], reply_markup=close_markup(_))
|
107 |
+
if chat_id in checker:
|
108 |
+
checker.remove(chat_id)
|
109 |
+
await mystic.edit_text(
|
110 |
+
text=_["admin_34"].format(speed, CallbackQuery.from_user.mention),
|
111 |
+
reply_markup=close_markup(_),
|
112 |
+
)
|
DragMusic/plugins/admins/stop.py
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from pyrogram import filters
|
2 |
+
from pyrogram.types import Message
|
3 |
+
|
4 |
+
from DragMusic import app
|
5 |
+
from DragMusic.core.call import Drag
|
6 |
+
from DragMusic.utils.database import set_loop
|
7 |
+
from DragMusic.utils.decorators import AdminRightsCheck
|
8 |
+
from DragMusic.utils.inline import close_markup
|
9 |
+
from config import BANNED_USERS
|
10 |
+
|
11 |
+
|
12 |
+
@app.on_message(
|
13 |
+
filters.command(["end", "stop", "cend", "cstop"]) & filters.group & ~BANNED_USERS
|
14 |
+
)
|
15 |
+
@AdminRightsCheck
|
16 |
+
async def stop_music(cli, message: Message, _, chat_id):
|
17 |
+
if not len(message.command) == 1:
|
18 |
+
return
|
19 |
+
await Drag.stop_stream(chat_id)
|
20 |
+
await set_loop(chat_id, 0)
|
21 |
+
await message.reply_text(
|
22 |
+
_["admin_5"].format(message.from_user.mention), reply_markup=close_markup(_)
|
23 |
+
)
|
DragMusic/plugins/admins/tagall.py
ADDED
@@ -0,0 +1,290 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from DragMusic import app
|
2 |
+
import asyncio
|
3 |
+
import random
|
4 |
+
from pyrogram import Client, filters
|
5 |
+
from pyrogram.enums import ChatType, ChatMemberStatus
|
6 |
+
from pyrogram.errors import UserNotParticipant
|
7 |
+
from pyrogram.types import ChatPermissions
|
8 |
+
|
9 |
+
spam_chats = []
|
10 |
+
|
11 |
+
EMOJI = [ "🦋🦋🦋🦋🦋",
|
12 |
+
"🧚🌸🧋🍬🫖",
|
13 |
+
"🥀🌷🌹🌺💐",
|
14 |
+
"🌸🌿💮🌱🌵",
|
15 |
+
"❤️💚💙💜🖤",
|
16 |
+
"💓💕💞💗💖",
|
17 |
+
"🌸💐🌺🌹🦋",
|
18 |
+
"🍔🦪🍛🍲🥗",
|
19 |
+
"🍎🍓🍒🍑🌶️",
|
20 |
+
"🧋🥤🧋🥛🍷",
|
21 |
+
"🍬🍭🧁🎂🍡",
|
22 |
+
"🍨🧉🍺☕🍻",
|
23 |
+
"🥪🥧🍦🍥🍚",
|
24 |
+
"🫖☕🍹🍷🥛",
|
25 |
+
"☕🧃🍩🍦🍙",
|
26 |
+
"🍁🌾💮🍂🌿",
|
27 |
+
"🌨️🌥️⛈️🌩️🌧️",
|
28 |
+
"🌷🏵️🌸🌺💐",
|
29 |
+
"💮🌼🌻🍀🍁",
|
30 |
+
"🧟🦸🦹🧙👸",
|
31 |
+
"🧅🍠🥕🌽🥦",
|
32 |
+
"🐷🐹🐭🐨🐻❄️",
|
33 |
+
"🦋🐇🐀🐈🐈⬛",
|
34 |
+
"🌼🌳🌲🌴🌵",
|
35 |
+
"🥩🍋🍐🍈🍇",
|
36 |
+
"🍴🍽️🔪🍶🥃",
|
37 |
+
"🕌🏰🏩⛩️🏩",
|
38 |
+
"🎉🎊🎈🎂🎀",
|
39 |
+
"🪴🌵🌴🌳🌲",
|
40 |
+
"🎄🎋🎍🎑🎎",
|
41 |
+
"🦅🦜🕊️🦤🦢",
|
42 |
+
"🦤🦩🦚🦃🦆",
|
43 |
+
"🐬🦭🦈🐋🐳",
|
44 |
+
"🐔🐟🐠🐡🦐",
|
45 |
+
"🦩🦀🦑🐙🦪",
|
46 |
+
"🐦🦂🕷️🕸️🐚",
|
47 |
+
"🥪🍰🥧🍨🍨",
|
48 |
+
" 🥬🍉🧁🧇",
|
49 |
+
]
|
50 |
+
|
51 |
+
TAGMES = [ " **➠ ʜᴇʏ ʙᴀʙʏ ᴋᴀʜᴀ ʜᴏ 🤗** ",
|
52 |
+
" **➠ ᴏʏᴇ sᴏ ɢʏᴇ ᴋʏᴀ ᴏɴʟɪɴᴇ ᴀᴀᴏ 😊** ",
|
53 |
+
" **➠ ᴠᴄ ᴄʜᴀʟᴏ ʙᴀᴛᴇɴ ᴋᴀʀᴛᴇ ʜᴀɪɴ ᴋᴜᴄʜ ᴋᴜᴄʜ 😃** ",
|
54 |
+
" **➠ ᴋʜᴀɴᴀ ᴋʜᴀ ʟɪʏᴇ ᴊɪ..?? 🥲** ",
|
55 |
+
" **➠ ɢʜᴀʀ ᴍᴇ sᴀʙ ᴋᴀɪsᴇ ʜᴀɪɴ ᴊɪ 🥺** ",
|
56 |
+
" **➠ ᴘᴛᴀ ʜᴀɪ ʙᴏʜᴏᴛ ᴍɪss ᴋᴀʀ ʀʜɪ ᴛʜɪ ᴀᴀᴘᴋᴏ 🤭** ",
|
57 |
+
" **➠ ᴏʏᴇ ʜᴀʟ ᴄʜᴀʟ ᴋᴇsᴀ ʜᴀɪ..?? 🤨** ",
|
58 |
+
" **➠ ᴍᴇʀɪ ʙʜɪ sᴇᴛᴛɪɴɢ ᴋᴀʀʙᴀ ᴅᴏɢᴇ..?? 🙂** ",
|
59 |
+
" **➠ ᴀᴀᴘᴋᴀ ɴᴀᴍᴇ ᴋʏᴀ ʜᴀɪ..?? 🥲** ",
|
60 |
+
" **➠ ɴᴀsᴛᴀ ʜᴜᴀ ᴀᴀᴘᴋᴀ..?? 😋** ",
|
61 |
+
" **➠ ᴍᴇʀᴇ ᴋᴏ ᴀᴘɴᴇ ɢʀᴏᴜᴘ ᴍᴇ ᴋɪᴅɴᴀᴘ ᴋʀ ʟᴏ 😍** ",
|
62 |
+
" **➠ ᴀᴀᴘᴋɪ ᴘᴀʀᴛɴᴇʀ ᴀᴀᴘᴋᴏ ᴅʜᴜɴᴅ ʀʜᴇ ʜᴀɪɴ ᴊʟᴅɪ ᴏɴʟɪɴᴇ ᴀʏɪᴀᴇ 😅** ",
|
63 |
+
" **➠ ᴍᴇʀᴇ sᴇ ᴅᴏsᴛɪ ᴋʀᴏɢᴇ..?? 🤔** ",
|
64 |
+
" **➠ sᴏɴᴇ ᴄʜᴀʟ ɢʏᴇ ᴋʏᴀ 🙄** ",
|
65 |
+
" **➠ ᴇᴋ sᴏɴɢ ᴘʟᴀʏ ᴋʀᴏ ɴᴀ ᴘʟss 😕** ",
|
66 |
+
" **➠ ᴀᴀᴘ ᴋᴀʜᴀ sᴇ ʜᴏ..?? 🙃** ",
|
67 |
+
" **➠ ʜᴇʟʟᴏ ᴊɪ ɴᴀᴍᴀsᴛᴇ 😛** ",
|
68 |
+
" **➠ ʜᴇʟʟᴏ ʙᴀʙʏ ᴋᴋʀʜ..? 🤔** ",
|
69 |
+
" **➠ ᴅᴏ ʏᴏᴜ ᴋɴᴏᴡ ᴡʜᴏ ɪs ᴍʏ ᴏᴡɴᴇʀ.? ☺️** ",
|
70 |
+
" **➠ ᴄʜʟᴏ ᴋᴜᴄʜ ɢᴀᴍᴇ ᴋʜᴇʟᴛᴇ ʜᴀɪɴ.🤗** ",
|
71 |
+
" **➠ ᴀᴜʀ ʙᴀᴛᴀᴏ ᴋᴀɪsᴇ ʜᴏ ʙᴀʙʏ 😇** ",
|
72 |
+
" **➠ ᴛᴜᴍʜᴀʀɪ ᴍᴜᴍᴍʏ ᴋʏᴀ ᴋᴀʀ ʀᴀʜɪ ʜᴀɪ 🤭** ",
|
73 |
+
" **➠ ᴍᴇʀᴇ sᴇ ʙᴀᴛ ɴᴏɪ ᴋʀᴏɢᴇ 🥺** ",
|
74 |
+
" **➠ ᴏʏᴇ ᴘᴀɢᴀʟ ᴏɴʟɪɴᴇ ᴀᴀ ᴊᴀ 😶** ",
|
75 |
+
" **➠ ᴀᴀᴊ ʜᴏʟɪᴅᴀʏ ʜᴀɪ ᴋʏᴀ sᴄʜᴏᴏʟ ᴍᴇ..?? 🤔** ",
|
76 |
+
" **➠ ᴏʏᴇ ɢᴏᴏᴅ ᴍᴏʀɴɪɴɢ 😜** ",
|
77 |
+
" **➠ sᴜɴᴏ ᴇᴋ ᴋᴀᴍ ʜᴀɪ ᴛᴜᴍsᴇ 🙂** ",
|
78 |
+
" **➠ ᴋᴏɪ sᴏɴɢ ᴘʟᴀʏ ᴋʀᴏ ɴᴀ 😪** ",
|
79 |
+
" **➠ ɴɪᴄᴇ ᴛᴏ ᴍᴇᴇᴛ ᴜʜ ☺** ",
|
80 |
+
" **➠ ᴍᴇʀᴀ ʙᴀʙᴜ ɴᴇ ᴛʜᴀɴᴀ ᴋʜᴀʏᴀ ᴋʏᴀ..? 🙊** ",
|
81 |
+
" **➠ sᴛᴜᴅʏ ᴄᴏᴍᴘʟᴇᴛᴇ ʜᴜᴀ?? 😺** ",
|
82 |
+
" **➠ ʙᴏʟᴏ ɴᴀ ᴋᴜᴄʜ ʏʀʀ 🥲** ",
|
83 |
+
" **➠ sᴏɴᴀʟɪ ᴋᴏɴ ʜᴀɪ...?? 😅** ",
|
84 |
+
" **➠ ᴛᴜᴍʜᴀʀɪ ᴇᴋ ᴘɪᴄ ᴍɪʟᴇɢɪ..? 😅** ",
|
85 |
+
" **➠ ᴍᴜᴍᴍʏ ᴀᴀ ɢʏɪ ᴋʏᴀ 😆** ",
|
86 |
+
" **➠ ᴏʀ ʙᴀᴛᴀᴏ ʙʜᴀʙʜɪ ᴋᴀɪsɪ ʜᴀɪ 😉** ",
|
87 |
+
" **➠ ɪ ʟᴏᴠᴇ ʏᴏᴜ 💚** ",
|
88 |
+
" **➠ ᴅᴏ ʏᴏᴜ ʟᴏᴠᴇ ᴍᴇ..? 👀** ",
|
89 |
+
" **➠ ʀᴀᴋʜɪ ᴋᴀʙ ʙᴀɴᴅ ʀᴀʜɪ ʜᴏ..?? 🙉** ",
|
90 |
+
" **➠ ᴇᴋ sᴏɴɢ sᴜɴᴀᴜ..? 😹** ",
|
91 |
+
" **➠ ᴏɴʟɪɴᴇ ᴀᴀ ᴊᴀ ʀᴇ sᴏɴɢ sᴜɴᴀ ʀᴀʜɪ ʜᴜ 😻** ",
|
92 |
+
" **➠ ɪɴsᴛᴀɢʀᴀᴍ ᴄʜᴀʟᴀᴛᴇ ʜᴏ..?? 🙃** ",
|
93 |
+
" **➠ ᴡʜᴀᴛsᴀᴘᴘ ɴᴜᴍʙᴇʀ ᴅᴏɢᴇ ᴀᴘɴᴀ ᴛᴜᴍ..? 😕** ",
|
94 |
+
" **➠ ᴛᴜᴍʜᴇ ᴋᴏɴ sᴀ ᴍᴜsɪᴄ sᴜɴɴᴀ ᴘᴀsᴀɴᴅ ʜᴀɪ..? 🙃** ",
|
95 |
+
" **➠ sᴀʀᴀ ᴋᴀᴍ ᴋʜᴀᴛᴀᴍ ʜᴏ ɢʏᴀ ᴀᴀᴘᴋᴀ..? 🙃** ",
|
96 |
+
" **➠ ᴋᴀʜᴀ sᴇ ʜᴏ ᴀᴀᴘ 😊** ",
|
97 |
+
" **➠ sᴜɴᴏ ɴᴀ 🧐** ",
|
98 |
+
" **➠ ᴍᴇʀᴀ ᴇᴋ ᴋᴀᴀᴍ ᴋᴀʀ ᴅᴏɢᴇ..? ♥️** ",
|
99 |
+
" **➠ ʙʏ ᴛᴀᴛᴀ ᴍᴀᴛ ʙᴀᴀᴛ ᴋᴀʀɴᴀ ᴀᴀᴊ ᴋᴇ ʙᴀᴅ 😠** ",
|
100 |
+
" **➠ ᴍᴏᴍ ᴅᴀᴅ ᴋᴀɪsᴇ ʜᴀɪɴ..? ❤** ",
|
101 |
+
" **➠ ᴋʏᴀ ʜᴜᴀ..? 🤔** ",
|
102 |
+
" **➠ ʙᴏʜᴏᴛ ʏᴀᴀᴅ ᴀᴀ ʀʜɪ ʜᴀɪ 😒** ",
|
103 |
+
" **➠ ʙʜᴜʟ ɢʏᴇ ᴍᴜᴊʜᴇ 😏** ",
|
104 |
+
" **➠ ᴊᴜᴛʜ ɴʜɪ ʙᴏʟɴᴀ ᴄʜᴀʜɪʏᴇ 🤐** ",
|
105 |
+
" **➠ ᴋʜᴀ ʟᴏ ʙʜᴀᴡ ᴍᴀᴛ ᴋʀᴏ ʙᴀᴀᴛ 😒** ",
|
106 |
+
" **➠ ᴋʏᴀ ʜᴜᴀ 😮** "
|
107 |
+
" **➠ ʜɪɪ ʜᴏɪ ʜᴇʟʟᴏ 👀** ",
|
108 |
+
" **➠ ᴀᴀᴘᴋᴇ ᴊᴀɪsᴀ ᴅᴏsᴛ ʜᴏ sᴀᴛʜ ᴍᴇ ғɪʀ ɢᴜᴍ ᴋɪs ʙᴀᴀᴛ ᴋᴀ 🙈** ",
|
109 |
+
" **➠ ᴀᴀᴊ ᴍᴇ sᴀᴅ ʜᴏᴏɴ ☹️** ",
|
110 |
+
" **➠ ᴍᴜsᴊʜsᴇ ʙʜɪ ʙᴀᴀᴛ ᴋᴀʀ ʟᴏ ɴᴀ 🥺** ",
|
111 |
+
" **➠ ᴋʏᴀ ᴋᴀʀ ʀᴀʜᴇ ʜᴏ 👀** ",
|
112 |
+
" **➠ ᴋʏᴀ ʜᴀʟ ᴄʜᴀʟ ʜᴀɪ 🙂** ",
|
113 |
+
" **➠ ᴋᴀʜᴀ sᴇ ʜᴏ ᴀᴀᴘ..?🤔** ",
|
114 |
+
" **➠ ᴄʜᴀᴛᴛɪɴɢ ᴋᴀʀ ʟᴏ ɴᴀ..🥺** ",
|
115 |
+
" **➠ ᴍᴇ ᴍᴀsᴏᴏᴍ ʜᴜ ɴᴀ 🥺** ",
|
116 |
+
" **➠ ᴋᴀʟ ᴍᴀᴊᴀ ᴀʏᴀ ᴛʜᴀ ɴᴀ 😅** ",
|
117 |
+
" **➠ ɢʀᴏᴜᴘ ᴍᴇ ʙᴀᴀᴛ ᴋʏᴜ ɴᴀʜɪ ᴋᴀʀᴛᴇ ʜᴏ 😕** ",
|
118 |
+
" **➠ ᴀᴀᴘ ʀᴇʟᴀᴛɪᴏᴍsʜɪᴘ ᴍᴇ ʜᴏ..? 👀** ",
|
119 |
+
" **➠ ᴋɪᴛɴᴀ ᴄʜᴜᴘ ʀᴀʜᴛᴇ ʜᴏ ʏʀʀ 😼** ",
|
120 |
+
" **➠ ᴀᴀᴘᴋᴏ ɢᴀɴᴀ ɢᴀɴᴇ ᴀᴀᴛᴀ ʜᴀɪ..? 😸** ",
|
121 |
+
" **➠ ɢʜᴜᴍɴᴇ ᴄʜᴀʟᴏɢᴇ..?? 🙈** ",
|
122 |
+
" **➠ ᴋʜᴜs ʀᴀʜᴀ ᴋᴀʀᴏ 🤞** ",
|
123 |
+
" **➠ ʜᴀᴍ ᴅᴏsᴛ ʙᴀɴ sᴀᴋᴛᴇ ʜᴀɪ...? 🥰** ",
|
124 |
+
" **➠ ᴋᴜᴄʜ ʙᴏʟ ᴋʏᴜ ɴʜɪ ʀᴀʜᴇ ʜᴏ.. 🥺** ",
|
125 |
+
" **➠ ᴋᴜᴄʜ ᴍᴇᴍʙᴇʀs ᴀᴅᴅ ᴋᴀʀ ᴅᴏ 🥲** ",
|
126 |
+
" **➠ sɪɴɢʟᴇ ʜᴏ ʏᴀ ᴍɪɴɢʟᴇ 😉** ",
|
127 |
+
" **➠ ᴀᴀᴏ ᴘᴀʀᴛʏ ᴋᴀʀᴛᴇ ʜᴀɪɴ 🥳** ",
|
128 |
+
" **➠ ʙɪᴏ ᴍᴇ ʟɪɴᴋ ʜᴀɪ ᴊᴏɪɴ ᴋᴀʀ ʟᴏ 🧐** ",
|
129 |
+
" **➠ ᴍᴜᴊʜᴇ ʙʜᴜʟ ɢʏᴇ ᴋʏᴀ 🥺** ",
|
130 |
+
" **➠ ʏᴀʜᴀ ᴀᴀ ᴊᴀᴏ @THE_FRIENDZ ᴍᴀsᴛɪ ᴋᴀʀᴇɴɢᴇ 🤭** ",
|
131 |
+
" **➠ ᴛʀᴜᴛʜ ᴀɴᴅ ᴅᴀʀᴇ ᴋʜᴇʟᴏɢᴇ..? 😊** ",
|
132 |
+
" **➠ ᴀᴀᴊ ᴍᴜᴍᴍʏ ɴᴇ ᴅᴀᴛᴀ ʏʀʀ 🥺** ",
|
133 |
+
" **➠ ᴊᴏɪɴ ᴋᴀʀ ʟᴏ 🤗** ",
|
134 |
+
" **➠ ᴇᴋ ᴅɪʟ ʜᴀɪ ᴇᴋ ᴅɪʟ ʜɪ ᴛᴏ ʜᴀɪ 😗** ",
|
135 |
+
" **➠ ᴛᴜᴍʜᴀʀᴇ ᴅᴏsᴛ ᴋᴀʜᴀ ɢʏᴇv🥺** ",
|
136 |
+
" **➠ ᴍʏ ᴄᴜᴛᴇ ᴏᴡɴᴇʀ @RoY_EdiTX 🥰** ",
|
137 |
+
" **➠ ᴋᴀʜᴀ ᴋʜᴏʏᴇ ʜᴏ ᴊᴀᴀɴ 😜** ",
|
138 |
+
" **➠ ɢᴏᴏᴅ ɴɪɢʜᴛ ᴊɪ ʙʜᴜᴛ ʀᴀᴛ ʜᴏ ɢʏɪ 🥰** ",
|
139 |
+
]
|
140 |
+
|
141 |
+
VC_TAG = [ "**➠ ᴏʏᴇ ᴠᴄ ᴀᴀᴏ ɴᴀ ᴘʟs 😒**",
|
142 |
+
"**➠ ᴊᴏɪɴ ᴠᴄ ғᴀsᴛ ɪᴛs ɪᴍᴀᴘᴏʀᴛᴀɴᴛ 😐**",
|
143 |
+
"**➠ ʙᴀʙʏ ᴄᴏᴍᴇ ᴏɴ ᴠᴄ ғᴀsᴛ 🙄**",
|
144 |
+
"**➠ ᴄʜᴜᴘ ᴄʜᴀᴘ ᴠᴄ ᴘʀ ᴀᴀᴏ 🤫**",
|
145 |
+
"**➠ ᴍᴀɪɴ ᴠᴄ ᴍᴇ ᴛᴜᴍᴀʀᴀ ᴡᴀɪᴛ ᴋʀ ʀʜɪ 🥺**",
|
146 |
+
"**➠ ᴠᴄ ᴘᴀʀ ᴀᴀᴏ ʙᴀᴀᴛ ᴋʀᴛᴇ ʜᴀɪ ☺️**",
|
147 |
+
"**➠ ʙᴀʙᴜ ᴠᴄ ᴀᴀ ᴊᴀɪʏᴇ ᴇᴋ ʙᴀʀ 🤨**",
|
148 |
+
"**➠ ᴠᴄ ᴘᴀʀ ʏᴇ ʀᴜssɪᴀɴ ᴋʏᴀ ᴋᴀʀ ʀʜɪ ʜᴀɪ 😮💨**",
|
149 |
+
"**➠ ᴠᴄ ᴘᴀʀ ᴀᴀᴏ ᴠᴀʀɴᴀ ʙᴀɴ ʜᴏ ᴊᴀᴏɢᴇ 🤭**",
|
150 |
+
"**➠ sᴏʀʀʏ ʙᴀʙʏ ᴘʟs ᴠᴄ ᴀᴀ ᴊᴀᴏ ɴᴀ 😢**",
|
151 |
+
"**➠ ᴠᴄ ᴀᴀɴᴀ ᴇᴋ ᴄʜɪᴊ ᴅɪᴋʜᴀᴛɪ ʜᴜ 😮**",
|
152 |
+
"**➠ ᴠᴄ ᴍᴇ ᴄʜᴇᴄᴋ ᴋʀᴋᴇ ʙᴀᴛᴀɴᴀ ᴋᴏɴ sᴀ sᴏɴɢ ᴘʟᴀʏ ʜᴏ ʀʜᴀ ʜᴀɪ.. 💫**",
|
153 |
+
"**➠ ᴠᴄ ᴊᴏɪɴ ᴋʀɴᴇ ᴍᴇ ᴋʏᴀ ᴊᴀᴛᴀ ʜᴀɪ ᴛʜᴏʀᴀ ᴅᴇʀ ᴋᴀʀ ʟᴏ ɴᴀ 😇**",
|
154 |
+
"**➠ ᴊᴀɴᴇᴍᴀɴ ᴠᴄ ᴀᴀᴏ ɴᴀ ʟɪᴠᴇ sʜᴏᴡ ᴅɪᴋʜᴀᴛɪ ʜᴏᴏɴ.. 😵💫**",
|
155 |
+
"**➠ ᴏᴡɴᴇʀ ʙᴀʙᴜ ᴠᴄ ᴛᴀᴘᴋᴏ ɴᴀ... 😕**",
|
156 |
+
"**➠ ʜᴇʏ ᴄᴜᴛɪᴇ ᴠᴄ ᴀᴀɴᴀ ᴛᴏ ᴇᴋ ʙᴀᴀʀ... 🌟**",
|
157 |
+
"**➠ ᴠᴄ ᴘᴀʀ ᴀᴀ ʀʜᴇ ʜᴏ ʏᴀ ɴᴀ... ✨**",
|
158 |
+
"**➠ ᴠᴄ ᴘᴀʀ ᴀᴀ ᴊᴀ ᴠʀɴᴀ ɢʜᴀʀ sᴇ ᴜᴛʜᴡᴀ ᴅᴜɴɢɪ... 🌝**",
|
159 |
+
"**➠ ʙᴀʙʏ ᴠᴄ ᴘᴀʀ ᴋʙ ᴀᴀ ʀʜᴇ ʜᴏ. 💯**",
|
160 |
+
]
|
161 |
+
|
162 |
+
|
163 |
+
@app.on_message(filters.command(["tagall", "tagmember" ], prefixes=["/", "@", "#"]))
|
164 |
+
async def mentionall(client, message):
|
165 |
+
chat_id = message.chat.id
|
166 |
+
if message.chat.type == ChatType.PRIVATE:
|
167 |
+
return await message.reply("๏ ᴛʜɪs ᴄᴏᴍᴍᴀɴᴅ ᴏɴʟʏ ғᴏʀ ɢʀᴏᴜᴘs.")
|
168 |
+
|
169 |
+
is_admin = False
|
170 |
+
try:
|
171 |
+
participant = await client.get_chat_member(chat_id, message.from_user.id)
|
172 |
+
except UserNotParticipant:
|
173 |
+
is_admin = False
|
174 |
+
else:
|
175 |
+
if participant.status in (
|
176 |
+
ChatMemberStatus.ADMINISTRATOR,
|
177 |
+
ChatMemberStatus.OWNER
|
178 |
+
):
|
179 |
+
is_admin = True
|
180 |
+
if not is_admin:
|
181 |
+
return await message.reply("๏ ʏᴏᴜ ᴀʀᴇ ɴᴏᴛ ᴀᴅᴍɪɴ ʙᴀʙʏ, ᴏɴʟʏ ᴀᴅᴍɪɴs ᴄᴀɴ ᴛᴀɢ ᴍᴇᴍʙᴇʀs. ")
|
182 |
+
|
183 |
+
if message.reply_to_message and message.text:
|
184 |
+
return await message.reply("/tagall ɢᴏᴏᴅ ᴍᴏʀɴɪɴɢ ᴛʏᴘᴇ ʟɪᴋᴇ ᴛʜɪs / ʀᴇᴘʟʏ ᴀɴʏ ᴍᴇssᴀɢᴇ ɴᴇxᴛ ᴛɪᴍᴇ ʙᴏᴛ ᴛᴀɢɢɪɴɢ...")
|
185 |
+
elif message.text:
|
186 |
+
mode = "text_on_cmd"
|
187 |
+
msg = message.text
|
188 |
+
elif message.reply_to_message:
|
189 |
+
mode = "text_on_reply"
|
190 |
+
msg = message.reply_to_message
|
191 |
+
if not msg:
|
192 |
+
return await message.reply("/tagall ɢᴏᴏᴅ ᴍᴏʀɴɪɴɢ ᴛʏᴘᴇ ʟɪᴋᴇ ᴛʜɪs / ʀᴇᴘʟʏ ᴀɴʏ ᴍᴇssᴀɢᴇ ɴᴇxᴛ ᴛɪᴍᴇ ғᴏᴛ ᴛᴀɢɢɪɴɢ...")
|
193 |
+
else:
|
194 |
+
return await message.reply("/tagall ɢᴏᴏᴅ ᴍᴏʀɴɪɴɢ ᴛʏᴘᴇ ʟɪᴋᴇ ᴛʜɪs / ʀᴇᴘʟʏ ᴀɴʏ ᴍᴇssᴀɢᴇ ɴᴇxᴛ ᴛɪᴍᴇ ʙᴏᴛ ᴛᴀɢɢɪɴɢ...")
|
195 |
+
if chat_id in spam_chats:
|
196 |
+
return await message.reply("๏ ᴘʟᴇᴀsᴇ ᴀᴛ ғɪʀsᴛ sᴛᴏᴘ ʀᴜɴɴɪɴɢ ᴍᴇɴᴛɪᴏɴ ᴘʀᴏᴄᴇss...")
|
197 |
+
spam_chats.append(chat_id)
|
198 |
+
usrnum = 0
|
199 |
+
usrtxt = ""
|
200 |
+
async for usr in client.get_chat_members(chat_id):
|
201 |
+
if not chat_id in spam_chats:
|
202 |
+
break
|
203 |
+
if usr.user.is_bot:
|
204 |
+
continue
|
205 |
+
usrnum += 1
|
206 |
+
usrtxt += f"[{usr.user.first_name}](tg://user?id={usr.user.id}) "
|
207 |
+
|
208 |
+
if usrnum == 1:
|
209 |
+
if mode == "text_on_cmd":
|
210 |
+
txt = f"{usrtxt} {random.choice(TAGMES)}"
|
211 |
+
await client.send_message(chat_id, txt)
|
212 |
+
elif mode == "text_on_reply":
|
213 |
+
await msg.reply(f"[{random.choice(EMOJI)}](tg://user?id={usr.user.id})")
|
214 |
+
await asyncio.sleep(4)
|
215 |
+
usrnum = 0
|
216 |
+
usrtxt = ""
|
217 |
+
try:
|
218 |
+
spam_chats.remove(chat_id)
|
219 |
+
except:
|
220 |
+
pass
|
221 |
+
|
222 |
+
|
223 |
+
@app.on_message(filters.command(["vctag"], prefixes=["/", "@", "#"]))
|
224 |
+
async def mention_allvc(client, message):
|
225 |
+
chat_id = message.chat.id
|
226 |
+
if message.chat.type == ChatType.PRIVATE:
|
227 |
+
return await message.reply("๏ ᴛʜɪs ᴄᴏᴍᴍᴀɴᴅ ᴏɴʟʏ ғᴏʀ ɢʀᴏᴜᴘs.")
|
228 |
+
|
229 |
+
is_admin = False
|
230 |
+
try:
|
231 |
+
participant = await client.get_chat_member(chat_id, message.from_user.id)
|
232 |
+
except UserNotParticipant:
|
233 |
+
is_admin = False
|
234 |
+
else:
|
235 |
+
if participant.status in (
|
236 |
+
ChatMemberStatus.ADMINISTRATOR,
|
237 |
+
ChatMemberStatus.OWNER
|
238 |
+
):
|
239 |
+
is_admin = True
|
240 |
+
if not is_admin:
|
241 |
+
return await message.reply("๏ ʏᴏᴜ ᴀʀᴇ ɴᴏᴛ ᴀᴅᴍɪɴ ʙᴀʙʏ, ᴏɴʟʏ ᴀᴅᴍɪɴs ᴄᴀɴ ᴛᴀɢ ᴍᴇᴍʙᴇʀs. ")
|
242 |
+
if chat_id in spam_chats:
|
243 |
+
return await message.reply("๏ ᴘʟᴇᴀsᴇ ᴀᴛ ғɪʀsᴛ sᴛᴏᴘ ʀᴜɴɴɪɴɢ ᴍᴇɴᴛɪᴏɴ ᴘʀᴏᴄᴇss...")
|
244 |
+
spam_chats.append(chat_id)
|
245 |
+
usrnum = 0
|
246 |
+
usrtxt = ""
|
247 |
+
async for usr in client.get_chat_members(chat_id):
|
248 |
+
if not chat_id in spam_chats:
|
249 |
+
break
|
250 |
+
if usr.user.is_bot:
|
251 |
+
continue
|
252 |
+
usrnum += 1
|
253 |
+
usrtxt += f"[{usr.user.first_name}](tg://user?id={usr.user.id}) "
|
254 |
+
|
255 |
+
if usrnum == 1:
|
256 |
+
txt = f"{usrtxt} {random.choice(VC_TAG)}"
|
257 |
+
await client.send_message(chat_id, txt)
|
258 |
+
await asyncio.sleep(4)
|
259 |
+
usrnum = 0
|
260 |
+
usrtxt = ""
|
261 |
+
try:
|
262 |
+
spam_chats.remove(chat_id)
|
263 |
+
except:
|
264 |
+
pass
|
265 |
+
|
266 |
+
|
267 |
+
|
268 |
+
@app.on_message(filters.command(["cancel", "tagstop", "vcstop"]))
|
269 |
+
async def cancel_spam(client, message):
|
270 |
+
if not message.chat.id in spam_chats:
|
271 |
+
return await message.reply("๏ ᴄᴜʀʀᴇɴᴛʟʏ ɪ'ᴍ ɴᴏᴛ ᴛᴀɢɢɪɴɢ ʙᴀʙʏ.")
|
272 |
+
is_admin = False
|
273 |
+
try:
|
274 |
+
participant = await client.get_chat_member(message.chat.id, message.from_user.id)
|
275 |
+
except UserNotParticipant:
|
276 |
+
is_admin = False
|
277 |
+
else:
|
278 |
+
if participant.status in (
|
279 |
+
ChatMemberStatus.ADMINISTRATOR,
|
280 |
+
ChatMemberStatus.OWNER
|
281 |
+
):
|
282 |
+
is_admin = True
|
283 |
+
if not is_admin:
|
284 |
+
return await message.reply("๏ ʏᴏᴜ ᴀʀᴇ ɴᴏᴛ ᴀᴅᴍɪɴ ʙᴀʙʏ, ᴏɴʟʏ ᴀᴅᴍɪɴs ᴄᴀɴ ᴛᴀɢ ᴍᴇᴍʙᴇʀs.")
|
285 |
+
else:
|
286 |
+
try:
|
287 |
+
spam_chats.remove(message.chat.id)
|
288 |
+
except:
|
289 |
+
pass
|
290 |
+
return await message.reply("๏ ᴍᴇɴᴛɪᴏɴ ᴘʀᴏᴄᴇss sᴛᴏᴘᴘᴇᴅ ๏")
|
DragMusic/plugins/admins/zombies.py
ADDED
@@ -0,0 +1,184 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import asyncio
|
3 |
+
from pyrogram import Client, filters
|
4 |
+
from pyrogram.types import Message
|
5 |
+
from pyrogram import enums
|
6 |
+
from pyrogram.enums import ChatMemberStatus
|
7 |
+
from pyrogram.errors import FloodWait
|
8 |
+
from DragMusic import app
|
9 |
+
from time import time
|
10 |
+
import asyncio
|
11 |
+
from DragMusic.utils.extraction import extract_user
|
12 |
+
|
13 |
+
# Define a dictionary to track the last message timestamp for each user
|
14 |
+
user_last_message_time = {}
|
15 |
+
user_command_count = {}
|
16 |
+
# Define the threshold for command spamming (e.g., 20 commands within 60 seconds)
|
17 |
+
SPAM_THRESHOLD = 2
|
18 |
+
SPAM_WINDOW_SECONDS = 5
|
19 |
+
|
20 |
+
# ------------------------------------------------------------------------------- #
|
21 |
+
|
22 |
+
chatQueue = []
|
23 |
+
|
24 |
+
stopProcess = False
|
25 |
+
|
26 |
+
# ------------------------------------------------------------------------------- #
|
27 |
+
|
28 |
+
|
29 |
+
@app.on_message(filters.command(["zombies", "Deletedaccounts"]))
|
30 |
+
async def remove(client, message):
|
31 |
+
|
32 |
+
global stopProcess
|
33 |
+
try:
|
34 |
+
try:
|
35 |
+
sender = await app.get_chat_member(message.chat.id, message.from_user.id)
|
36 |
+
has_permissions = sender.privileges
|
37 |
+
except:
|
38 |
+
has_permissions = message.sender_chat
|
39 |
+
if has_permissions:
|
40 |
+
bot = await app.get_chat_member(message.chat.id, "self")
|
41 |
+
if bot.status == ChatMemberStatus.MEMBER:
|
42 |
+
await message.reply(
|
43 |
+
"➠ | ɪ ɴᴇᴇᴅ ᴀᴅᴍɪɴ ᴘᴇʀᴍɪssɪᴏɴs ᴛᴏ ʀᴇᴍᴏᴠᴇ ᴅᴇʟᴇᴛᴇᴅ ᴀᴄᴄᴏᴜɴᴛs."
|
44 |
+
)
|
45 |
+
else:
|
46 |
+
if len(chatQueue) > 30:
|
47 |
+
await message.reply(
|
48 |
+
"➠ | ɪ'ᴍ ᴀʟʀᴇᴀᴅʏ ᴡᴏʀᴋɪɴɢ ᴏɴ ᴍʏ ᴍᴀxɪᴍᴜᴍ ɴᴜᴍʙᴇʀ ᴏғ 30 ᴄʜᴀᴛs ᴀᴛ ᴛʜᴇ ᴍᴏᴍᴇɴᴛ. ᴘʟᴇᴀsᴇ ᴛʀʏ ᴀɢᴀɪɴ sʜᴏʀᴛʟʏ."
|
49 |
+
)
|
50 |
+
else:
|
51 |
+
if message.chat.id in chatQueue:
|
52 |
+
await message.reply(
|
53 |
+
"➠ | ᴛʜᴇʀᴇ's ᴀʟʀᴇᴀᴅʏ ᴀɴ ᴏɴɢɪɪɴɢ ᴘʀᴏᴄᴇss ɪɴ ᴛʜɪs ᴄʜᴀᴛ. ᴘʟᴇᴀsᴇ [ /stop ] ᴛᴏ sᴛᴀʀᴛ ᴀ ɴᴇᴡ ᴏɴᴇ."
|
54 |
+
)
|
55 |
+
else:
|
56 |
+
chatQueue.append(message.chat.id)
|
57 |
+
deletedList = []
|
58 |
+
async for member in app.get_chat_members(message.chat.id):
|
59 |
+
if member.user.is_deleted == True:
|
60 |
+
deletedList.append(member.user)
|
61 |
+
else:
|
62 |
+
pass
|
63 |
+
lenDeletedList = len(deletedList)
|
64 |
+
if lenDeletedList == 0:
|
65 |
+
await message.reply("⟳ | ɴᴏ ᴅᴇʟᴇᴛᴇᴅ ᴀᴄᴄᴏᴜɴᴛs ɪɴ ᴛʜɪs ᴄʜᴀᴛ.")
|
66 |
+
chatQueue.remove(message.chat.id)
|
67 |
+
else:
|
68 |
+
k = 0
|
69 |
+
processTime = lenDeletedList * 1
|
70 |
+
temp = await app.send_message(
|
71 |
+
message.chat.id,
|
72 |
+
f"🧭 | ᴛᴏᴛᴀʟ ᴏғ {lenDeletedList} ᴅᴇʟᴇᴛᴇᴅ ᴀᴄᴄᴏᴜɴᴛs ʜᴀs ʙᴇᴇɴ ᴅᴇᴛᴇᴄᴛᴇᴅ.\n🥀 | ᴇsᴛɪᴍᴀᴛᴇᴅ ᴛɪᴍᴇ: {processTime} sᴇᴄᴏɴᴅs ғʀᴏᴍ ɴᴏᴡ.",
|
73 |
+
)
|
74 |
+
if stopProcess:
|
75 |
+
stopProcess = False
|
76 |
+
while len(deletedList) > 0 and not stopProcess:
|
77 |
+
deletedAccount = deletedList.pop(0)
|
78 |
+
try:
|
79 |
+
await app.ban_chat_member(
|
80 |
+
message.chat.id, deletedAccount.id
|
81 |
+
)
|
82 |
+
except Exception:
|
83 |
+
pass
|
84 |
+
k += 1
|
85 |
+
await asyncio.sleep(10)
|
86 |
+
if k == lenDeletedList:
|
87 |
+
await message.reply(
|
88 |
+
f"✅ | sᴜᴄᴄᴇssғᴜʟʟʏ ʀᴇᴍᴏᴠᴇᴅ ᴀʟʟ ᴅᴇʟᴇᴛᴇᴅ ᴀᴄᴄɪᴜɴᴛs ғʀᴏᴍ ᴛʜɪs ᴄʜᴀᴛ."
|
89 |
+
)
|
90 |
+
await temp.delete()
|
91 |
+
else:
|
92 |
+
await message.reply(
|
93 |
+
f"✅ | sᴜᴄᴄᴇssғᴜʟʟʏ ʀᴇᴍᴏᴠᴇᴅ {k} ᴅᴇʟᴇᴛᴇᴅ ᴀᴄᴄᴏᴜɴᴛs ғʀᴏᴍ ᴛʜɪs ᴄʜᴀᴛ."
|
94 |
+
)
|
95 |
+
await temp.delete()
|
96 |
+
chatQueue.remove(message.chat.id)
|
97 |
+
else:
|
98 |
+
await message.reply(
|
99 |
+
"👮🏻 | sᴏʀʀʏ, ᴏɴʟʏ ᴀᴅᴍɪɴ ᴄᴀɴ ᴇxᴇᴄᴜᴛᴇ ᴛʜɪs ᴄᴏᴍᴍᴀɴᴅ."
|
100 |
+
)
|
101 |
+
except FloodWait as e:
|
102 |
+
await asyncio.sleep(e.value)
|
103 |
+
|
104 |
+
|
105 |
+
# ------------------------------------------------------------------------------- #
|
106 |
+
|
107 |
+
|
108 |
+
@app.on_message(filters.command(["admins", "staff"]))
|
109 |
+
async def admins(client, message):
|
110 |
+
|
111 |
+
try:
|
112 |
+
adminList = []
|
113 |
+
ownerList = []
|
114 |
+
async for admin in app.get_chat_members(
|
115 |
+
message.chat.id, filter=enums.ChatMembersFilter.ADMINISTRATORS
|
116 |
+
):
|
117 |
+
if admin.privileges.is_Dragmous == False:
|
118 |
+
if admin.user.is_bot == True:
|
119 |
+
pass
|
120 |
+
elif admin.status == ChatMemberStatus.OWNER:
|
121 |
+
ownerList.append(admin.user)
|
122 |
+
else:
|
123 |
+
adminList.append(admin.user)
|
124 |
+
else:
|
125 |
+
pass
|
126 |
+
lenAdminList = len(ownerList) + len(adminList)
|
127 |
+
text2 = f"**ɢʀᴏᴜᴘ sᴛᴀғғ - {message.chat.title}**\n\n"
|
128 |
+
try:
|
129 |
+
owner = ownerList[0]
|
130 |
+
if owner.username == None:
|
131 |
+
text2 += f"👑 ᴏᴡɴᴇʀ\n└ {owner.mention}\n\n👮🏻 ᴀᴅᴍɪɴs\n"
|
132 |
+
else:
|
133 |
+
text2 += f"👑 ᴏᴡɴᴇʀ\n└ @{owner.username}\n\n👮🏻 ᴀᴅᴍɪɴs\n"
|
134 |
+
except:
|
135 |
+
text2 += f"👑 ᴏᴡɴᴇʀ\n└ <i>Hidden</i>\n\n👮🏻 ᴀᴅᴍɪɴs\n"
|
136 |
+
if len(adminList) == 0:
|
137 |
+
text2 += "└ <i>ᴀᴅᴍɪɴs ᴀʀᴇ ʜɪᴅᴅᴇɴ</i>"
|
138 |
+
await app.send_message(message.chat.id, text2)
|
139 |
+
else:
|
140 |
+
while len(adminList) > 1:
|
141 |
+
admin = adminList.pop(0)
|
142 |
+
if admin.username == None:
|
143 |
+
text2 += f"├ {admin.mention}\n"
|
144 |
+
else:
|
145 |
+
text2 += f"├ @{admin.username}\n"
|
146 |
+
else:
|
147 |
+
admin = adminList.pop(0)
|
148 |
+
if admin.username == None:
|
149 |
+
text2 += f"└ {admin.mention}\n\n"
|
150 |
+
else:
|
151 |
+
text2 += f"└ @{admin.username}\n\n"
|
152 |
+
text2 += f"✅ | ᴛᴏᴛᴀʟ ɴᴜᴍʙᴇʀ ᴏғ ᴀᴅᴍɪɴs: {lenAdminList}"
|
153 |
+
await app.send_message(message.chat.id, text2)
|
154 |
+
except FloodWait as e:
|
155 |
+
await asyncio.sleep(e.value)
|
156 |
+
|
157 |
+
|
158 |
+
# ------------------------------------------------------------------------------- #
|
159 |
+
|
160 |
+
|
161 |
+
@app.on_message(filters.command("bots"))
|
162 |
+
async def bots(client, message):
|
163 |
+
|
164 |
+
try:
|
165 |
+
botList = []
|
166 |
+
async for bot in app.get_chat_members(
|
167 |
+
message.chat.id, filter=enums.ChatMembersFilter.BOTS
|
168 |
+
):
|
169 |
+
botList.append(bot.user)
|
170 |
+
lenBotList = len(botList)
|
171 |
+
text3 = f"ʙᴏᴛ ʟɪsᴛ - {message.chat.title}\n\n🤖 ʙᴏᴛs\n"
|
172 |
+
while len(botList) > 1:
|
173 |
+
bot = botList.pop(0)
|
174 |
+
text3 += f"├ @{bot.username}\n"
|
175 |
+
else:
|
176 |
+
bot = botList.pop(0)
|
177 |
+
text3 += f" @{bot.username}\n\n"
|
178 |
+
text3 += f"✅ | ᴛᴏᴛᴀʟ ɴᴜᴍʙᴇʀ ᴏғ ʙᴏᴛs: {lenBotList}"
|
179 |
+
await app.send_message(message.chat.id, text3)
|
180 |
+
except FloodWait as e:
|
181 |
+
await asyncio.sleep(e.value)
|
182 |
+
|
183 |
+
|
184 |
+
# ------------------------------------------------------------------------------- #
|
DragMusic/plugins/bot/approve.text
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from DragMusic import app
|
2 |
+
from os import environ
|
3 |
+
from pyrogram import Client, filters
|
4 |
+
from pyrogram.types import ChatJoinRequest
|
5 |
+
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
|
6 |
+
|
7 |
+
EVAA = [
|
8 |
+
[
|
9 |
+
InlineKeyboardButton(text="ᴀᴅᴅ ᴍᴇ ʙᴀʙʏ", url=f"https://t.me/DragMusicBot?startgroup=true"),
|
10 |
+
],
|
11 |
+
]
|
12 |
+
|
13 |
+
# Extract environment variables or provide default values
|
14 |
+
chat_id_env = environ.get("CHAT_ID")
|
15 |
+
CHAT_ID = [int(app) for app in chat_id_env.split(",")] if chat_id_env else []
|
16 |
+
|
17 |
+
TEXT = environ.get("APPROVED_WELCOME_TEXT", "❅ ʜᴇʟʟᴏ ʙᴀʙʏ {mention}\n\n❅ ᴡᴇʟᴄᴏᴍᴇ ᴛᴏ {title}\n\n")
|
18 |
+
APPROVED = environ.get("APPROVED_WELCOME", "on").lower()
|
19 |
+
|
20 |
+
# Define an event handler for chat join requests
|
21 |
+
@app.on_chat_join_request((filters.group | filters.channel) & filters.chat(CHAT_ID) if CHAT_ID else (filters.group | filters.channel))
|
22 |
+
async def autoapprove(client: app, message: ChatJoinRequest):
|
23 |
+
chat = message.chat # Chat
|
24 |
+
user = message.from_user # User
|
25 |
+
print(f"๏ {user.first_name} ᴊᴏɪɴᴇᴅ 🤝") # Logs
|
26 |
+
await client.approve_chat_join_request(chat_id=chat.id, user_id=user.id)
|
27 |
+
if APPROVED == "on":
|
28 |
+
await client.send_message(chat_id=chat.id, text=TEXT.format(mention=user.mention, title=chat.title),reply_markup=InlineKeyboardMarkup(EVAA),)
|
DragMusic/plugins/bot/fakeinfo.py
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import requests
|
2 |
+
from DragMusic import app as Checker
|
3 |
+
from pyrogram import filters
|
4 |
+
|
5 |
+
|
6 |
+
@Checker.on_message(filters.command("fake"))
|
7 |
+
async def address(_, message):
|
8 |
+
message_text = message.text.strip()
|
9 |
+
words = message_text.split()
|
10 |
+
|
11 |
+
if len(words) > 1:
|
12 |
+
query = words[1].strip()
|
13 |
+
url = f"https://randomuser.me/api/?nat={query}"
|
14 |
+
response = requests.get(url)
|
15 |
+
data = response.json()
|
16 |
+
|
17 |
+
if "results" in data:
|
18 |
+
user_data = data["results"][0]
|
19 |
+
|
20 |
+
|
21 |
+
name = f"{user_data['name']['title']} {user_data['name']['first']} {user_data['name']['last']}"
|
22 |
+
address = f"{user_data['location']['street']['number']} {user_data['location']['street']['name']}"
|
23 |
+
city = user_data['location']['city']
|
24 |
+
state = user_data['location']['state']
|
25 |
+
country = user_data['location']['country']
|
26 |
+
postal = user_data['location']['postcode']
|
27 |
+
email = user_data['email']
|
28 |
+
phone = user_data['phone']
|
29 |
+
picture_url = user_data['picture']['large']
|
30 |
+
|
31 |
+
|
32 |
+
caption = f"""
|
33 |
+
﹝⌬﹞**ɴᴀᴍᴇ** ⇢ {name}
|
34 |
+
﹝⌬﹞**ᴀᴅᴅʀᴇss** ⇢ {address}
|
35 |
+
﹝⌬﹞**ᴄᴏᴜɴᴛʀʏ** ⇢ {country}
|
36 |
+
﹝⌬﹞**ᴄɪᴛʏ** ⇢ {city}
|
37 |
+
﹝⌬﹞**sᴛᴀᴛᴇ** ⇢ {state}
|
38 |
+
﹝⌬﹞**ᴘᴏsᴛᴀʟ** ⇢ {postal}
|
39 |
+
﹝⌬﹞**ᴇᴍᴀɪʟ** ⇢ {email}
|
40 |
+
﹝⌬﹞**ᴘʜᴏɴᴇ** ⇢ {phone}
|
41 |
+
|
42 |
+
"""
|
43 |
+
|
44 |
+
|
45 |
+
await message.reply_photo(photo=picture_url, caption=caption)
|
46 |
+
else:
|
47 |
+
await message.reply_text("ᴏᴏᴘs ɴᴏᴛ ғᴏᴜɴᴅ ᴀɴʏ ᴀᴅᴅʀᴇss.")
|
DragMusic/plugins/bot/help.py
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from typing import Union
|
2 |
+
|
3 |
+
from pyrogram import filters, types
|
4 |
+
from pyrogram.types import InlineKeyboardMarkup, Message
|
5 |
+
|
6 |
+
from DragMusic import app
|
7 |
+
from DragMusic.utils import help_pannel
|
8 |
+
from DragMusic.utils.database import get_lang
|
9 |
+
from DragMusic.utils.decorators.language import LanguageStart, languageCB
|
10 |
+
from DragMusic.utils.inline.help import help_back_markup, private_help_panel
|
11 |
+
from config import BANNED_USERS, START_IMG_URL, SUPPORT_CHAT
|
12 |
+
from strings import get_string, helpers
|
13 |
+
|
14 |
+
|
15 |
+
@app.on_message(filters.command(["help"]) & filters.private & ~BANNED_USERS)
|
16 |
+
@app.on_callback_query(filters.regex("settings_back_helper") & ~BANNED_USERS)
|
17 |
+
async def helper_private(
|
18 |
+
client: app, update: Union[types.Message, types.CallbackQuery]
|
19 |
+
):
|
20 |
+
is_callback = isinstance(update, types.CallbackQuery)
|
21 |
+
if is_callback:
|
22 |
+
try:
|
23 |
+
await update.answer()
|
24 |
+
except:
|
25 |
+
pass
|
26 |
+
chat_id = update.message.chat.id
|
27 |
+
language = await get_lang(chat_id)
|
28 |
+
_ = get_string(language)
|
29 |
+
keyboard = help_pannel(_, True)
|
30 |
+
await update.edit_message_text(
|
31 |
+
_["help_1"].format(SUPPORT_CHAT), reply_markup=keyboard
|
32 |
+
)
|
33 |
+
else:
|
34 |
+
try:
|
35 |
+
await update.delete()
|
36 |
+
except:
|
37 |
+
pass
|
38 |
+
language = await get_lang(update.chat.id)
|
39 |
+
_ = get_string(language)
|
40 |
+
keyboard = help_pannel(_)
|
41 |
+
await update.reply_photo(
|
42 |
+
photo=START_IMG_URL,
|
43 |
+
caption=_["help_1"].format(SUPPORT_CHAT),
|
44 |
+
reply_markup=keyboard,
|
45 |
+
)
|
46 |
+
|
47 |
+
|
48 |
+
@app.on_message(filters.command(["help"]) & filters.group & ~BANNED_USERS)
|
49 |
+
@LanguageStart
|
50 |
+
async def help_com_group(client, message: Message, _):
|
51 |
+
keyboard = private_help_panel(_)
|
52 |
+
await message.reply_text(_["help_2"], reply_markup=InlineKeyboardMarkup(keyboard))
|
53 |
+
|
54 |
+
|
55 |
+
@app.on_callback_query(filters.regex("help_callback") & ~BANNED_USERS)
|
56 |
+
@languageCB
|
57 |
+
async def helper_cb(client, CallbackQuery, _):
|
58 |
+
callback_data = CallbackQuery.data.strip()
|
59 |
+
cb = callback_data.split(None, 1)[1]
|
60 |
+
keyboard = help_back_markup(_)
|
61 |
+
if cb == "hb1":
|
62 |
+
await CallbackQuery.edit_message_text(helpers.HELP_1, reply_markup=keyboard)
|
63 |
+
elif cb == "hb2":
|
64 |
+
await CallbackQuery.edit_message_text(helpers.HELP_2, reply_markup=keyboard)
|
65 |
+
elif cb == "hb3":
|
66 |
+
await CallbackQuery.edit_message_text(helpers.HELP_3, reply_markup=keyboard)
|
67 |
+
elif cb == "hb4":
|
68 |
+
await CallbackQuery.edit_message_text(helpers.HELP_4, reply_markup=keyboard)
|
69 |
+
elif cb == "hb5":
|
70 |
+
await CallbackQuery.edit_message_text(helpers.HELP_5, reply_markup=keyboard)
|
71 |
+
elif cb == "hb6":
|
72 |
+
await CallbackQuery.edit_message_text(helpers.HELP_6, reply_markup=keyboard)
|
73 |
+
elif cb == "hb7":
|
74 |
+
await CallbackQuery.edit_message_text(helpers.HELP_7, reply_markup=keyboard)
|
75 |
+
elif cb == "hb8":
|
76 |
+
await CallbackQuery.edit_message_text(helpers.HELP_8, reply_markup=keyboard)
|
77 |
+
elif cb == "hb9":
|
78 |
+
await CallbackQuery.edit_message_text(helpers.HELP_9, reply_markup=keyboard)
|
79 |
+
elif cb == "hb10":
|
80 |
+
await CallbackQuery.edit_message_text(helpers.HELP_10, reply_markup=keyboard)
|
81 |
+
elif cb == "hb11":
|
82 |
+
await CallbackQuery.edit_message_text(helpers.HELP_11, reply_markup=keyboard)
|
83 |
+
elif cb == "hb12":
|
84 |
+
await CallbackQuery.edit_message_text(helpers.HELP_12, reply_markup=keyboard)
|
85 |
+
elif cb == "hb13":
|
86 |
+
await CallbackQuery.edit_message_text(helpers.HELP_13, reply_markup=keyboard)
|
87 |
+
elif cb == "hb14":
|
88 |
+
await CallbackQuery.edit_message_text(helpers.HELP_14, reply_markup=keyboard)
|
89 |
+
elif cb == "hb15":
|
90 |
+
await CallbackQuery.edit_message_text(helpers.HELP_15, reply_markup=keyboard)
|
DragMusic/plugins/bot/inline.py
ADDED
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from pyrogram.types import (
|
2 |
+
InlineKeyboardButton,
|
3 |
+
InlineKeyboardMarkup,
|
4 |
+
InlineQueryResultPhoto,
|
5 |
+
)
|
6 |
+
from youtubesearchpython.__future__ import VideosSearch
|
7 |
+
|
8 |
+
from DragMusic import app
|
9 |
+
from DragMusic.utils.inlinequery import answer
|
10 |
+
from config import BANNED_USERS
|
11 |
+
|
12 |
+
|
13 |
+
@app.on_inline_query(~BANNED_USERS)
|
14 |
+
async def inline_query_handler(client, query):
|
15 |
+
text = query.query.strip().lower()
|
16 |
+
answers = []
|
17 |
+
if text.strip() == "":
|
18 |
+
try:
|
19 |
+
await client.answer_inline_query(query.id, results=answer, cache_time=10)
|
20 |
+
except:
|
21 |
+
return
|
22 |
+
else:
|
23 |
+
a = VideosSearch(text, limit=20)
|
24 |
+
result = (await a.next()).get("result")
|
25 |
+
for x in range(15):
|
26 |
+
title = (result[x]["title"]).title()
|
27 |
+
duration = result[x]["duration"]
|
28 |
+
views = result[x]["viewCount"]["short"]
|
29 |
+
thumbnail = result[x]["thumbnails"][0]["url"].split("?")[0]
|
30 |
+
channellink = result[x]["channel"]["link"]
|
31 |
+
channel = result[x]["channel"]["name"]
|
32 |
+
link = result[x]["link"]
|
33 |
+
published = result[x]["publishedTime"]
|
34 |
+
description = f"{views} | {duration} ᴍɪɴᴜᴛᴇs | {channel} | {published}"
|
35 |
+
buttons = InlineKeyboardMarkup(
|
36 |
+
[
|
37 |
+
[
|
38 |
+
InlineKeyboardButton(
|
39 |
+
text="ʏᴏᴜᴛᴜʙᴇ 🎄",
|
40 |
+
url=link,
|
41 |
+
)
|
42 |
+
],
|
43 |
+
]
|
44 |
+
)
|
45 |
+
searched_text = f"""
|
46 |
+
❄ <b>ᴛɪᴛʟᴇ :</b> <a href={link}>{title}</a>
|
47 |
+
|
48 |
+
⏳ <b>ᴅᴜʀᴀᴛɪᴏɴ :</b> {duration} ᴍɪɴᴜᴛᴇs
|
49 |
+
👀 <b>ᴠɪᴇᴡs :</b> <code>{views}</code>
|
50 |
+
🎥 <b>ᴄʜᴀɴɴᴇʟ :</b> <a href={channellink}>{channel}</a>
|
51 |
+
⏰ <b>ᴘᴜʙʟɪsʜᴇᴅ ᴏɴ :</b> {published}
|
52 |
+
|
53 |
+
|
54 |
+
<u><b>➻ ɪɴʟɪɴᴇ sᴇᴀʀᴄʜ ᴍᴏᴅᴇ ʙʏ {app.name}</b></u>"""
|
55 |
+
answers.append(
|
56 |
+
InlineQueryResultPhoto(
|
57 |
+
photo_url=thumbnail,
|
58 |
+
title=title,
|
59 |
+
thumb_url=thumbnail,
|
60 |
+
description=description,
|
61 |
+
caption=searched_text,
|
62 |
+
reply_markup=buttons,
|
63 |
+
)
|
64 |
+
)
|
65 |
+
try:
|
66 |
+
return await client.answer_inline_query(query.id, results=answers)
|
67 |
+
except:
|
68 |
+
return
|
DragMusic/plugins/bot/mustjoin.py
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import random
|
2 |
+
from pyrogram import Client, filters
|
3 |
+
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, Message
|
4 |
+
from pyrogram.errors import ChatAdminRequired, UserNotParticipant, ChatWriteForbidden
|
5 |
+
from DragMusic import app
|
6 |
+
|
7 |
+
MISHI = [
|
8 |
+
"https://graph.org/file/f86b71018196c5cfe7344.jpg",
|
9 |
+
"https://graph.org/file/a3db9af88f25bb1b99325.jpg",
|
10 |
+
"https://graph.org/file/5b344a55f3d5199b63fa5.jpg",
|
11 |
+
"https://graph.org/file/84de4b440300297a8ecb3.jpg",
|
12 |
+
"https://graph.org/file/84e84ff778b045879d24f.jpg",
|
13 |
+
"https://graph.org/file/a4a8f0e5c0e6b18249ffc.jpg",
|
14 |
+
"https://graph.org/file/ed92cada78099c9c3a4f7.jpg",
|
15 |
+
"https://graph.org/file/d6360613d0fa7a9d2f90b.jpg"
|
16 |
+
"https://graph.org/file/37248e7bdff70c662a702.jpg",
|
17 |
+
"https://graph.org/file/0bfe29d15e918917d1305.jpg",
|
18 |
+
"https://graph.org/file/16b1a2828cc507f8048bd.jpg",
|
19 |
+
"https://graph.org/file/e6b01f23f2871e128dad8.jpg",
|
20 |
+
"https://graph.org/file/cacbdddee77784d9ed2b7.jpg",
|
21 |
+
"https://graph.org/file/ddc5d6ec1c33276507b19.jpg",
|
22 |
+
"https://graph.org/file/39d7277189360d2c85b62.jpg",
|
23 |
+
"https://graph.org/file/5846b9214eaf12c3ed100.jpg",
|
24 |
+
"https://graph.org/file/ad4f9beb4d526e6615e18.jpg",
|
25 |
+
"https://graph.org/file/3514efaabe774e4f181f2.jpg",
|
26 |
+
]
|
27 |
+
|
28 |
+
#--------------------------
|
29 |
+
|
30 |
+
MUST_JOIN = "ERROR_RESPON_TIMEOUT"
|
31 |
+
#------------------------
|
32 |
+
@app.on_message(filters.incoming & filters.private, group=-1)
|
33 |
+
async def must_join_channel(app: Client, msg: Message):
|
34 |
+
if not MUST_JOIN:
|
35 |
+
return
|
36 |
+
try:
|
37 |
+
try:
|
38 |
+
await app.get_chat_member(MUST_JOIN, msg.from_user.id)
|
39 |
+
except UserNotParticipant:
|
40 |
+
if MUST_JOIN.isalpha():
|
41 |
+
link = "https://t.me/" + MUST_JOIN
|
42 |
+
else:
|
43 |
+
chat_info = await app.get_chat(MUST_JOIN)
|
44 |
+
link = chat_info.invite_link
|
45 |
+
try:
|
46 |
+
await msg.reply_photo(random.choice(MISHI), caption=f"❅ ʜᴇʏ ᴛʜᴇʀᴇ, ɴɪᴄᴇ ᴛᴏ ᴍᴇᴇᴛ ᴜʜʜ !\n\n❅ ɪғ ʏᴏᴜ ᴡᴀɴᴛ ᴛᴏ ᴜsᴇ ˹ʙᴜɢ ✘ ϻʊsɪx ˼, ᴛʜᴇɴ ᴄʟɪᴄᴋ ᴏɴ ᴛʜᴇ ʙᴇʟᴏᴡ ʙᴜᴛᴛᴏɴ ᴀɴᴅ ʏᴏᴜ ᴊᴏɪɴᴇᴅ, ᴛʜᴇɴ ʏᴏᴜ ᴄᴀɴ ᴜsᴇ ᴀʟʟ ᴍʏ ᴄᴏᴍᴍᴀɴᴅs ",
|
47 |
+
reply_markup=InlineKeyboardMarkup(
|
48 |
+
[
|
49 |
+
[
|
50 |
+
InlineKeyboardButton("ᴜᴘᴅᴀᴛᴇ", url="https://t.me/haatsoja"),
|
51 |
+
InlineKeyboardButton("sᴜᴘᴘᴏʀᴛ", url="https://t.me/dragbackup"),
|
52 |
+
]
|
53 |
+
]
|
54 |
+
)
|
55 |
+
)
|
56 |
+
await msg.stop_propagation()
|
57 |
+
except ChatWriteForbidden:
|
58 |
+
pass
|
59 |
+
except ChatAdminRequired:
|
60 |
+
print(f"๏ ᴘʀᴏᴍᴏᴛᴇ ᴍᴇ ᴀs ᴀɴ ᴀᴅᴍɪɴ ɪɴ ᴛʜᴇ ᴍᴜsᴛ_ᴊᴏɪɴ ᴄʜᴀᴛ ๏: {MUST_JOIN} !")
|
61 |
+
|
DragMusic/plugins/bot/settings.py
ADDED
@@ -0,0 +1,391 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from pyrogram import filters
|
2 |
+
from pyrogram.enums import ChatType
|
3 |
+
from pyrogram.errors import MessageNotModified
|
4 |
+
from pyrogram.types import (
|
5 |
+
CallbackQuery,
|
6 |
+
InlineKeyboardButton,
|
7 |
+
InlineKeyboardMarkup,
|
8 |
+
Message,
|
9 |
+
)
|
10 |
+
|
11 |
+
from DragMusic import app
|
12 |
+
from DragMusic.utils.database import (
|
13 |
+
add_nonadmin_chat,
|
14 |
+
get_authuser,
|
15 |
+
get_authuser_names,
|
16 |
+
get_playmode,
|
17 |
+
get_playtype,
|
18 |
+
get_upvote_count,
|
19 |
+
is_nonadmin_chat,
|
20 |
+
is_skipmode,
|
21 |
+
remove_nonadmin_chat,
|
22 |
+
set_playmode,
|
23 |
+
set_playtype,
|
24 |
+
set_upvotes,
|
25 |
+
skip_off,
|
26 |
+
skip_on,
|
27 |
+
)
|
28 |
+
from DragMusic.utils.decorators.admins import ActualAdminCB
|
29 |
+
from DragMusic.utils.decorators.language import language, languageCB
|
30 |
+
from DragMusic.utils.inline.settings import (
|
31 |
+
auth_users_markup,
|
32 |
+
playmode_users_markup,
|
33 |
+
setting_markup,
|
34 |
+
vote_mode_markup,
|
35 |
+
)
|
36 |
+
from DragMusic.utils.inline.start import private_panel
|
37 |
+
from config import BANNED_USERS, OWNER_ID
|
38 |
+
|
39 |
+
|
40 |
+
@app.on_message(
|
41 |
+
filters.command(["settings", "setting"]) & filters.group & ~BANNED_USERS
|
42 |
+
)
|
43 |
+
@language
|
44 |
+
async def settings_mar(client, message: Message, _):
|
45 |
+
buttons = setting_markup(_)
|
46 |
+
await message.reply_text(
|
47 |
+
_["setting_1"].format(app.mention, message.chat.id, message.chat.title),
|
48 |
+
reply_markup=InlineKeyboardMarkup(buttons),
|
49 |
+
)
|
50 |
+
|
51 |
+
|
52 |
+
@app.on_callback_query(filters.regex("settings_helper") & ~BANNED_USERS)
|
53 |
+
@languageCB
|
54 |
+
async def settings_cb(client, CallbackQuery, _):
|
55 |
+
try:
|
56 |
+
await CallbackQuery.answer(_["set_cb_5"])
|
57 |
+
except:
|
58 |
+
pass
|
59 |
+
buttons = setting_markup(_)
|
60 |
+
return await CallbackQuery.edit_message_text(
|
61 |
+
_["setting_1"].format(
|
62 |
+
app.mention,
|
63 |
+
CallbackQuery.message.chat.id,
|
64 |
+
CallbackQuery.message.chat.title,
|
65 |
+
),
|
66 |
+
reply_markup=InlineKeyboardMarkup(buttons),
|
67 |
+
)
|
68 |
+
|
69 |
+
|
70 |
+
@app.on_callback_query(filters.regex("settingsback_helper") & ~BANNED_USERS)
|
71 |
+
@languageCB
|
72 |
+
async def settings_back_markup(client, CallbackQuery: CallbackQuery, _):
|
73 |
+
try:
|
74 |
+
await CallbackQuery.answer()
|
75 |
+
except:
|
76 |
+
pass
|
77 |
+
if CallbackQuery.message.chat.type == ChatType.PRIVATE:
|
78 |
+
await app.resolve_peer(OWNER_ID)
|
79 |
+
OWNER = OWNER_ID
|
80 |
+
buttons = private_panel(_)
|
81 |
+
return await CallbackQuery.edit_message_text(
|
82 |
+
_["start_2"].format(CallbackQuery.from_user.mention, app.mention),
|
83 |
+
reply_markup=InlineKeyboardMarkup(buttons),
|
84 |
+
)
|
85 |
+
else:
|
86 |
+
buttons = setting_markup(_)
|
87 |
+
return await CallbackQuery.edit_message_reply_markup(
|
88 |
+
reply_markup=InlineKeyboardMarkup(buttons)
|
89 |
+
)
|
90 |
+
|
91 |
+
|
92 |
+
@app.on_callback_query(
|
93 |
+
filters.regex(
|
94 |
+
pattern=r"^(SEARCHANSWER|PLAYMODEANSWER|PLAYTYPEANSWER|AUTHANSWER|ANSWERVOMODE|VOTEANSWER|PM|AU|VM)$"
|
95 |
+
)
|
96 |
+
& ~BANNED_USERS
|
97 |
+
)
|
98 |
+
@languageCB
|
99 |
+
async def without_Admin_rights(client, CallbackQuery, _):
|
100 |
+
command = CallbackQuery.matches[0].group(1)
|
101 |
+
if command == "SEARCHANSWER":
|
102 |
+
try:
|
103 |
+
return await CallbackQuery.answer(_["setting_2"], show_alert=True)
|
104 |
+
except:
|
105 |
+
return
|
106 |
+
if command == "PLAYMODEANSWER":
|
107 |
+
try:
|
108 |
+
return await CallbackQuery.answer(_["setting_5"], show_alert=True)
|
109 |
+
except:
|
110 |
+
return
|
111 |
+
if command == "PLAYTYPEANSWER":
|
112 |
+
try:
|
113 |
+
return await CallbackQuery.answer(_["setting_6"], show_alert=True)
|
114 |
+
except:
|
115 |
+
return
|
116 |
+
if command == "AUTHANSWER":
|
117 |
+
try:
|
118 |
+
return await CallbackQuery.answer(_["setting_3"], show_alert=True)
|
119 |
+
except:
|
120 |
+
return
|
121 |
+
if command == "VOTEANSWER":
|
122 |
+
try:
|
123 |
+
return await CallbackQuery.answer(
|
124 |
+
_["setting_8"],
|
125 |
+
show_alert=True,
|
126 |
+
)
|
127 |
+
except:
|
128 |
+
return
|
129 |
+
if command == "ANSWERVOMODE":
|
130 |
+
current = await get_upvote_count(CallbackQuery.message.chat.id)
|
131 |
+
try:
|
132 |
+
return await CallbackQuery.answer(
|
133 |
+
_["setting_9"].format(current),
|
134 |
+
show_alert=True,
|
135 |
+
)
|
136 |
+
except:
|
137 |
+
return
|
138 |
+
if command == "PM":
|
139 |
+
try:
|
140 |
+
await CallbackQuery.answer(_["set_cb_2"], show_alert=True)
|
141 |
+
except:
|
142 |
+
pass
|
143 |
+
playmode = await get_playmode(CallbackQuery.message.chat.id)
|
144 |
+
if playmode == "Direct":
|
145 |
+
Direct = True
|
146 |
+
else:
|
147 |
+
Direct = None
|
148 |
+
is_non_admin = await is_nonadmin_chat(CallbackQuery.message.chat.id)
|
149 |
+
if not is_non_admin:
|
150 |
+
Group = True
|
151 |
+
else:
|
152 |
+
Group = None
|
153 |
+
playty = await get_playtype(CallbackQuery.message.chat.id)
|
154 |
+
if playty == "Everyone":
|
155 |
+
Playtype = None
|
156 |
+
else:
|
157 |
+
Playtype = True
|
158 |
+
buttons = playmode_users_markup(_, Direct, Group, Playtype)
|
159 |
+
if command == "AU":
|
160 |
+
try:
|
161 |
+
await CallbackQuery.answer(_["set_cb_1"], show_alert=True)
|
162 |
+
except:
|
163 |
+
pass
|
164 |
+
is_non_admin = await is_nonadmin_chat(CallbackQuery.message.chat.id)
|
165 |
+
if not is_non_admin:
|
166 |
+
buttons = auth_users_markup(_, True)
|
167 |
+
else:
|
168 |
+
buttons = auth_users_markup(_)
|
169 |
+
if command == "VM":
|
170 |
+
mode = await is_skipmode(CallbackQuery.message.chat.id)
|
171 |
+
current = await get_upvote_count(CallbackQuery.message.chat.id)
|
172 |
+
buttons = vote_mode_markup(_, current, mode)
|
173 |
+
try:
|
174 |
+
return await CallbackQuery.edit_message_reply_markup(
|
175 |
+
reply_markup=InlineKeyboardMarkup(buttons)
|
176 |
+
)
|
177 |
+
except MessageNotModified:
|
178 |
+
return
|
179 |
+
|
180 |
+
|
181 |
+
@app.on_callback_query(filters.regex("FERRARIUDTI") & ~BANNED_USERS)
|
182 |
+
@ActualAdminCB
|
183 |
+
async def addition(client, CallbackQuery, _):
|
184 |
+
callback_data = CallbackQuery.data.strip()
|
185 |
+
mode = callback_data.split(None, 1)[1]
|
186 |
+
if not await is_skipmode(CallbackQuery.message.chat.id):
|
187 |
+
return await CallbackQuery.answer(_["setting_10"], show_alert=True)
|
188 |
+
current = await get_upvote_count(CallbackQuery.message.chat.id)
|
189 |
+
if mode == "M":
|
190 |
+
final = current - 2
|
191 |
+
print(final)
|
192 |
+
if final == 0:
|
193 |
+
return await CallbackQuery.answer(
|
194 |
+
_["setting_11"],
|
195 |
+
show_alert=True,
|
196 |
+
)
|
197 |
+
if final <= 2:
|
198 |
+
final = 2
|
199 |
+
await set_upvotes(CallbackQuery.message.chat.id, final)
|
200 |
+
else:
|
201 |
+
final = current + 2
|
202 |
+
print(final)
|
203 |
+
if final == 17:
|
204 |
+
return await CallbackQuery.answer(
|
205 |
+
_["setting_12"],
|
206 |
+
show_alert=True,
|
207 |
+
)
|
208 |
+
if final >= 15:
|
209 |
+
final = 15
|
210 |
+
await set_upvotes(CallbackQuery.message.chat.id, final)
|
211 |
+
buttons = vote_mode_markup(_, final, True)
|
212 |
+
try:
|
213 |
+
return await CallbackQuery.edit_message_reply_markup(
|
214 |
+
reply_markup=InlineKeyboardMarkup(buttons)
|
215 |
+
)
|
216 |
+
except MessageNotModified:
|
217 |
+
return
|
218 |
+
|
219 |
+
|
220 |
+
@app.on_callback_query(
|
221 |
+
filters.regex(pattern=r"^(MODECHANGE|CHANNELMODECHANGE|PLAYTYPECHANGE)$")
|
222 |
+
& ~BANNED_USERS
|
223 |
+
)
|
224 |
+
@ActualAdminCB
|
225 |
+
async def playmode_ans(client, CallbackQuery, _):
|
226 |
+
command = CallbackQuery.matches[0].group(1)
|
227 |
+
if command == "CHANNELMODECHANGE":
|
228 |
+
is_non_admin = await is_nonadmin_chat(CallbackQuery.message.chat.id)
|
229 |
+
if not is_non_admin:
|
230 |
+
await add_nonadmin_chat(CallbackQuery.message.chat.id)
|
231 |
+
Group = None
|
232 |
+
else:
|
233 |
+
await remove_nonadmin_chat(CallbackQuery.message.chat.id)
|
234 |
+
Group = True
|
235 |
+
playmode = await get_playmode(CallbackQuery.message.chat.id)
|
236 |
+
if playmode == "Direct":
|
237 |
+
Direct = True
|
238 |
+
else:
|
239 |
+
Direct = None
|
240 |
+
playty = await get_playtype(CallbackQuery.message.chat.id)
|
241 |
+
if playty == "Everyone":
|
242 |
+
Playtype = None
|
243 |
+
else:
|
244 |
+
Playtype = True
|
245 |
+
buttons = playmode_users_markup(_, Direct, Group, Playtype)
|
246 |
+
if command == "MODECHANGE":
|
247 |
+
try:
|
248 |
+
await CallbackQuery.answer(_["set_cb_3"], show_alert=True)
|
249 |
+
except:
|
250 |
+
pass
|
251 |
+
playmode = await get_playmode(CallbackQuery.message.chat.id)
|
252 |
+
if playmode == "Direct":
|
253 |
+
await set_playmode(CallbackQuery.message.chat.id, "Inline")
|
254 |
+
Direct = None
|
255 |
+
else:
|
256 |
+
await set_playmode(CallbackQuery.message.chat.id, "Direct")
|
257 |
+
Direct = True
|
258 |
+
is_non_admin = await is_nonadmin_chat(CallbackQuery.message.chat.id)
|
259 |
+
if not is_non_admin:
|
260 |
+
Group = True
|
261 |
+
else:
|
262 |
+
Group = None
|
263 |
+
playty = await get_playtype(CallbackQuery.message.chat.id)
|
264 |
+
if playty == "Everyone":
|
265 |
+
Playtype = False
|
266 |
+
else:
|
267 |
+
Playtype = True
|
268 |
+
buttons = playmode_users_markup(_, Direct, Group, Playtype)
|
269 |
+
if command == "PLAYTYPECHANGE":
|
270 |
+
try:
|
271 |
+
await CallbackQuery.answer(_["set_cb_3"], show_alert=True)
|
272 |
+
except:
|
273 |
+
pass
|
274 |
+
playty = await get_playtype(CallbackQuery.message.chat.id)
|
275 |
+
if playty == "Everyone":
|
276 |
+
await set_playtype(CallbackQuery.message.chat.id, "Admin")
|
277 |
+
Playtype = False
|
278 |
+
else:
|
279 |
+
await set_playtype(CallbackQuery.message.chat.id, "Everyone")
|
280 |
+
Playtype = True
|
281 |
+
playmode = await get_playmode(CallbackQuery.message.chat.id)
|
282 |
+
if playmode == "Direct":
|
283 |
+
Direct = True
|
284 |
+
else:
|
285 |
+
Direct = None
|
286 |
+
is_non_admin = await is_nonadmin_chat(CallbackQuery.message.chat.id)
|
287 |
+
if not is_non_admin:
|
288 |
+
Group = True
|
289 |
+
else:
|
290 |
+
Group = None
|
291 |
+
buttons = playmode_users_markup(_, Direct, Group, Playtype)
|
292 |
+
try:
|
293 |
+
return await CallbackQuery.edit_message_reply_markup(
|
294 |
+
reply_markup=InlineKeyboardMarkup(buttons)
|
295 |
+
)
|
296 |
+
except MessageNotModified:
|
297 |
+
return
|
298 |
+
|
299 |
+
|
300 |
+
@app.on_callback_query(filters.regex(pattern=r"^(AUTH|AUTHLIST)$") & ~BANNED_USERS)
|
301 |
+
@ActualAdminCB
|
302 |
+
async def authusers_mar(client, CallbackQuery, _):
|
303 |
+
command = CallbackQuery.matches[0].group(1)
|
304 |
+
if command == "AUTHLIST":
|
305 |
+
_authusers = await get_authuser_names(CallbackQuery.message.chat.id)
|
306 |
+
if not _authusers:
|
307 |
+
try:
|
308 |
+
return await CallbackQuery.answer(_["setting_4"], show_alert=True)
|
309 |
+
except:
|
310 |
+
return
|
311 |
+
else:
|
312 |
+
try:
|
313 |
+
await CallbackQuery.answer(_["set_cb_4"], show_alert=True)
|
314 |
+
except:
|
315 |
+
pass
|
316 |
+
j = 0
|
317 |
+
await CallbackQuery.edit_message_text(_["auth_6"])
|
318 |
+
msg = _["auth_7"].format(CallbackQuery.message.chat.title)
|
319 |
+
for note in _authusers:
|
320 |
+
_note = await get_authuser(CallbackQuery.message.chat.id, note)
|
321 |
+
user_id = _note["auth_user_id"]
|
322 |
+
admin_id = _note["admin_id"]
|
323 |
+
admin_name = _note["admin_name"]
|
324 |
+
try:
|
325 |
+
user = await app.get_users(user_id)
|
326 |
+
user = user.first_name
|
327 |
+
j += 1
|
328 |
+
except:
|
329 |
+
continue
|
330 |
+
msg += f"{j}➤ {user}[<code>{user_id}</code>]\n"
|
331 |
+
msg += f" {_['auth_8']} {admin_name}[<code>{admin_id}</code>]\n\n"
|
332 |
+
upl = InlineKeyboardMarkup(
|
333 |
+
[
|
334 |
+
[
|
335 |
+
InlineKeyboardButton(
|
336 |
+
text=_["BACK_BUTTON"], callback_data=f"AU"
|
337 |
+
),
|
338 |
+
InlineKeyboardButton(
|
339 |
+
text=_["CLOSE_BUTTON"],
|
340 |
+
callback_data=f"close",
|
341 |
+
),
|
342 |
+
]
|
343 |
+
]
|
344 |
+
)
|
345 |
+
try:
|
346 |
+
return await CallbackQuery.edit_message_text(msg, reply_markup=upl)
|
347 |
+
except MessageNotModified:
|
348 |
+
return
|
349 |
+
try:
|
350 |
+
await CallbackQuery.answer(_["set_cb_3"], show_alert=True)
|
351 |
+
except:
|
352 |
+
pass
|
353 |
+
if command == "AUTH":
|
354 |
+
is_non_admin = await is_nonadmin_chat(CallbackQuery.message.chat.id)
|
355 |
+
if not is_non_admin:
|
356 |
+
await add_nonadmin_chat(CallbackQuery.message.chat.id)
|
357 |
+
buttons = auth_users_markup(_)
|
358 |
+
else:
|
359 |
+
await remove_nonadmin_chat(CallbackQuery.message.chat.id)
|
360 |
+
buttons = auth_users_markup(_, True)
|
361 |
+
try:
|
362 |
+
return await CallbackQuery.edit_message_reply_markup(
|
363 |
+
reply_markup=InlineKeyboardMarkup(buttons)
|
364 |
+
)
|
365 |
+
except MessageNotModified:
|
366 |
+
return
|
367 |
+
|
368 |
+
|
369 |
+
@app.on_callback_query(filters.regex("VOMODECHANGE") & ~BANNED_USERS)
|
370 |
+
@ActualAdminCB
|
371 |
+
async def vote_change(client, CallbackQuery, _):
|
372 |
+
command = CallbackQuery.matches[0].group(1)
|
373 |
+
try:
|
374 |
+
await CallbackQuery.answer(_["set_cb_3"], show_alert=True)
|
375 |
+
except:
|
376 |
+
pass
|
377 |
+
mod = None
|
378 |
+
if await is_skipmode(CallbackQuery.message.chat.id):
|
379 |
+
await skip_off(CallbackQuery.message.chat.id)
|
380 |
+
else:
|
381 |
+
mod = True
|
382 |
+
await skip_on(CallbackQuery.message.chat.id)
|
383 |
+
current = await get_upvote_count(CallbackQuery.message.chat.id)
|
384 |
+
buttons = vote_mode_markup(_, current, mod)
|
385 |
+
|
386 |
+
try:
|
387 |
+
return await CallbackQuery.edit_message_reply_markup(
|
388 |
+
reply_markup=InlineKeyboardMarkup(buttons)
|
389 |
+
)
|
390 |
+
except MessageNotModified:
|
391 |
+
return
|
DragMusic/plugins/bot/start.py
ADDED
@@ -0,0 +1,169 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import time
|
2 |
+
from pyrogram import filters
|
3 |
+
from pyrogram.enums import ChatType
|
4 |
+
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
|
5 |
+
from youtubesearchpython.__future__ import VideosSearch
|
6 |
+
|
7 |
+
import config
|
8 |
+
from DragMusic import app
|
9 |
+
from DragMusic.misc import _boot_
|
10 |
+
from DragMusic.plugins.sudo.sudoers import sudoers_list
|
11 |
+
from DragMusic.utils.database import (
|
12 |
+
add_served_chat,
|
13 |
+
add_served_user,
|
14 |
+
blacklisted_chats,
|
15 |
+
get_lang,
|
16 |
+
is_banned_user,
|
17 |
+
is_on_off,
|
18 |
+
)
|
19 |
+
from DragMusic.utils.formatters import get_readable_time
|
20 |
+
from DragMusic.utils.inline import help_pannel, private_panel, start_panel
|
21 |
+
from config import BANNED_USERS, LOGGER_ID
|
22 |
+
from strings import get_string # Import get_string at the top
|
23 |
+
|
24 |
+
@app.on_message(filters.command(["start"]) & filters.private & ~BANNED_USERS)
|
25 |
+
async def start_pm(client, message: Message):
|
26 |
+
await add_served_user(message.from_user.id)
|
27 |
+
|
28 |
+
language = await get_lang(message.chat.id) # Get language inside the function
|
29 |
+
_ = get_string(language) # Get the translation object
|
30 |
+
|
31 |
+
if len(message.text.split()) > 1:
|
32 |
+
name = message.text.split(None, 1)[1]
|
33 |
+
if name[0:4] == "help":
|
34 |
+
keyboard = help_pannel(_)
|
35 |
+
await message.reply_sticker("CAACAgEAAxkBAAJYdWZLJQqyG4fMdFFHFbTZDZPczqfnAAJUAgACODjZR-6jaMt58aQENQQ")
|
36 |
+
return await message.reply_video(
|
37 |
+
video="https://files.catbox.moe/l372oy.mp4",
|
38 |
+
caption=_["help_1"].format(config.SUPPORT_CHAT),
|
39 |
+
reply_markup=keyboard,
|
40 |
+
)
|
41 |
+
elif name[0:3] == "sud": # Example: Handling sudo
|
42 |
+
await sudoers_list(client=client, message=message, _=_)
|
43 |
+
if await is_on_off(2):
|
44 |
+
await app.send_message(
|
45 |
+
chat_id=LOGGER_ID,
|
46 |
+
text=f"{message.from_user.mention} ᴊᴜsᴛ sᴛᴀʀᴛᴇᴅ ᴛʜᴇ ʙᴏᴛ ᴛᴏ ᴄʜᴇᴄᴋ <b>sᴜᴅᴏʟɪsᴛ</b>.\n\n<b>ᴜsᴇʀ ɪᴅ :</b> <code>{message.from_user.id}</code>\n<b>ᴜsᴇʀɴᴀᴍᴇ :</b> @{message.from_user.username}",
|
47 |
+
message_thread_id=12327 # Send to the specific thread
|
48 |
+
)
|
49 |
+
return
|
50 |
+
elif name[0:3] == "inf": # Example: Handling info
|
51 |
+
m = await message.reply_text("🔎")
|
52 |
+
query = (str(name)).replace("info_", "", 1)
|
53 |
+
query = f"https://www.youtube.com/watch?v={query}"
|
54 |
+
results = VideosSearch(query, limit=1)
|
55 |
+
for result in (await results.next())["result"]:
|
56 |
+
title = result["title"]
|
57 |
+
duration = result["duration"]
|
58 |
+
views = result["viewCount"]["short"]
|
59 |
+
thumbnail = result["thumbnails"][0]["url"].split("?")[0]
|
60 |
+
channellink = result["channel"]["link"]
|
61 |
+
channel = result["channel"]["name"]
|
62 |
+
link = result["link"]
|
63 |
+
published = result["publishedTime"]
|
64 |
+
searched_text = _["start_6"].format(
|
65 |
+
title, duration, views, published, channellink, channel, app.mention
|
66 |
+
)
|
67 |
+
key = InlineKeyboardMarkup(
|
68 |
+
[
|
69 |
+
[
|
70 |
+
InlineKeyboardButton(text=_["S_B_8"], url=link),
|
71 |
+
InlineKeyboardButton(text=_["S_B_9"], url=config.SUPPORT_CHAT),
|
72 |
+
],
|
73 |
+
]
|
74 |
+
)
|
75 |
+
await m.delete()
|
76 |
+
await app.send_photo(
|
77 |
+
chat_id=message.chat.id,
|
78 |
+
photo=thumbnail,
|
79 |
+
caption=searched_text,
|
80 |
+
reply_markup=key,
|
81 |
+
)
|
82 |
+
if await is_on_off(2):
|
83 |
+
await app.send_message(
|
84 |
+
chat_id=LOGGER_ID,
|
85 |
+
text=f"{message.from_user.mention} ᴊᴜsᴛ sᴛᴀʀᴛᴇᴅ ᴛʜᴇ ʙᴏᴛ ᴛᴏ ᴄʜᴇᴄᴋ <b>ᴛʀᴀᴄᴋ ɪɴғᴏʀᴍᴀᴛɪᴏɴ</b>.\n\n<b>ᴜsᴇʀ ɪᴅ :</b> <code>{message.from_user.id}</code>\n<b>ᴜsᴇʀɴᴀᴍᴇ :</b> @{message.from_user.username}",
|
86 |
+
message_thread_id=12327 # Send to the specific thread
|
87 |
+
)
|
88 |
+
return
|
89 |
+
|
90 |
+
else:
|
91 |
+
out = private_panel(_)
|
92 |
+
await message.reply_sticker("CAACAgEAAxkBAAJYdWZLJQqyG4fMdFFHFbTZDZPczqfnAAJUAgACODjZR-6jaMt58aQENQQ")
|
93 |
+
await message.reply_video(
|
94 |
+
video="https://telegra.ph/file/d2532972423ce5c4b632e.mp4",
|
95 |
+
caption=_["start_2"].format(message.from_user.mention, app.mention),
|
96 |
+
reply_markup=InlineKeyboardMarkup(out),
|
97 |
+
)
|
98 |
+
if await is_on_off(2):
|
99 |
+
await app.send_message(
|
100 |
+
chat_id=LOGGER_ID,
|
101 |
+
text=f"{message.from_user.mention} ᴊᴜsᴛ sᴛᴀʀᴛᴇᴅ ᴛʜᴇ ʙᴏᴛ.\n\n<b>ᴜsᴇʀ ɪᴅ :</b> <code>{message.from_user.id}</code>\n<b>ᴜsᴇʀɴᴀᴍᴇ :</b> @{message.from_user.username}",
|
102 |
+
message_thread_id=12327 # Send to the specific thread
|
103 |
+
)
|
104 |
+
|
105 |
+
@app.on_message(filters.command(["start"]) & filters.group & ~BANNED_USERS)
|
106 |
+
async def start_gp(client, message: Message):
|
107 |
+
language = await get_lang(message.chat.id) # Get language inside the function
|
108 |
+
_ = get_string(language) # Get the translation object
|
109 |
+
|
110 |
+
out = start_panel(_)
|
111 |
+
uptime = int(time.time() - _boot_)
|
112 |
+
await message.reply_video(
|
113 |
+
video="https://telegra.ph/file/d2532972423ce5c4b632e.mp4",
|
114 |
+
caption=_["start_1"].format(app.mention, get_readable_time(uptime)),
|
115 |
+
reply_markup=InlineKeyboardMarkup(out),
|
116 |
+
)
|
117 |
+
await add_served_chat(message.chat.id)
|
118 |
+
if await is_on_off(2):
|
119 |
+
await app.send_message(
|
120 |
+
chat_id=LOGGER_ID,
|
121 |
+
text=f"{message.from_user.mention} ᴊᴜsᴛ sᴛᴀʀᴛᴇᴅ ᴛʜᴇ ʙᴏᴛ ɪɴ ᴀ ɢʀᴏᴜᴘ.\n\n<b>ᴜsᴇʀ ɪᴅ :</b> <code>{message.from_user.id}</code>\n<b>ᴜsᴇʀɴᴀᴍᴇ :</b> @{message.from_user.username}",
|
122 |
+
message_thread_id=12327 # Send to the specific thread
|
123 |
+
)
|
124 |
+
|
125 |
+
@app.on_message(filters.new_chat_members, group=-1)
|
126 |
+
async def welcome(client, message: Message):
|
127 |
+
for member in message.new_chat_members:
|
128 |
+
try:
|
129 |
+
language = await get_lang(message.chat.id)
|
130 |
+
_ = get_string(language)
|
131 |
+
if await is_banned_user(member.id):
|
132 |
+
await message.chat.ban_member(member.id)
|
133 |
+
continue
|
134 |
+
if member.id == app.id:
|
135 |
+
if message.chat.type != ChatType.SUPERGROUP:
|
136 |
+
await message.reply_text(_["start_4"])
|
137 |
+
return await app.leave_chat(message.chat.id)
|
138 |
+
if message.chat.id in await blacklisted_chats():
|
139 |
+
await message.reply_text(
|
140 |
+
_["start_5"].format(
|
141 |
+
app.mention,
|
142 |
+
f"https://t.me/{app.username}?start=sudolist",
|
143 |
+
config.SUPPORT_CHAT,
|
144 |
+
),
|
145 |
+
disable_web_page_preview=True,
|
146 |
+
)
|
147 |
+
return await app.leave_chat(message.chat.id)
|
148 |
+
|
149 |
+
out = start_panel(_)
|
150 |
+
await message.reply_video(
|
151 |
+
video="https://telegra.ph/file/d2532972423ce5c4b632e.mp4",
|
152 |
+
caption=_["start_3"].format(
|
153 |
+
message.from_user.first_name,
|
154 |
+
app.mention,
|
155 |
+
message.chat.title,
|
156 |
+
app.mention,
|
157 |
+
),
|
158 |
+
reply_markup=InlineKeyboardMarkup(out),
|
159 |
+
)
|
160 |
+
await add_served_chat(message.chat.id)
|
161 |
+
if await is_on_off(2):
|
162 |
+
await app.send_message(
|
163 |
+
chat_id=LOGGER_ID,
|
164 |
+
text=f"{member.mention} ᴊᴜsᴛ ᴊᴏɪɴᴇᴅ ᴛʜᴇ ᴄʜᴀᴛ.\n\n<b>ᴜsᴇʀ ɪᴅ :</b> <code>{member.id}</code>\n<b>ᴜsᴇʀɴᴀᴍᴇ :</b> @{member.username}",
|
165 |
+
message_thread_id=12327 # Send to the specific thread
|
166 |
+
)
|
167 |
+
await message.stop_propagation()
|
168 |
+
except Exception as ex:
|
169 |
+
print(ex)
|
DragMusic/plugins/goodnight.py
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import re
|
2 |
+
from dotenv import load_dotenv
|
3 |
+
from pyrogram import filters
|
4 |
+
import random
|
5 |
+
from pyrogram.types import Message
|
6 |
+
from pyrogram import Client, filters
|
7 |
+
from DragMusic import app
|
8 |
+
|
9 |
+
|
10 |
+
|
11 |
+
# "/gn" command ka handler
|
12 |
+
@app.on_message(filters.command("oodnight", prefixes="g"))
|
13 |
+
def goodnight_command_handler(client: Client, message: Message):
|
14 |
+
# Randomly decide whether to send a sticker or an emoji
|
15 |
+
send_sticker = random.choice([True, False])
|
16 |
+
|
17 |
+
# Send a sticker or an emoji based on the random choice
|
18 |
+
if send_sticker:
|
19 |
+
client.send_sticker(message.chat.id, get_random_sticker())
|
20 |
+
else:
|
21 |
+
client.send_message(message.chat.id, get_random_emoji())
|
22 |
+
|
23 |
+
# Function to get a random sticker
|
24 |
+
def get_random_sticker():
|
25 |
+
stickers = [
|
26 |
+
"CAACAgQAAx0Ce9_hCAACaEVlwn7HeZhgwyVfKHc3WUGC_447IAACLgwAAkQwKVPtub8VAR018x4E",
|
27 |
+
"CAACAgIAAx0Ce9_hCAACaEplwn7dvj7G0-a1v3wlbN281RMX2QACUgwAAligOUoi7DhLVTsNsh4E",
|
28 |
+
"CAACAgIAAx0Ce9_hCAACaFBlwn8AAZNB9mOUvz5oAyM7CT-5pjAAAtEKAALa7NhLvbTGyDLbe1IeBA",
|
29 |
+
"CAACAgUAAx0CcmOuMwACldVlwn9ZHHF2-S-CuMSYabwwtVGC3AACOAkAAoqR2VYDjyK6OOr_Px4E",
|
30 |
+
"CAACAgIAAx0Ce9_hCAACaFVlwn-fG58GKoEmmZpVovxEj4PodAACfwwAAqozQUrt2xSTf5Ac4h4E",
|
31 |
+
]
|
32 |
+
return random.choice(stickers)
|
33 |
+
|
34 |
+
# Function to get a random emoji
|
35 |
+
def get_random_emoji():
|
36 |
+
emojis = [
|
37 |
+
"😴",
|
38 |
+
"😪",
|
39 |
+
"💤",
|
40 |
+
|
41 |
+
]
|
42 |
+
return random.choice(emojis)
|
DragMusic/plugins/misc/autoleave.py
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import asyncio
|
2 |
+
from datetime import datetime
|
3 |
+
|
4 |
+
from pyrogram.enums import ChatType
|
5 |
+
|
6 |
+
import config
|
7 |
+
from DragMusic import app
|
8 |
+
from DragMusic.core.call import Drag, autoend
|
9 |
+
from DragMusic.utils.database import get_client, is_active_chat, is_autoend
|
10 |
+
|
11 |
+
|
12 |
+
async def auto_leave():
|
13 |
+
if config.AUTO_LEAVING_ASSISTANT:
|
14 |
+
while not await asyncio.sleep(900):
|
15 |
+
from DragMusic.core.userbot import assistants
|
16 |
+
|
17 |
+
for num in assistants:
|
18 |
+
client = await get_client(num)
|
19 |
+
left = 0
|
20 |
+
try:
|
21 |
+
async for i in client.get_dialogs():
|
22 |
+
if i.chat.type in [
|
23 |
+
ChatType.SUPERGROUP,
|
24 |
+
ChatType.GROUP,
|
25 |
+
ChatType.CHANNEL,
|
26 |
+
]:
|
27 |
+
if (
|
28 |
+
i.chat.id != config.LOGGER_ID
|
29 |
+
and i.chat.id != -1001686672798
|
30 |
+
and i.chat.id != -1001549206010
|
31 |
+
):
|
32 |
+
if left == 20:
|
33 |
+
continue
|
34 |
+
if not await is_active_chat(i.chat.id):
|
35 |
+
try:
|
36 |
+
await client.leave_chat(i.chat.id)
|
37 |
+
left += 1
|
38 |
+
except:
|
39 |
+
continue
|
40 |
+
except:
|
41 |
+
pass
|
42 |
+
|
43 |
+
|
44 |
+
asyncio.create_task(auto_leave())
|
45 |
+
|
46 |
+
|
47 |
+
async def auto_end():
|
48 |
+
while not await asyncio.sleep(5):
|
49 |
+
ender = await is_autoend()
|
50 |
+
if not ender:
|
51 |
+
continue
|
52 |
+
for chat_id in autoend:
|
53 |
+
timer = autoend.get(chat_id)
|
54 |
+
if not timer:
|
55 |
+
continue
|
56 |
+
if datetime.now() > timer:
|
57 |
+
if not await is_active_chat(chat_id):
|
58 |
+
autoend[chat_id] = {}
|
59 |
+
continue
|
60 |
+
autoend[chat_id] = {}
|
61 |
+
try:
|
62 |
+
await Drag.stop_stream(chat_id)
|
63 |
+
except:
|
64 |
+
continue
|
65 |
+
try:
|
66 |
+
await app.send_message(
|
67 |
+
chat_id,
|
68 |
+
"» ʙᴏᴛ ᴀᴜᴛᴏᴍᴀᴛɪᴄᴀʟʟʏ ʟᴇғᴛ ᴠɪᴅᴇᴏᴄʜᴀᴛ ʙᴇᴄᴀᴜsᴇ ɴᴏ ᴏɴᴇ ᴡᴀs ʟɪsᴛᴇɴɪɴɢ ᴏɴ ᴠɪᴅᴇᴏᴄʜᴀᴛ.",
|
69 |
+
)
|
70 |
+
except:
|
71 |
+
continue
|
72 |
+
|
73 |
+
|
74 |
+
asyncio.create_task(auto_end())
|