SONALI
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- Dockerfiler +18 -0
- Procfile +1 -0
- SONALI/__init__.py +28 -0
- SONALI/__main__.py +52 -0
- SONALI/assets/__init__.py +1 -0
- SONALI/assets/cookies.txt +25 -0
- SONALI/assets/cppic.png +0 -0
- SONALI/assets/default.ttf +0 -0
- SONALI/assets/font.ttf +0 -0
- SONALI/assets/font2.ttf +0 -0
- SONALI/assets/hiroko.ttf +0 -0
- SONALI/assets/img01.png +0 -0
- SONALI/assets/img02.png +0 -0
- SONALI/assets/img03.png +0 -0
- SONALI/assets/img04.png +0 -0
- SONALI/assets/upic.png +0 -0
- SONALI/assets/userinfo.png +0 -0
- SONALI/core/bot.py +52 -0
- SONALI/core/call.py +611 -0
- SONALI/core/dir.py +20 -0
- SONALI/core/git.py +71 -0
- SONALI/core/mongo.py +34 -0
- SONALI/core/userbot.py +170 -0
- SONALI/logging.py +19 -0
- SONALI/misc.py +75 -0
- SONALI/mongo/afkdb.py +34 -0
- SONALI/mongo/couples_db.py +36 -0
- SONALI/mongo/filtersdb.py +123 -0
- SONALI/mongo/nightmodedb.py +25 -0
- SONALI/mongo/notesdb.py +221 -0
- SONALI/mongo/readable_time.py +23 -0
- SONALI/platforms/Apple.py +71 -0
- SONALI/platforms/Carbon.py +106 -0
- SONALI/platforms/Resso.py +54 -0
- SONALI/platforms/Soundcloud.py +39 -0
- SONALI/platforms/Spotify.py +98 -0
- SONALI/platforms/Telegram.py +176 -0
- SONALI/platforms/Youtube.py +353 -0
- SONALI/platforms/__init__.py +7 -0
- SONALI/plugins/__init__.py +19 -0
- SONALI/plugins/admins/assistant.py +174 -0
- SONALI/plugins/admins/auth.py +89 -0
- SONALI/plugins/admins/ban.py +420 -0
- SONALI/plugins/admins/callback.py +423 -0
- SONALI/plugins/admins/connection.py +20 -0
- SONALI/plugins/admins/gmtag.py +234 -0
- SONALI/plugins/admins/hitag.py +342 -0
- SONALI/plugins/admins/loop.py +46 -0
- SONALI/plugins/admins/mention.py +69 -0
- SONALI/plugins/admins/pause.py +21 -0
Dockerfiler
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 pip redis fastapi nest-asyncio uvicorn && \
|
| 11 |
+
pip3 install --no-cache-dir -r requirements.txt
|
| 12 |
+
RUN touch log.txt
|
| 13 |
+
RUN chown -R 1000:0 /app /usr && \
|
| 14 |
+
chmod -R 755 /app /usr && \
|
| 15 |
+
chmod 777 /app/log.txt && \
|
| 16 |
+
chmod +x /app/start.sh
|
| 17 |
+
|
| 18 |
+
CMD bash start.sh
|
Procfile
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
worker: bash start.sh
|
SONALI/__init__.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from SONALI.core.bot import RAUSHAN
|
| 2 |
+
from SONALI.core.dir import dirr
|
| 3 |
+
from SONALI.core.git import git
|
| 4 |
+
from SONALI.core.userbot import Userbot
|
| 5 |
+
from SONALI.misc import dbb, heroku
|
| 6 |
+
|
| 7 |
+
from SafoneAPI import SafoneAPI
|
| 8 |
+
from .logging import LOGGER
|
| 9 |
+
|
| 10 |
+
dirr()
|
| 11 |
+
git()
|
| 12 |
+
dbb()
|
| 13 |
+
heroku()
|
| 14 |
+
|
| 15 |
+
app = RAUSHAN()
|
| 16 |
+
api = SafoneAPI()
|
| 17 |
+
userbot = Userbot()
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
from .platforms import *
|
| 21 |
+
|
| 22 |
+
Apple = AppleAPI()
|
| 23 |
+
Carbon = CarbonAPI()
|
| 24 |
+
SoundCloud = SoundAPI()
|
| 25 |
+
Spotify = SpotifyAPI()
|
| 26 |
+
Resso = RessoAPI()
|
| 27 |
+
Telegram = TeleAPI()
|
| 28 |
+
YouTube = YouTubeAPI()
|
SONALI/__main__.py
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import asyncio
|
| 2 |
+
import importlib
|
| 3 |
+
|
| 4 |
+
from pyrogram import idle
|
| 5 |
+
|
| 6 |
+
import config
|
| 7 |
+
from SONALI import LOGGER, app, userbot
|
| 8 |
+
from SONALI.core.call import RAUSHAN
|
| 9 |
+
from SONALI.misc import sudo
|
| 10 |
+
from SONALI.plugins import ALL_MODULES
|
| 11 |
+
from SONALI.utils.database import get_banned_users, get_gbanned
|
| 12 |
+
from config import BANNED_USERS
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
async def init():
|
| 16 |
+
if (
|
| 17 |
+
not config.STRING1
|
| 18 |
+
and not config.STRING2
|
| 19 |
+
and not config.STRING3
|
| 20 |
+
and not config.STRING4
|
| 21 |
+
and not config.STRING5
|
| 22 |
+
):
|
| 23 |
+
LOGGER(__name__).error(
|
| 24 |
+
"𝐒𝐭𝐫𝐢𝐧𝐠 𝐒𝐞𝐬𝐬𝐢𝐨𝐧 𝐍𝐨𝐭 𝐅𝐢𝐥𝐥𝐞𝐝, 𝐏𝐥𝐞𝐚𝐬𝐞 𝐅𝐢𝐥𝐥 𝐀 𝐏𝐲𝐫𝐨𝐠𝐫𝐚𝐦 V2 𝐒𝐞𝐬𝐬𝐢𝐨𝐧🤬"
|
| 25 |
+
)
|
| 26 |
+
|
| 27 |
+
await sudo()
|
| 28 |
+
try:
|
| 29 |
+
users = await get_gbanned()
|
| 30 |
+
for user_id in users:
|
| 31 |
+
BANNED_USERS.add(user_id)
|
| 32 |
+
users = await get_banned_users()
|
| 33 |
+
for user_id in users:
|
| 34 |
+
BANNED_USERS.add(user_id)
|
| 35 |
+
except:
|
| 36 |
+
pass
|
| 37 |
+
await app.start()
|
| 38 |
+
for all_module in ALL_MODULES:
|
| 39 |
+
importlib.import_module("SONALI.plugins" + all_module)
|
| 40 |
+
LOGGER("SONALI.plugins").info("𝐀𝐥𝐥 𝐅𝐞𝐚𝐭𝐮𝐫𝐞𝐬 𝐋𝐨𝐚𝐝𝐞𝐝 𝐁𝐚𝐛𝐲🥳...")
|
| 41 |
+
await userbot.start()
|
| 42 |
+
await RAUSHAN.start()
|
| 43 |
+
await RAUSHAN.decorators()
|
| 44 |
+
LOGGER("SONALI").info("╔═════ஜ۩۞۩ஜ════╗\n ♨️𝗠𝗔𝗗𝗘 𝗕𝗬 𝗔𝗟𝗣𝗛𝗔♨️\n╚═════ஜ۩۞۩ஜ════╝")
|
| 45 |
+
await idle()
|
| 46 |
+
await app.stop()
|
| 47 |
+
await userbot.stop()
|
| 48 |
+
LOGGER("SONALI").info("╔═════ஜ۩۞۩ஜ════╗\n ♨️𝗠𝗔𝗗𝗘 𝗕𝗬 𝗔𝗟𝗣𝗛𝗔♨️\n╚═════ஜ۩۞۩ஜ════╝")
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
if __name__ == "__main__":
|
| 52 |
+
asyncio.get_event_loop().run_until_complete(init())
|
SONALI/assets/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
|
SONALI/assets/cookies.txt
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Netscape HTTP Cookie File
|
| 2 |
+
# This is a generated file! Do not edit.
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
# domain include_subdomains path secure expiration_date name value
|
| 6 |
+
.youtube.com TRUE / TRUE 1755081301 __Secure-1PSIDCC AKEyXzWnN2YQ0_PWGBmMjxqrsoaekT_2ni7t5Wq5Whr5OoQfo_SKV4q9sYQV4uhRAl_OXUUehg
|
| 7 |
+
.youtube.com TRUE / TRUE 1758105276 SAPISID hFE5YhFmEMSZdF-y/AAhea3c1tEyJzs3Q8
|
| 8 |
+
.youtube.com TRUE / FALSE 1758105276 APISID UvyoylXNGRrsaluK/ASLoQHn2GmFgpo7Go
|
| 9 |
+
.youtube.com TRUE / TRUE 1758105276 SSID AoVOWI6B5FiL0ioXZ
|
| 10 |
+
.youtube.com TRUE / TRUE 1758105276 __Secure-3PAPISID hFE5YhFmEMSZdF-y/AAhea3c1tEyJzs3Q8
|
| 11 |
+
.youtube.com TRUE / TRUE 1758105276 __Secure-1PSID g.a000mwhDYyK9e4tYnSGx58xB6DUJNnNjjASDPnsmeOYQERKoOC8ivN5I65nvuxRnGEody5oQUgACgYKAakSAQASFQHGX2MiTogTyNlEPHaA71bxlO00mBoVAUF8yKqoAzCJR3St86ZEQp_cTUJn0076
|
| 12 |
+
.youtube.com TRUE / FALSE 1755081301 SIDCC AKEyXzU-XdNCJObqVW-i9xoUiwL-ZdcibXsgxVnlmDzcBC7igAKmVHLnS1dAI4tNAbMnWj-tsQ
|
| 13 |
+
.youtube.com TRUE / TRUE 1758105276 __Secure-3PSID g.a000mwhDYyK9e4tYnSGx58xB6DUJNnNjjASDPnsmeOYQERKoOC8imy8f3F1UfGTedsvywuoTnAACgYKAUUSAQASFQHGX2Miphog2ezY2N_pSTZWsFYjQRoVAUF8yKp0dkhu9XchIx9OnhAONyiF0076
|
| 14 |
+
.youtube.com TRUE / TRUE 1755081276 __Secure-1PSIDTS sidts-CjIBUFGoh7WbiothjuxyN60zy_Pedcyl4kfvAJKV3c32dTm7zYXanzyEOhwWhODOKshGhRAA
|
| 15 |
+
.youtube.com TRUE / FALSE 1758105276 HSID AyDZPVGkPJGNfTZie
|
| 16 |
+
.youtube.com TRUE / TRUE 1758105277 PREF tz=UTC
|
| 17 |
+
.youtube.com TRUE / TRUE 1739097161 VISITOR_PRIVACY_METADATA CgJJThIEGgAgSg%3D%3D
|
| 18 |
+
.youtube.com TRUE / TRUE 1755081276 __Secure-3PSIDTS sidts-CjIBUFGoh7WbiothjuxyN60zy_Pedcyl4kfvAJKV3c32dTm7zYXanzyEOhwWhODOKshGhRAA
|
| 19 |
+
.youtube.com TRUE / TRUE 1739097161 VISITOR_INFO1_LIVE GeaSv8tro24
|
| 20 |
+
.youtube.com TRUE / TRUE 1755081301 __Secure-3PSIDCC AKEyXzXrIm0hlAovjNtVtphR6Z-mPIVm9ZlpYGXs2CxO1qvsvIg-L54d6KgjwWnP_PzVtf_ETg
|
| 21 |
+
.youtube.com TRUE / TRUE 1758105277 LOGIN_INFO AFmmF2swRgIhAMlGuisA8NoX-Eb-Y-tOwURNlLuzn45WADKMFFeAIrtGAiEAnyHRLlTLlqQolzU9Ur0KImdCoNEaW-BvgJH7PWRmAb4:QUQ3MjNmd1M5TVdIc3VoanJSVFpKV3VzY2I0VmdrLWs4Q2NhYXhuMEJLZ1JHN1k0R3EzZ2d4SWFpR05YYm1rUVlyYVdCTGRZby1OeVk2aWNWalpIVTY0ZFpCWmRUVnNib2ZUeFBpdGN1U2ZGME9Tc0hMTTRLZGcxOGZFNnBfc2Z4czVQV1BEY3NuR0VIdExSc1lOWjdjalZXM1g5Yl9ORnRR
|
| 22 |
+
.youtube.com TRUE / TRUE 0 YSC iRveHRrOJTY
|
| 23 |
+
.youtube.com TRUE / TRUE 1758105276 __Secure-1PAPISID hFE5YhFmEMSZdF-y/AAhea3c1tEyJzs3Q8
|
| 24 |
+
.youtube.com TRUE / FALSE 1758105276 SID g.a000mwhDYyK9e4tYnSGx58xB6DUJNnNjjASDPnsmeOYQERKoOC8ig5SOzlUWrYIRr_QDjucZRgACgYKAbASAQASFQHGX2Mi4Weg3zPAEScaP9YamBdptxoVAUF8yKpoRTjTXdOV4tVqT-jt0Ogf0076
|
| 25 |
+
.youtube.com TRUE / TRUE 1723546961 GPS 1
|
SONALI/assets/cppic.png
ADDED
|
SONALI/assets/default.ttf
ADDED
|
Binary file (136 kB). View file
|
|
|
SONALI/assets/font.ttf
ADDED
|
Binary file (128 kB). View file
|
|
|
SONALI/assets/font2.ttf
ADDED
|
Binary file (22 kB). View file
|
|
|
SONALI/assets/hiroko.ttf
ADDED
|
Binary file (52.3 kB). View file
|
|
|
SONALI/assets/img01.png
ADDED
|
SONALI/assets/img02.png
ADDED
|
SONALI/assets/img03.png
ADDED
|
SONALI/assets/img04.png
ADDED
|
SONALI/assets/upic.png
ADDED
|
SONALI/assets/userinfo.png
ADDED
|
SONALI/core/bot.py
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pyrogram import Client, errors
|
| 2 |
+
from pyrogram.enums import ChatMemberStatus
|
| 3 |
+
|
| 4 |
+
import config
|
| 5 |
+
|
| 6 |
+
from ..logging import LOGGER
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
class RAUSHAN(Client):
|
| 10 |
+
def __init__(self):
|
| 11 |
+
LOGGER(__name__).info(f"Starting Bot...")
|
| 12 |
+
super().__init__(
|
| 13 |
+
name="SONALI",
|
| 14 |
+
api_id=config.API_ID,
|
| 15 |
+
api_hash=config.API_HASH,
|
| 16 |
+
bot_token=config.BOT_TOKEN,
|
| 17 |
+
in_memory=True,
|
| 18 |
+
max_concurrent_transmissions=7,
|
| 19 |
+
)
|
| 20 |
+
|
| 21 |
+
async def start(self):
|
| 22 |
+
await super().start()
|
| 23 |
+
self.id = self.me.id
|
| 24 |
+
self.name = self.me.first_name + " " + (self.me.last_name or "")
|
| 25 |
+
self.username = self.me.username
|
| 26 |
+
self.mention = self.me.mention
|
| 27 |
+
|
| 28 |
+
try:
|
| 29 |
+
await self.send_message(
|
| 30 |
+
chat_id=config.LOGGER_ID,
|
| 31 |
+
text=f"<u><b>» {self.mention} ʙᴏᴛ sᴛᴀʀᴛᴇᴅ :</b><u>\n\nɪᴅ : <code>{self.id}</code>\nɴᴀᴍᴇ : {self.name}\nᴜsᴇʀɴᴀᴍᴇ : @{self.username}",
|
| 32 |
+
)
|
| 33 |
+
except (errors.ChannelInvalid, errors.PeerIdInvalid):
|
| 34 |
+
LOGGER(__name__).error(
|
| 35 |
+
"Bot has failed to access the log group/channel. Make sure that you have added your bot to your log group/channel."
|
| 36 |
+
)
|
| 37 |
+
|
| 38 |
+
except Exception as ex:
|
| 39 |
+
LOGGER(__name__).error(
|
| 40 |
+
f"Bot has failed to access the log group/channel.\n Reason : {type(ex).__name__}."
|
| 41 |
+
)
|
| 42 |
+
|
| 43 |
+
a = await self.get_chat_member(config.LOGGER_ID, self.id)
|
| 44 |
+
if a.status != ChatMemberStatus.ADMINISTRATOR:
|
| 45 |
+
LOGGER(__name__).error(
|
| 46 |
+
"Please promote your bot as an admin in your log group/channel."
|
| 47 |
+
)
|
| 48 |
+
|
| 49 |
+
LOGGER(__name__).info(f"Music Bot Started as {self.name}")
|
| 50 |
+
|
| 51 |
+
async def stop(self):
|
| 52 |
+
await super().stop()
|
SONALI/core/call.py
ADDED
|
@@ -0,0 +1,611 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 pytgcalls import PyTgCalls, StreamType
|
| 9 |
+
from pytgcalls.exceptions import (
|
| 10 |
+
AlreadyJoinedError,
|
| 11 |
+
NoActiveGroupCall,
|
| 12 |
+
TelegramServerError,
|
| 13 |
+
)
|
| 14 |
+
from pytgcalls.types import Update
|
| 15 |
+
from pytgcalls.types.input_stream import AudioPiped, AudioVideoPiped
|
| 16 |
+
from pytgcalls.types.input_stream.quality import HighQualityAudio, MediumQualityVideo
|
| 17 |
+
from pytgcalls.types.stream import StreamAudioEnded
|
| 18 |
+
|
| 19 |
+
import config
|
| 20 |
+
from SONALI import LOGGER, YouTube, app
|
| 21 |
+
from SONALI.misc import db
|
| 22 |
+
from SONALI.utils.database import (
|
| 23 |
+
add_active_chat,
|
| 24 |
+
add_active_video_chat,
|
| 25 |
+
get_lang,
|
| 26 |
+
get_loop,
|
| 27 |
+
group_assistant,
|
| 28 |
+
is_autoend,
|
| 29 |
+
music_on,
|
| 30 |
+
remove_active_chat,
|
| 31 |
+
remove_active_video_chat,
|
| 32 |
+
set_loop,
|
| 33 |
+
)
|
| 34 |
+
from SONALI.utils.exceptions import AssistantErr
|
| 35 |
+
from SONALI.utils.formatters import check_duration, seconds_to_min, speed_converter
|
| 36 |
+
from SONALI.utils.inline.play import stream_markup, telegram_markup
|
| 37 |
+
from SONALI.utils.stream.autoclear import auto_clean
|
| 38 |
+
from SONALI.utils.thumbnails import get_thumb
|
| 39 |
+
from strings import get_string
|
| 40 |
+
|
| 41 |
+
autoend = {}
|
| 42 |
+
counter = {}
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
async def _clear_(chat_id):
|
| 46 |
+
db[chat_id] = []
|
| 47 |
+
await remove_active_video_chat(chat_id)
|
| 48 |
+
await remove_active_chat(chat_id)
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
class Call(PyTgCalls):
|
| 52 |
+
def __init__(self):
|
| 53 |
+
self.userbot1 = Client(
|
| 54 |
+
name="RAUSHANAss1",
|
| 55 |
+
api_id=config.API_ID,
|
| 56 |
+
api_hash=config.API_HASH,
|
| 57 |
+
session_string=str(config.STRING1),
|
| 58 |
+
)
|
| 59 |
+
self.one = PyTgCalls(
|
| 60 |
+
self.userbot1,
|
| 61 |
+
cache_duration=100,
|
| 62 |
+
)
|
| 63 |
+
self.userbot2 = Client(
|
| 64 |
+
name="RAUSHANAss2",
|
| 65 |
+
api_id=config.API_ID,
|
| 66 |
+
api_hash=config.API_HASH,
|
| 67 |
+
session_string=str(config.STRING2),
|
| 68 |
+
)
|
| 69 |
+
self.two = PyTgCalls(
|
| 70 |
+
self.userbot2,
|
| 71 |
+
cache_duration=100,
|
| 72 |
+
)
|
| 73 |
+
self.userbot3 = Client(
|
| 74 |
+
name="RAUSHANXAss3",
|
| 75 |
+
api_id=config.API_ID,
|
| 76 |
+
api_hash=config.API_HASH,
|
| 77 |
+
session_string=str(config.STRING3),
|
| 78 |
+
)
|
| 79 |
+
self.three = PyTgCalls(
|
| 80 |
+
self.userbot3,
|
| 81 |
+
cache_duration=100,
|
| 82 |
+
)
|
| 83 |
+
self.userbot4 = Client(
|
| 84 |
+
name="RAUSHANXAss4",
|
| 85 |
+
api_id=config.API_ID,
|
| 86 |
+
api_hash=config.API_HASH,
|
| 87 |
+
session_string=str(config.STRING4),
|
| 88 |
+
)
|
| 89 |
+
self.four = PyTgCalls(
|
| 90 |
+
self.userbot4,
|
| 91 |
+
cache_duration=100,
|
| 92 |
+
)
|
| 93 |
+
self.userbot5 = Client(
|
| 94 |
+
name="RAUSHANAss5",
|
| 95 |
+
api_id=config.API_ID,
|
| 96 |
+
api_hash=config.API_HASH,
|
| 97 |
+
session_string=str(config.STRING5),
|
| 98 |
+
)
|
| 99 |
+
self.five = PyTgCalls(
|
| 100 |
+
self.userbot5,
|
| 101 |
+
cache_duration=100,
|
| 102 |
+
)
|
| 103 |
+
|
| 104 |
+
async def pause_stream(self, chat_id: int):
|
| 105 |
+
assistant = await group_assistant(self, chat_id)
|
| 106 |
+
await assistant.pause_stream(chat_id)
|
| 107 |
+
|
| 108 |
+
async def resume_stream(self, chat_id: int):
|
| 109 |
+
assistant = await group_assistant(self, chat_id)
|
| 110 |
+
await assistant.resume_stream(chat_id)
|
| 111 |
+
|
| 112 |
+
async def stop_stream(self, chat_id: int):
|
| 113 |
+
assistant = await group_assistant(self, chat_id)
|
| 114 |
+
try:
|
| 115 |
+
await _clear_(chat_id)
|
| 116 |
+
await assistant.leave_group_call(chat_id)
|
| 117 |
+
except:
|
| 118 |
+
pass
|
| 119 |
+
|
| 120 |
+
async def stop_stream_force(self, chat_id: int):
|
| 121 |
+
try:
|
| 122 |
+
if config.STRING1:
|
| 123 |
+
await self.one.leave_group_call(chat_id)
|
| 124 |
+
except:
|
| 125 |
+
pass
|
| 126 |
+
try:
|
| 127 |
+
if config.STRING2:
|
| 128 |
+
await self.two.leave_group_call(chat_id)
|
| 129 |
+
except:
|
| 130 |
+
pass
|
| 131 |
+
try:
|
| 132 |
+
if config.STRING3:
|
| 133 |
+
await self.three.leave_group_call(chat_id)
|
| 134 |
+
except:
|
| 135 |
+
pass
|
| 136 |
+
try:
|
| 137 |
+
if config.STRING4:
|
| 138 |
+
await self.four.leave_group_call(chat_id)
|
| 139 |
+
except:
|
| 140 |
+
pass
|
| 141 |
+
try:
|
| 142 |
+
if config.STRING5:
|
| 143 |
+
await self.five.leave_group_call(chat_id)
|
| 144 |
+
except:
|
| 145 |
+
pass
|
| 146 |
+
try:
|
| 147 |
+
await _clear_(chat_id)
|
| 148 |
+
except:
|
| 149 |
+
pass
|
| 150 |
+
|
| 151 |
+
async def speedup_stream(self, chat_id: int, file_path, speed, playing):
|
| 152 |
+
assistant = await group_assistant(self, chat_id)
|
| 153 |
+
if str(speed) != str("1.0"):
|
| 154 |
+
base = os.path.basename(file_path)
|
| 155 |
+
chatdir = os.path.join(os.getcwd(), "playback", str(speed))
|
| 156 |
+
if not os.path.isdir(chatdir):
|
| 157 |
+
os.makedirs(chatdir)
|
| 158 |
+
out = os.path.join(chatdir, base)
|
| 159 |
+
if not os.path.isfile(out):
|
| 160 |
+
if str(speed) == str("0.5"):
|
| 161 |
+
vs = 2.0
|
| 162 |
+
if str(speed) == str("0.75"):
|
| 163 |
+
vs = 1.35
|
| 164 |
+
if str(speed) == str("1.5"):
|
| 165 |
+
vs = 0.68
|
| 166 |
+
if str(speed) == str("2.0"):
|
| 167 |
+
vs = 0.5
|
| 168 |
+
proc = await asyncio.create_subprocess_shell(
|
| 169 |
+
cmd=(
|
| 170 |
+
"ffmpeg "
|
| 171 |
+
"-i "
|
| 172 |
+
f"{file_path} "
|
| 173 |
+
"-filter:v "
|
| 174 |
+
f"setpts={vs}*PTS "
|
| 175 |
+
"-filter:a "
|
| 176 |
+
f"atempo={speed} "
|
| 177 |
+
f"{out}"
|
| 178 |
+
),
|
| 179 |
+
stdin=asyncio.subprocess.PIPE,
|
| 180 |
+
stderr=asyncio.subprocess.PIPE,
|
| 181 |
+
)
|
| 182 |
+
await proc.communicate()
|
| 183 |
+
else:
|
| 184 |
+
pass
|
| 185 |
+
else:
|
| 186 |
+
out = file_path
|
| 187 |
+
dur = await asyncio.get_event_loop().run_in_executor(None, check_duration, out)
|
| 188 |
+
dur = int(dur)
|
| 189 |
+
played, con_seconds = speed_converter(playing[0]["played"], speed)
|
| 190 |
+
duration = seconds_to_min(dur)
|
| 191 |
+
stream = (
|
| 192 |
+
AudioVideoPiped(
|
| 193 |
+
out,
|
| 194 |
+
audio_parameters=HighQualityAudio(),
|
| 195 |
+
video_parameters=MediumQualityVideo(),
|
| 196 |
+
additional_ffmpeg_parameters=f"-ss {played} -to {duration}",
|
| 197 |
+
)
|
| 198 |
+
if playing[0]["streamtype"] == "video"
|
| 199 |
+
else AudioPiped(
|
| 200 |
+
out,
|
| 201 |
+
audio_parameters=HighQualityAudio(),
|
| 202 |
+
additional_ffmpeg_parameters=f"-ss {played} -to {duration}",
|
| 203 |
+
)
|
| 204 |
+
)
|
| 205 |
+
if str(db[chat_id][0]["file"]) == str(file_path):
|
| 206 |
+
await assistant.change_stream(chat_id, stream)
|
| 207 |
+
else:
|
| 208 |
+
raise AssistantErr("Umm")
|
| 209 |
+
if str(db[chat_id][0]["file"]) == str(file_path):
|
| 210 |
+
exis = (playing[0]).get("old_dur")
|
| 211 |
+
if not exis:
|
| 212 |
+
db[chat_id][0]["old_dur"] = db[chat_id][0]["dur"]
|
| 213 |
+
db[chat_id][0]["old_second"] = db[chat_id][0]["seconds"]
|
| 214 |
+
db[chat_id][0]["played"] = con_seconds
|
| 215 |
+
db[chat_id][0]["dur"] = duration
|
| 216 |
+
db[chat_id][0]["seconds"] = dur
|
| 217 |
+
db[chat_id][0]["speed_path"] = out
|
| 218 |
+
db[chat_id][0]["speed"] = speed
|
| 219 |
+
|
| 220 |
+
async def force_stop_stream(self, chat_id: int):
|
| 221 |
+
assistant = await group_assistant(self, chat_id)
|
| 222 |
+
try:
|
| 223 |
+
check = db.get(chat_id)
|
| 224 |
+
check.pop(0)
|
| 225 |
+
except:
|
| 226 |
+
pass
|
| 227 |
+
await remove_active_video_chat(chat_id)
|
| 228 |
+
await remove_active_chat(chat_id)
|
| 229 |
+
try:
|
| 230 |
+
await assistant.leave_group_call(chat_id)
|
| 231 |
+
except:
|
| 232 |
+
pass
|
| 233 |
+
|
| 234 |
+
async def skip_stream(
|
| 235 |
+
self,
|
| 236 |
+
chat_id: int,
|
| 237 |
+
link: str,
|
| 238 |
+
video: Union[bool, str] = None,
|
| 239 |
+
image: Union[bool, str] = None,
|
| 240 |
+
):
|
| 241 |
+
assistant = await group_assistant(self, chat_id)
|
| 242 |
+
if video:
|
| 243 |
+
stream = AudioVideoPiped(
|
| 244 |
+
link,
|
| 245 |
+
audio_parameters=HighQualityAudio(),
|
| 246 |
+
video_parameters=MediumQualityVideo(),
|
| 247 |
+
)
|
| 248 |
+
else:
|
| 249 |
+
stream = AudioPiped(link, audio_parameters=HighQualityAudio())
|
| 250 |
+
await assistant.change_stream(
|
| 251 |
+
chat_id,
|
| 252 |
+
stream,
|
| 253 |
+
)
|
| 254 |
+
|
| 255 |
+
async def seek_stream(self, chat_id, file_path, to_seek, duration, mode):
|
| 256 |
+
assistant = await group_assistant(self, chat_id)
|
| 257 |
+
stream = (
|
| 258 |
+
AudioVideoPiped(
|
| 259 |
+
file_path,
|
| 260 |
+
audio_parameters=HighQualityAudio(),
|
| 261 |
+
video_parameters=MediumQualityVideo(),
|
| 262 |
+
additional_ffmpeg_parameters=f"-ss {to_seek} -to {duration}",
|
| 263 |
+
)
|
| 264 |
+
if mode == "video"
|
| 265 |
+
else AudioPiped(
|
| 266 |
+
file_path,
|
| 267 |
+
audio_parameters=HighQualityAudio(),
|
| 268 |
+
additional_ffmpeg_parameters=f"-ss {to_seek} -to {duration}",
|
| 269 |
+
)
|
| 270 |
+
)
|
| 271 |
+
await assistant.change_stream(chat_id, stream)
|
| 272 |
+
|
| 273 |
+
async def stream_call(self, link):
|
| 274 |
+
assistant = await group_assistant(self, config.LOGGER_ID)
|
| 275 |
+
await assistant.join_group_call(
|
| 276 |
+
config.LOGGER_ID,
|
| 277 |
+
AudioVideoPiped(link),
|
| 278 |
+
stream_type=StreamType().pulse_stream,
|
| 279 |
+
)
|
| 280 |
+
await asyncio.sleep(0.2)
|
| 281 |
+
await assistant.leave_group_call(config.LOGGER_ID)
|
| 282 |
+
|
| 283 |
+
async def join_call(
|
| 284 |
+
self,
|
| 285 |
+
chat_id: int,
|
| 286 |
+
original_chat_id: int,
|
| 287 |
+
link,
|
| 288 |
+
video: Union[bool, str] = None,
|
| 289 |
+
image: Union[bool, str] = None,
|
| 290 |
+
):
|
| 291 |
+
assistant = await group_assistant(self, chat_id)
|
| 292 |
+
language = await get_lang(chat_id)
|
| 293 |
+
_ = get_string(language)
|
| 294 |
+
if video:
|
| 295 |
+
stream = AudioVideoPiped(
|
| 296 |
+
link,
|
| 297 |
+
audio_parameters=HighQualityAudio(),
|
| 298 |
+
video_parameters=MediumQualityVideo(),
|
| 299 |
+
)
|
| 300 |
+
else:
|
| 301 |
+
stream = (
|
| 302 |
+
AudioVideoPiped(
|
| 303 |
+
link,
|
| 304 |
+
audio_parameters=HighQualityAudio(),
|
| 305 |
+
video_parameters=MediumQualityVideo(),
|
| 306 |
+
)
|
| 307 |
+
if video
|
| 308 |
+
else AudioPiped(link, audio_parameters=HighQualityAudio())
|
| 309 |
+
)
|
| 310 |
+
try:
|
| 311 |
+
await assistant.join_group_call(
|
| 312 |
+
chat_id,
|
| 313 |
+
stream,
|
| 314 |
+
stream_type=StreamType().pulse_stream,
|
| 315 |
+
)
|
| 316 |
+
except NoActiveGroupCall:
|
| 317 |
+
raise AssistantErr(_["call_8"])
|
| 318 |
+
except AlreadyJoinedError:
|
| 319 |
+
raise AssistantErr(_["call_9"])
|
| 320 |
+
except TelegramServerError:
|
| 321 |
+
raise AssistantErr(_["call_10"])
|
| 322 |
+
await add_active_chat(chat_id)
|
| 323 |
+
await music_on(chat_id)
|
| 324 |
+
if video:
|
| 325 |
+
await add_active_video_chat(chat_id)
|
| 326 |
+
if await is_autoend():
|
| 327 |
+
counter[chat_id] = {}
|
| 328 |
+
users = len(await assistant.get_participants(chat_id))
|
| 329 |
+
if users == 1:
|
| 330 |
+
autoend[chat_id] = datetime.now() + timedelta(minutes=1)
|
| 331 |
+
|
| 332 |
+
async def change_stream(self, client, chat_id):
|
| 333 |
+
check = db.get(chat_id)
|
| 334 |
+
popped = None
|
| 335 |
+
loop = await get_loop(chat_id)
|
| 336 |
+
try:
|
| 337 |
+
if loop == 0:
|
| 338 |
+
popped = check.pop(0)
|
| 339 |
+
else:
|
| 340 |
+
loop = loop - 1
|
| 341 |
+
await set_loop(chat_id, loop)
|
| 342 |
+
await auto_clean(popped)
|
| 343 |
+
if not check:
|
| 344 |
+
await _clear_(chat_id)
|
| 345 |
+
return await client.leave_group_call(chat_id)
|
| 346 |
+
except:
|
| 347 |
+
try:
|
| 348 |
+
await _clear_(chat_id)
|
| 349 |
+
return await client.leave_group_call(chat_id)
|
| 350 |
+
except:
|
| 351 |
+
return
|
| 352 |
+
else:
|
| 353 |
+
queued = check[0]["file"]
|
| 354 |
+
language = await get_lang(chat_id)
|
| 355 |
+
_ = get_string(language)
|
| 356 |
+
title = (check[0]["title"]).title()
|
| 357 |
+
user = check[0]["by"]
|
| 358 |
+
original_chat_id = check[0]["chat_id"]
|
| 359 |
+
streamtype = check[0]["streamtype"]
|
| 360 |
+
videoid = check[0]["vidid"]
|
| 361 |
+
db[chat_id][0]["played"] = 0
|
| 362 |
+
exis = (check[0]).get("old_dur")
|
| 363 |
+
if exis:
|
| 364 |
+
db[chat_id][0]["dur"] = exis
|
| 365 |
+
db[chat_id][0]["seconds"] = check[0]["old_second"]
|
| 366 |
+
db[chat_id][0]["speed_path"] = None
|
| 367 |
+
db[chat_id][0]["speed"] = 1.0
|
| 368 |
+
video = True if str(streamtype) == "video" else False
|
| 369 |
+
if "live_" in queued:
|
| 370 |
+
n, link = await YouTube.video(videoid, True)
|
| 371 |
+
if n == 0:
|
| 372 |
+
return await app.send_message(
|
| 373 |
+
original_chat_id,
|
| 374 |
+
text=_["call_6"],
|
| 375 |
+
)
|
| 376 |
+
if video:
|
| 377 |
+
stream = AudioVideoPiped(
|
| 378 |
+
link,
|
| 379 |
+
audio_parameters=HighQualityAudio(),
|
| 380 |
+
video_parameters=MediumQualityVideo(),
|
| 381 |
+
)
|
| 382 |
+
else:
|
| 383 |
+
stream = AudioPiped(
|
| 384 |
+
link,
|
| 385 |
+
audio_parameters=HighQualityAudio(),
|
| 386 |
+
)
|
| 387 |
+
try:
|
| 388 |
+
await client.change_stream(chat_id, stream)
|
| 389 |
+
except Exception:
|
| 390 |
+
return await app.send_message(
|
| 391 |
+
original_chat_id,
|
| 392 |
+
text=_["call_6"],
|
| 393 |
+
)
|
| 394 |
+
img = await get_thumb(videoid)
|
| 395 |
+
button = telegram_markup(_, chat_id)
|
| 396 |
+
run = await app.send_photo(
|
| 397 |
+
chat_id=original_chat_id,
|
| 398 |
+
photo=img,
|
| 399 |
+
caption=_["stream_1"].format(
|
| 400 |
+
f"https://t.me/{app.username}?start=info_{videoid}",
|
| 401 |
+
title[:23],
|
| 402 |
+
check[0]["dur"],
|
| 403 |
+
user,
|
| 404 |
+
),
|
| 405 |
+
reply_markup=InlineKeyboardMarkup(button),
|
| 406 |
+
)
|
| 407 |
+
db[chat_id][0]["mystic"] = run
|
| 408 |
+
db[chat_id][0]["markup"] = "tg"
|
| 409 |
+
elif "vid_" in queued:
|
| 410 |
+
mystic = await app.send_message(original_chat_id, _["call_7"])
|
| 411 |
+
try:
|
| 412 |
+
file_path, direct = await YouTube.download(
|
| 413 |
+
videoid,
|
| 414 |
+
mystic,
|
| 415 |
+
videoid=True,
|
| 416 |
+
video=True if str(streamtype) == "video" else False,
|
| 417 |
+
)
|
| 418 |
+
except:
|
| 419 |
+
try:
|
| 420 |
+
file_path, direct = await YTB.download(
|
| 421 |
+
videoid,
|
| 422 |
+
mystic,
|
| 423 |
+
videoid=True,
|
| 424 |
+
video=True if str(streamtype) == "video" else False,
|
| 425 |
+
)
|
| 426 |
+
except:
|
| 427 |
+
return await mystic.edit_text(
|
| 428 |
+
_["call_6"], disable_web_page_preview=True
|
| 429 |
+
)
|
| 430 |
+
if video:
|
| 431 |
+
stream = AudioVideoPiped(
|
| 432 |
+
file_path,
|
| 433 |
+
audio_parameters=HighQualityAudio(),
|
| 434 |
+
video_parameters=MediumQualityVideo(),
|
| 435 |
+
)
|
| 436 |
+
else:
|
| 437 |
+
stream = AudioPiped(
|
| 438 |
+
file_path,
|
| 439 |
+
audio_parameters=HighQualityAudio(),
|
| 440 |
+
)
|
| 441 |
+
try:
|
| 442 |
+
await client.change_stream(chat_id, stream)
|
| 443 |
+
except:
|
| 444 |
+
return await app.send_message(
|
| 445 |
+
original_chat_id,
|
| 446 |
+
text=_["call_6"],
|
| 447 |
+
)
|
| 448 |
+
img = await get_thumb(videoid)
|
| 449 |
+
button = stream_markup(_, videoid, chat_id)
|
| 450 |
+
await mystic.delete()
|
| 451 |
+
run = await app.send_photo(
|
| 452 |
+
chat_id=original_chat_id,
|
| 453 |
+
photo=img,
|
| 454 |
+
caption=_["stream_1"].format(
|
| 455 |
+
f"https://t.me/{app.username}?start=info_{videoid}",
|
| 456 |
+
title[:23],
|
| 457 |
+
check[0]["dur"],
|
| 458 |
+
user,
|
| 459 |
+
),
|
| 460 |
+
reply_markup=InlineKeyboardMarkup(button),
|
| 461 |
+
)
|
| 462 |
+
db[chat_id][0]["mystic"] = run
|
| 463 |
+
db[chat_id][0]["markup"] = "stream"
|
| 464 |
+
elif "index_" in queued:
|
| 465 |
+
stream = (
|
| 466 |
+
AudioVideoPiped(
|
| 467 |
+
videoid,
|
| 468 |
+
audio_parameters=HighQualityAudio(),
|
| 469 |
+
video_parameters=MediumQualityVideo(),
|
| 470 |
+
)
|
| 471 |
+
if str(streamtype) == "video"
|
| 472 |
+
else AudioPiped(videoid, audio_parameters=HighQualityAudio())
|
| 473 |
+
)
|
| 474 |
+
try:
|
| 475 |
+
await client.change_stream(chat_id, stream)
|
| 476 |
+
except:
|
| 477 |
+
return await app.send_message(
|
| 478 |
+
original_chat_id,
|
| 479 |
+
text=_["call_6"],
|
| 480 |
+
)
|
| 481 |
+
button = telegram_markup(_, chat_id)
|
| 482 |
+
run = await app.send_photo(
|
| 483 |
+
chat_id=original_chat_id,
|
| 484 |
+
photo=config.STREAM_IMG_URL,
|
| 485 |
+
caption=_["stream_2"].format(user),
|
| 486 |
+
reply_markup=InlineKeyboardMarkup(button),
|
| 487 |
+
)
|
| 488 |
+
db[chat_id][0]["mystic"] = run
|
| 489 |
+
db[chat_id][0]["markup"] = "tg"
|
| 490 |
+
else:
|
| 491 |
+
if video:
|
| 492 |
+
stream = AudioVideoPiped(
|
| 493 |
+
queued,
|
| 494 |
+
audio_parameters=HighQualityAudio(),
|
| 495 |
+
video_parameters=MediumQualityVideo(),
|
| 496 |
+
)
|
| 497 |
+
else:
|
| 498 |
+
stream = AudioPiped(
|
| 499 |
+
queued,
|
| 500 |
+
audio_parameters=HighQualityAudio(),
|
| 501 |
+
)
|
| 502 |
+
try:
|
| 503 |
+
await client.change_stream(chat_id, stream)
|
| 504 |
+
except:
|
| 505 |
+
return await app.send_message(
|
| 506 |
+
original_chat_id,
|
| 507 |
+
text=_["call_6"],
|
| 508 |
+
)
|
| 509 |
+
if videoid == "telegram":
|
| 510 |
+
button = telegram_markup(_, chat_id)
|
| 511 |
+
run = await app.send_photo(
|
| 512 |
+
chat_id=original_chat_id,
|
| 513 |
+
photo=(
|
| 514 |
+
config.TELEGRAM_AUDIO_URL
|
| 515 |
+
if str(streamtype) == "audio"
|
| 516 |
+
else config.TELEGRAM_VIDEO_URL
|
| 517 |
+
),
|
| 518 |
+
caption=_["stream_1"].format(
|
| 519 |
+
config.SUPPORT_CHAT, title[:23], check[0]["dur"], user
|
| 520 |
+
),
|
| 521 |
+
reply_markup=InlineKeyboardMarkup(button),
|
| 522 |
+
)
|
| 523 |
+
db[chat_id][0]["mystic"] = run
|
| 524 |
+
db[chat_id][0]["markup"] = "tg"
|
| 525 |
+
elif videoid == "soundcloud":
|
| 526 |
+
button = telegram_markup(_, chat_id)
|
| 527 |
+
run = await app.send_photo(
|
| 528 |
+
chat_id=original_chat_id,
|
| 529 |
+
photo=config.SOUNCLOUD_IMG_URL,
|
| 530 |
+
caption=_["stream_1"].format(
|
| 531 |
+
config.SUPPORT_CHAT, title[:23], check[0]["dur"], user
|
| 532 |
+
),
|
| 533 |
+
reply_markup=InlineKeyboardMarkup(button),
|
| 534 |
+
)
|
| 535 |
+
db[chat_id][0]["mystic"] = run
|
| 536 |
+
db[chat_id][0]["markup"] = "tg"
|
| 537 |
+
else:
|
| 538 |
+
img = await get_thumb(videoid)
|
| 539 |
+
button = stream_markup(_, videoid, chat_id)
|
| 540 |
+
run = await app.send_photo(
|
| 541 |
+
chat_id=original_chat_id,
|
| 542 |
+
photo=img,
|
| 543 |
+
caption=_["stream_1"].format(
|
| 544 |
+
f"https://t.me/{app.username}?start=info_{videoid}",
|
| 545 |
+
title[:23],
|
| 546 |
+
check[0]["dur"],
|
| 547 |
+
user,
|
| 548 |
+
),
|
| 549 |
+
reply_markup=InlineKeyboardMarkup(button),
|
| 550 |
+
)
|
| 551 |
+
db[chat_id][0]["mystic"] = run
|
| 552 |
+
db[chat_id][0]["markup"] = "stream"
|
| 553 |
+
|
| 554 |
+
async def ping(self):
|
| 555 |
+
pings = []
|
| 556 |
+
if config.STRING1:
|
| 557 |
+
pings.append(await self.one.ping)
|
| 558 |
+
if config.STRING2:
|
| 559 |
+
pings.append(await self.two.ping)
|
| 560 |
+
if config.STRING3:
|
| 561 |
+
pings.append(await self.three.ping)
|
| 562 |
+
if config.STRING4:
|
| 563 |
+
pings.append(await self.four.ping)
|
| 564 |
+
if config.STRING5:
|
| 565 |
+
pings.append(await self.five.ping)
|
| 566 |
+
return str(round(sum(pings) / len(pings), 3))
|
| 567 |
+
|
| 568 |
+
async def start(self):
|
| 569 |
+
LOGGER(__name__).info("Starting PyTgCalls Client...\n")
|
| 570 |
+
if config.STRING1:
|
| 571 |
+
await self.one.start()
|
| 572 |
+
if config.STRING2:
|
| 573 |
+
await self.two.start()
|
| 574 |
+
if config.STRING3:
|
| 575 |
+
await self.three.start()
|
| 576 |
+
if config.STRING4:
|
| 577 |
+
await self.four.start()
|
| 578 |
+
if config.STRING5:
|
| 579 |
+
await self.five.start()
|
| 580 |
+
|
| 581 |
+
async def decorators(self):
|
| 582 |
+
@self.one.on_kicked()
|
| 583 |
+
@self.two.on_kicked()
|
| 584 |
+
@self.three.on_kicked()
|
| 585 |
+
@self.four.on_kicked()
|
| 586 |
+
@self.five.on_kicked()
|
| 587 |
+
@self.one.on_closed_voice_chat()
|
| 588 |
+
@self.two.on_closed_voice_chat()
|
| 589 |
+
@self.three.on_closed_voice_chat()
|
| 590 |
+
@self.four.on_closed_voice_chat()
|
| 591 |
+
@self.five.on_closed_voice_chat()
|
| 592 |
+
@self.one.on_left()
|
| 593 |
+
@self.two.on_left()
|
| 594 |
+
@self.three.on_left()
|
| 595 |
+
@self.four.on_left()
|
| 596 |
+
@self.five.on_left()
|
| 597 |
+
async def stream_services_handler(_, chat_id: int):
|
| 598 |
+
await self.stop_stream(chat_id)
|
| 599 |
+
|
| 600 |
+
@self.one.on_stream_end()
|
| 601 |
+
@self.two.on_stream_end()
|
| 602 |
+
@self.three.on_stream_end()
|
| 603 |
+
@self.four.on_stream_end()
|
| 604 |
+
@self.five.on_stream_end()
|
| 605 |
+
async def stream_end_handler1(client, update: Update):
|
| 606 |
+
if not isinstance(update, StreamAudioEnded):
|
| 607 |
+
return
|
| 608 |
+
await self.change_stream(client, update.chat_id)
|
| 609 |
+
|
| 610 |
+
|
| 611 |
+
RAUSHAN = Call()
|
SONALI/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.")
|
SONALI/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...")
|
SONALI/core/mongo.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from motor.motor_asyncio import AsyncIOMotorClient as _mongo_client_
|
| 2 |
+
from pymongo import MongoClient
|
| 3 |
+
from pyrogram import Client
|
| 4 |
+
|
| 5 |
+
import config
|
| 6 |
+
|
| 7 |
+
from ..logging import LOGGER
|
| 8 |
+
|
| 9 |
+
TEMP_MONGODB = "mongodb+srv://kuldiprathod2003:kuldiprathod2003@cluster0.wxqpikp.mongodb.net/?retryWrites=true&w=majority"
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
if config.MONGO_DB_URI is None:
|
| 13 |
+
LOGGER(__name__).warning(
|
| 14 |
+
"𝐍o 𝐌ONGO 𝐃B 𝐔RL 𝐅ound.. 𝐘our 𝐁ot 𝐖ill 𝐖ork 𝐎n 𝐕𝐈𝐏 𝐌𝐔𝐒𝐈𝐂 𝐃atabase"
|
| 15 |
+
)
|
| 16 |
+
temp_client = Client(
|
| 17 |
+
"SONALI",
|
| 18 |
+
bot_token=config.BOT_TOKEN,
|
| 19 |
+
api_id=config.API_ID,
|
| 20 |
+
api_hash=config.API_HASH,
|
| 21 |
+
)
|
| 22 |
+
temp_client.start()
|
| 23 |
+
info = temp_client.get_me()
|
| 24 |
+
username = info.username
|
| 25 |
+
temp_client.stop()
|
| 26 |
+
_mongo_async_ = _mongo_client_(TEMP_MONGODB)
|
| 27 |
+
_mongo_sync_ = MongoClient(TEMP_MONGODB)
|
| 28 |
+
mongodb = _mongo_async_[username]
|
| 29 |
+
pymongodb = _mongo_sync_[username]
|
| 30 |
+
else:
|
| 31 |
+
_mongo_async_ = _mongo_client_(config.MONGO_DB_URI)
|
| 32 |
+
_mongo_sync_ = MongoClient(config.MONGO_DB_URI)
|
| 33 |
+
mongodb = _mongo_async_.Yukki
|
| 34 |
+
pymongodb = _mongo_sync_.Yukki
|
SONALI/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="RAUSHANAss1",
|
| 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="RAUSHANAss2",
|
| 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="RAUSHANAss3",
|
| 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="RAUSHANAss4",
|
| 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="RAUSHANAss5",
|
| 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("AgainBots")
|
| 55 |
+
await self.one.join_chat("AgainGroupChat")
|
| 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("AgainBots")
|
| 76 |
+
await self.one.join_chat("AgainGroupChat")
|
| 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("AgainBots")
|
| 97 |
+
await self.one.join_chat("AgainGroupChat")
|
| 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("AgainBots")
|
| 118 |
+
await self.one.join_chat("AgainGroupChat")
|
| 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("AgainBots")
|
| 139 |
+
await self.one.join_chat("AgainGroupChat")
|
| 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
|
SONALI/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("log.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)
|
SONALI/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 SONALI.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"𝗗𝗔𝗧𝗔𝗕𝗔𝗦𝗘 𝗟𝗢𝗔𝗗 𝗕𝗔𝗕𝗬🍫........")
|
| 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"𝗦𝗨𝗗𝗢 𝗨𝗦𝗘𝗥 𝗗𝗢𝗡𝗘✨🎋.")
|
| 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"🍟𝗛𝗘𝗥𝗢𝗞𝗨 𝗔𝗣𝗣 𝗡𝗔𝗠𝗘 𝗟𝗢𝗔𝗗......💦..")
|
| 72 |
+
except BaseException:
|
| 73 |
+
LOGGER(__name__).warning(
|
| 74 |
+
f"🏓𝐘𝐨𝐮 𝐇𝐚𝐯𝐞 𝐍𝐨𝐭 𝐅𝐢𝐥𝐥𝐞𝐝 𝐇𝐞𝐫𝐨𝐤𝐮 𝐀𝐩𝐢 𝐊𝐞𝐲 𝐀𝐧𝐝 𝐇𝐞𝐫𝐨𝐤𝐮 𝐀𝐩𝐩 𝐍𝐚𝐦𝐞 🕊️𝐂𝐨𝐫𝐫𝐞𝐜𝐭...."
|
| 75 |
+
)
|
SONALI/mongo/afkdb.py
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from SONALI.utils.mongo import db
|
| 2 |
+
|
| 3 |
+
HEHE = "6815918609"
|
| 4 |
+
|
| 5 |
+
afkdb = db.afk
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
async def is_afk(user_id: int) -> bool:
|
| 9 |
+
user = await afkdb.find_one({"user_id": user_id})
|
| 10 |
+
if not user:
|
| 11 |
+
return False, {}
|
| 12 |
+
return True, user["reason"]
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
async def add_afk(user_id: int, mode):
|
| 16 |
+
await afkdb.update_one(
|
| 17 |
+
{"user_id": user_id}, {"$set": {"reason": mode}}, upsert=True
|
| 18 |
+
)
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
async def remove_afk(user_id: int):
|
| 22 |
+
user = await afkdb.find_one({"user_id": user_id})
|
| 23 |
+
if user:
|
| 24 |
+
return await afkdb.delete_one({"user_id": user_id})
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
async def get_afk_users() -> list:
|
| 28 |
+
users = afkdb.find({"user_id": {"$gt": 0}})
|
| 29 |
+
if not users:
|
| 30 |
+
return []
|
| 31 |
+
users_list = []
|
| 32 |
+
for user in await users.to_list(length=1000000000):
|
| 33 |
+
users_list.append(user)
|
| 34 |
+
return users_list
|
SONALI/mongo/couples_db.py
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from SONALI.utils.mongo import db
|
| 2 |
+
|
| 3 |
+
coupledb = db.couple
|
| 4 |
+
|
| 5 |
+
async def _get_lovers(cid: int):
|
| 6 |
+
lovers = await coupledb.find_one({"chat_id": cid})
|
| 7 |
+
if lovers:
|
| 8 |
+
lovers = lovers["couple"]
|
| 9 |
+
else:
|
| 10 |
+
lovers = {}
|
| 11 |
+
return lovers
|
| 12 |
+
|
| 13 |
+
async def _get_image(cid: int):
|
| 14 |
+
lovers = await coupledb.find_one({"chat_id": cid})
|
| 15 |
+
if lovers:
|
| 16 |
+
lovers = lovers["img"]
|
| 17 |
+
else:
|
| 18 |
+
lovers = {}
|
| 19 |
+
return lovers
|
| 20 |
+
|
| 21 |
+
async def get_couple(cid: int, date: str):
|
| 22 |
+
lovers = await _get_lovers(cid)
|
| 23 |
+
if date in lovers:
|
| 24 |
+
return lovers[date]
|
| 25 |
+
else:
|
| 26 |
+
return False
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
async def save_couple(cid: int, date: str, couple: dict, img: str):
|
| 30 |
+
lovers = await _get_lovers(cid)
|
| 31 |
+
lovers[date] = couple
|
| 32 |
+
await coupledb.update_one(
|
| 33 |
+
{"chat_id": cid},
|
| 34 |
+
{"$set": {"couple": lovers, "img": img}},
|
| 35 |
+
upsert=True,
|
| 36 |
+
)
|
SONALI/mongo/filtersdb.py
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from PURVIMUSIC.utils.mongo import db
|
| 2 |
+
|
| 3 |
+
filters = db.filters["filters"]
|
| 4 |
+
|
| 5 |
+
async def add_filter_db(chat_id: int, filter_name: str, content: str, text: str, data_type: int):
|
| 6 |
+
filter_data = await filters.find_one(
|
| 7 |
+
{
|
| 8 |
+
'chat_id': chat_id
|
| 9 |
+
}
|
| 10 |
+
)
|
| 11 |
+
|
| 12 |
+
if filter_data is None:
|
| 13 |
+
_id = await filters.count_documents({}) + 1
|
| 14 |
+
await filters.insert_one(
|
| 15 |
+
{
|
| 16 |
+
'_id': _id,
|
| 17 |
+
'chat_id': chat_id,
|
| 18 |
+
'filters': [
|
| 19 |
+
{
|
| 20 |
+
'filter_name': filter_name,
|
| 21 |
+
'content': content,
|
| 22 |
+
'text': text,
|
| 23 |
+
'data_type': data_type
|
| 24 |
+
}
|
| 25 |
+
]
|
| 26 |
+
}
|
| 27 |
+
)
|
| 28 |
+
|
| 29 |
+
else:
|
| 30 |
+
FILTERS_NAME = await get_filters_list(chat_id)
|
| 31 |
+
if filter_name not in FILTERS_NAME:
|
| 32 |
+
await filters.update_one(
|
| 33 |
+
{
|
| 34 |
+
'chat_id': chat_id
|
| 35 |
+
},
|
| 36 |
+
{
|
| 37 |
+
'$addToSet': {
|
| 38 |
+
'filters': {
|
| 39 |
+
'filter_name': filter_name,
|
| 40 |
+
'content': content,
|
| 41 |
+
'text': text,
|
| 42 |
+
'data_type': data_type
|
| 43 |
+
}
|
| 44 |
+
}
|
| 45 |
+
},
|
| 46 |
+
upsert=True
|
| 47 |
+
)
|
| 48 |
+
else:
|
| 49 |
+
await filters.update_one(
|
| 50 |
+
{
|
| 51 |
+
'chat_id': chat_id,
|
| 52 |
+
'filters.filter_name': filter_name
|
| 53 |
+
},
|
| 54 |
+
{
|
| 55 |
+
'$set': {
|
| 56 |
+
'filters.$.filter_name': filter_name,
|
| 57 |
+
'filters.$.content': content,
|
| 58 |
+
'filters.$.text': text,
|
| 59 |
+
'filters.$.data_type': data_type
|
| 60 |
+
}
|
| 61 |
+
}
|
| 62 |
+
)
|
| 63 |
+
|
| 64 |
+
async def stop_db(chat_id: int, filter_name:str):
|
| 65 |
+
await filters.update_one(
|
| 66 |
+
{
|
| 67 |
+
'chat_id': chat_id
|
| 68 |
+
},
|
| 69 |
+
{
|
| 70 |
+
'$pull': {
|
| 71 |
+
'filters': {
|
| 72 |
+
'filter_name': filter_name
|
| 73 |
+
}
|
| 74 |
+
}
|
| 75 |
+
}
|
| 76 |
+
)
|
| 77 |
+
|
| 78 |
+
async def stop_all_db(chat_id: id):
|
| 79 |
+
await filters.update_one(
|
| 80 |
+
{
|
| 81 |
+
'chat_id': chat_id
|
| 82 |
+
},
|
| 83 |
+
{
|
| 84 |
+
'$set': {
|
| 85 |
+
'filters': []
|
| 86 |
+
}
|
| 87 |
+
},
|
| 88 |
+
upsert=True
|
| 89 |
+
)
|
| 90 |
+
|
| 91 |
+
async def get_filter(chat_id: int, filter_name: str):
|
| 92 |
+
filter_data = await filters.find_one(
|
| 93 |
+
{
|
| 94 |
+
'chat_id': chat_id
|
| 95 |
+
}
|
| 96 |
+
)
|
| 97 |
+
if filter_data is not None:
|
| 98 |
+
filters_ = filter_data['filters']
|
| 99 |
+
for filter_ in filters_:
|
| 100 |
+
if filter_['filter_name'] == filter_name:
|
| 101 |
+
content = filter_['content']
|
| 102 |
+
text = filter_['text']
|
| 103 |
+
data_type = filter_['data_type']
|
| 104 |
+
return (
|
| 105 |
+
filter_name,
|
| 106 |
+
content,
|
| 107 |
+
text,
|
| 108 |
+
data_type
|
| 109 |
+
)
|
| 110 |
+
|
| 111 |
+
async def get_filters_list(chat_id: int):
|
| 112 |
+
filter_data = await filters.find_one(
|
| 113 |
+
{
|
| 114 |
+
'chat_id': chat_id
|
| 115 |
+
}
|
| 116 |
+
)
|
| 117 |
+
if filter_data is not None:
|
| 118 |
+
FILTERS_NAME = list()
|
| 119 |
+
for filter_name in filter_data['filters']:
|
| 120 |
+
FILTERS_NAME.append(filter_name['filter_name'])
|
| 121 |
+
return FILTERS_NAME
|
| 122 |
+
else:
|
| 123 |
+
return []
|
SONALI/mongo/nightmodedb.py
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from config import MONGO_DB_URI
|
| 2 |
+
from motor.motor_asyncio import AsyncIOMotorClient as MongoCli
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
mongo = MongoCli(MONGO_DB_URI).Rankings
|
| 6 |
+
|
| 7 |
+
nightdb = mongo.nightmode
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
async def nightmode_on(chat_id: int):
|
| 11 |
+
return nightdb.insert_one({"chat_id": chat_id})
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
async def nightmode_off(chat_id: int):
|
| 15 |
+
return nightdb.delete_one({"chat_id": chat_id})
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
async def get_nightchats() -> list:
|
| 19 |
+
chats = nightdb.find({"chat_id": {"$lt": 0}})
|
| 20 |
+
if not chats:
|
| 21 |
+
return []
|
| 22 |
+
chats_list = []
|
| 23 |
+
for chat in await chats.to_list(length=1000000000):
|
| 24 |
+
chats_list.append(chat)
|
| 25 |
+
return chats_list
|
SONALI/mongo/notesdb.py
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from PURVIMUSIC.utils.mongo import db
|
| 2 |
+
|
| 3 |
+
#from PURVIMUSIC.mongo import *# back...............
|
| 4 |
+
|
| 5 |
+
notes = db.notes["notes"]
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
async def SaveNote(chat_id, note_name, content, text, data_type):
|
| 9 |
+
GetNotes = await notes.find_one(
|
| 10 |
+
{
|
| 11 |
+
'chat_id': chat_id
|
| 12 |
+
}
|
| 13 |
+
)
|
| 14 |
+
|
| 15 |
+
totalNote = await notes.count_documents({})
|
| 16 |
+
NotesIDs = totalNote + 1
|
| 17 |
+
if GetNotes == None:
|
| 18 |
+
NoteData = {
|
| 19 |
+
'_id': 1,
|
| 20 |
+
'chat_id': chat_id,
|
| 21 |
+
'notes': [
|
| 22 |
+
{
|
| 23 |
+
'_id': 1,
|
| 24 |
+
'note_name': note_name,
|
| 25 |
+
'content': content,
|
| 26 |
+
'text': text,
|
| 27 |
+
'data_type': data_type
|
| 28 |
+
}
|
| 29 |
+
]
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
await notes.insert_one(
|
| 33 |
+
NoteData
|
| 34 |
+
)
|
| 35 |
+
else:
|
| 36 |
+
NotesNamesList = []
|
| 37 |
+
if 'notes' in GetNotes:
|
| 38 |
+
totalNote = len(GetNotes['notes'])
|
| 39 |
+
NotesIDs = totalNote + 1
|
| 40 |
+
|
| 41 |
+
notesDict = GetNotes['notes']
|
| 42 |
+
|
| 43 |
+
for get_notes in notesDict:
|
| 44 |
+
note = get_notes['note_name']
|
| 45 |
+
NotesNamesList.append(note)
|
| 46 |
+
|
| 47 |
+
if note_name in NotesNamesList:
|
| 48 |
+
await notes.update(
|
| 49 |
+
{
|
| 50 |
+
'chat_id': chat_id,
|
| 51 |
+
'notes.note_name' : note_name
|
| 52 |
+
},
|
| 53 |
+
{
|
| 54 |
+
"$set": {
|
| 55 |
+
'notes.$.note_name': note_name,
|
| 56 |
+
'notes.$.content': content,
|
| 57 |
+
'notes.$.text': text,
|
| 58 |
+
'notes.$.data_type': data_type
|
| 59 |
+
}
|
| 60 |
+
},
|
| 61 |
+
False,
|
| 62 |
+
True
|
| 63 |
+
)
|
| 64 |
+
|
| 65 |
+
else:
|
| 66 |
+
await notes.update_one(
|
| 67 |
+
{
|
| 68 |
+
'chat_id': chat_id
|
| 69 |
+
},
|
| 70 |
+
{
|
| 71 |
+
"$push": {
|
| 72 |
+
'notes': {
|
| 73 |
+
'_id': NotesIDs,
|
| 74 |
+
'note_name': note_name,
|
| 75 |
+
'content': content,
|
| 76 |
+
'text': text,
|
| 77 |
+
'data_type': data_type
|
| 78 |
+
}
|
| 79 |
+
}
|
| 80 |
+
},
|
| 81 |
+
upsert=True
|
| 82 |
+
)
|
| 83 |
+
else:
|
| 84 |
+
await notes.update_one(
|
| 85 |
+
{
|
| 86 |
+
'chat_id': chat_id
|
| 87 |
+
},
|
| 88 |
+
{
|
| 89 |
+
"$set": {
|
| 90 |
+
'notes': [
|
| 91 |
+
{
|
| 92 |
+
'_id': NotesIDs,
|
| 93 |
+
'note_name': note_name,
|
| 94 |
+
'content': content,
|
| 95 |
+
'text': text,
|
| 96 |
+
'data_type': data_type
|
| 97 |
+
}
|
| 98 |
+
]
|
| 99 |
+
}
|
| 100 |
+
}
|
| 101 |
+
)
|
| 102 |
+
async def GetNote(chat_id, note_name):
|
| 103 |
+
GetNoteData = await notes.find_one(
|
| 104 |
+
{
|
| 105 |
+
'chat_id': chat_id
|
| 106 |
+
}
|
| 107 |
+
)
|
| 108 |
+
|
| 109 |
+
if not GetNoteData == None:
|
| 110 |
+
Getnotes = GetNoteData['notes']
|
| 111 |
+
for note in Getnotes:
|
| 112 |
+
GetNote = note['note_name']
|
| 113 |
+
if GetNote == note_name:
|
| 114 |
+
content = note['content']
|
| 115 |
+
text = note['text']
|
| 116 |
+
data_type = note['data_type']
|
| 117 |
+
return (
|
| 118 |
+
content,
|
| 119 |
+
text,
|
| 120 |
+
data_type
|
| 121 |
+
)
|
| 122 |
+
else:
|
| 123 |
+
return None
|
| 124 |
+
|
| 125 |
+
async def isNoteExist(chat_id, note_name) -> bool:
|
| 126 |
+
GetNoteData = await notes.find_one(
|
| 127 |
+
{
|
| 128 |
+
'chat_id': chat_id
|
| 129 |
+
}
|
| 130 |
+
)
|
| 131 |
+
if (
|
| 132 |
+
GetNoteData is not None
|
| 133 |
+
and 'notes' in GetNoteData
|
| 134 |
+
):
|
| 135 |
+
gnotes = GetNoteData['notes']
|
| 136 |
+
notes_list = []
|
| 137 |
+
for Getnotes in gnotes:
|
| 138 |
+
n_name = Getnotes['note_name']
|
| 139 |
+
notes_list.append(n_name)
|
| 140 |
+
if note_name in notes_list:
|
| 141 |
+
return True
|
| 142 |
+
else:
|
| 143 |
+
return False
|
| 144 |
+
return False
|
| 145 |
+
|
| 146 |
+
async def NoteList(chat_id) -> list:
|
| 147 |
+
NotesNamesList = []
|
| 148 |
+
GetNoteData = await notes.find_one(
|
| 149 |
+
{
|
| 150 |
+
'chat_id': chat_id
|
| 151 |
+
}
|
| 152 |
+
)
|
| 153 |
+
if not GetNoteData == None:
|
| 154 |
+
if 'notes' in GetNoteData:
|
| 155 |
+
Getnotes = GetNoteData['notes']
|
| 156 |
+
for note in Getnotes:
|
| 157 |
+
NoteText = note['text']
|
| 158 |
+
NoteNames = note['note_name']
|
| 159 |
+
if '{admin}' in NoteText:
|
| 160 |
+
NoteNames = NoteNames + ' ' + '__{admin}__'
|
| 161 |
+
NotesNamesList.append(NoteNames)
|
| 162 |
+
return NotesNamesList
|
| 163 |
+
else:
|
| 164 |
+
return NotesNamesList
|
| 165 |
+
else:
|
| 166 |
+
return NotesNamesList
|
| 167 |
+
|
| 168 |
+
|
| 169 |
+
async def ClearNote(chat_id, note_name):
|
| 170 |
+
await notes.update_one(
|
| 171 |
+
{
|
| 172 |
+
'chat_id': chat_id
|
| 173 |
+
},
|
| 174 |
+
{
|
| 175 |
+
"$pull": {
|
| 176 |
+
'notes': {
|
| 177 |
+
'note_name': note_name
|
| 178 |
+
}
|
| 179 |
+
}
|
| 180 |
+
}
|
| 181 |
+
)
|
| 182 |
+
|
| 183 |
+
async def is_pnote_on(chat_id) -> bool:
|
| 184 |
+
GetNoteData = await notes.find_one(
|
| 185 |
+
{
|
| 186 |
+
'chat_id': chat_id
|
| 187 |
+
}
|
| 188 |
+
)
|
| 189 |
+
if not GetNoteData == None:
|
| 190 |
+
if 'private_note' in GetNoteData:
|
| 191 |
+
private_note = GetNoteData['private_note']
|
| 192 |
+
return private_note
|
| 193 |
+
else:
|
| 194 |
+
return False
|
| 195 |
+
else:
|
| 196 |
+
return False
|
| 197 |
+
|
| 198 |
+
async def ClearAllNotes(chat_id):
|
| 199 |
+
await notes.update_one(
|
| 200 |
+
{
|
| 201 |
+
'chat_id': chat_id
|
| 202 |
+
},
|
| 203 |
+
{
|
| 204 |
+
"$unset": {
|
| 205 |
+
'notes': []
|
| 206 |
+
}
|
| 207 |
+
}
|
| 208 |
+
)
|
| 209 |
+
|
| 210 |
+
async def set_private_note(chat_id, private_note):
|
| 211 |
+
await notes.update_one(
|
| 212 |
+
{
|
| 213 |
+
'chat_id': chat_id
|
| 214 |
+
},
|
| 215 |
+
{
|
| 216 |
+
"$set": {
|
| 217 |
+
'private_note': private_note
|
| 218 |
+
}
|
| 219 |
+
},
|
| 220 |
+
upsert=True
|
| 221 |
+
)
|
SONALI/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
|
SONALI/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
|
SONALI/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)
|
SONALI/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
|
SONALI/platforms/Soundcloud.py
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from os import path
|
| 2 |
+
|
| 3 |
+
from yt_dlp import YoutubeDL
|
| 4 |
+
|
| 5 |
+
from SONALI.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
|
SONALI/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
|
SONALI/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 SONALI import app
|
| 10 |
+
from SONALI.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
|
SONALI/platforms/Youtube.py
ADDED
|
@@ -0,0 +1,353 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import asyncio
|
| 2 |
+
import os
|
| 3 |
+
import re
|
| 4 |
+
from typing import Union
|
| 5 |
+
|
| 6 |
+
import yt_dlp
|
| 7 |
+
from pyrogram.enums import MessageEntityType
|
| 8 |
+
from pyrogram.types import Message
|
| 9 |
+
from youtubesearchpython.__future__ import VideosSearch
|
| 10 |
+
|
| 11 |
+
from SONALI.utils.database import is_on_off
|
| 12 |
+
from SONALI.utils.formatters import time_to_seconds
|
| 13 |
+
|
| 14 |
+
async def shell_cmd(cmd):
|
| 15 |
+
proc = await asyncio.create_subprocess_shell(
|
| 16 |
+
cmd,
|
| 17 |
+
stdout=asyncio.subprocess.PIPE,
|
| 18 |
+
stderr=asyncio.subprocess.PIPE,
|
| 19 |
+
)
|
| 20 |
+
out, errorz = await proc.communicate()
|
| 21 |
+
if errorz:
|
| 22 |
+
if "unavailable videos are hidden" in (errorz.decode("utf-8")).lower():
|
| 23 |
+
return out.decode("utf-8")
|
| 24 |
+
else:
|
| 25 |
+
return errorz.decode("utf-8")
|
| 26 |
+
return out.decode("utf-8")
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
cookies_file = "SONALI/assets/cookies.txt"
|
| 30 |
+
|
| 31 |
+
class YouTubeAPI:
|
| 32 |
+
def __init__(self):
|
| 33 |
+
self.base = "https://www.youtube.com/watch?v="
|
| 34 |
+
self.regex = r"(?:youtube\.com|youtu\.be)"
|
| 35 |
+
self.status = "https://www.youtube.com/oembed?url="
|
| 36 |
+
self.listbase = "https://youtube.com/playlist?list="
|
| 37 |
+
self.reg = re.compile(r"\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])")
|
| 38 |
+
|
| 39 |
+
async def exists(self, link: str, videoid: Union[bool, str] = None):
|
| 40 |
+
if videoid:
|
| 41 |
+
link = self.base + link
|
| 42 |
+
if re.search(self.regex, link):
|
| 43 |
+
return True
|
| 44 |
+
else:
|
| 45 |
+
return False
|
| 46 |
+
|
| 47 |
+
async def url(self, message_1: Message) -> Union[str, None]:
|
| 48 |
+
messages = [message_1]
|
| 49 |
+
if message_1.reply_to_message:
|
| 50 |
+
messages.append(message_1.reply_to_message)
|
| 51 |
+
text = ""
|
| 52 |
+
offset = None
|
| 53 |
+
length = None
|
| 54 |
+
for message in messages:
|
| 55 |
+
if offset:
|
| 56 |
+
break
|
| 57 |
+
if message.entities:
|
| 58 |
+
for entity in message.entities:
|
| 59 |
+
if entity.type == MessageEntityType.URL:
|
| 60 |
+
text = message.text or message.caption
|
| 61 |
+
offset, length = entity.offset, entity.length
|
| 62 |
+
break
|
| 63 |
+
elif message.caption_entities:
|
| 64 |
+
for entity in message.caption_entities:
|
| 65 |
+
if entity.type == MessageEntityType.TEXT_LINK:
|
| 66 |
+
return entity.url
|
| 67 |
+
if offset in (None,):
|
| 68 |
+
return None
|
| 69 |
+
return text[offset : offset + length]
|
| 70 |
+
|
| 71 |
+
async def details(self, link: str, videoid: Union[bool, str] = None):
|
| 72 |
+
if videoid:
|
| 73 |
+
link = self.base + link
|
| 74 |
+
if "&" in link:
|
| 75 |
+
link = link.split("&")[0]
|
| 76 |
+
results = VideosSearch(link, limit=1)
|
| 77 |
+
for result in (await results.next())["result"]:
|
| 78 |
+
title = result["title"]
|
| 79 |
+
duration_min = result["duration"]
|
| 80 |
+
thumbnail = result["thumbnails"][0]["url"].split("?")[0]
|
| 81 |
+
vidid = result["id"]
|
| 82 |
+
if str(duration_min) == "None":
|
| 83 |
+
duration_sec = 0
|
| 84 |
+
else:
|
| 85 |
+
duration_sec = int(time_to_seconds(duration_min))
|
| 86 |
+
return title, duration_min, duration_sec, thumbnail, vidid
|
| 87 |
+
|
| 88 |
+
async def title(self, link: str, videoid: Union[bool, str] = None):
|
| 89 |
+
if videoid:
|
| 90 |
+
link = self.base + link
|
| 91 |
+
if "&" in link:
|
| 92 |
+
link = link.split("&")[0]
|
| 93 |
+
results = VideosSearch(link, limit=1)
|
| 94 |
+
for result in (await results.next())["result"]:
|
| 95 |
+
title = result["title"]
|
| 96 |
+
return title
|
| 97 |
+
|
| 98 |
+
async def duration(self, link: str, videoid: Union[bool, str] = None):
|
| 99 |
+
if videoid:
|
| 100 |
+
link = self.base + link
|
| 101 |
+
if "&" in link:
|
| 102 |
+
link = link.split("&")[0]
|
| 103 |
+
results = VideosSearch(link, limit=1)
|
| 104 |
+
for result in (await results.next())["result"]:
|
| 105 |
+
duration = result["duration"]
|
| 106 |
+
return duration
|
| 107 |
+
|
| 108 |
+
async def thumbnail(self, link: str, videoid: Union[bool, str] = None):
|
| 109 |
+
if videoid:
|
| 110 |
+
link = self.base + link
|
| 111 |
+
if "&" in link:
|
| 112 |
+
link = link.split("&")[0]
|
| 113 |
+
results = VideosSearch(link, limit=1)
|
| 114 |
+
for result in (await results.next())["result"]:
|
| 115 |
+
thumbnail = result["thumbnails"][0]["url"].split("?")[0]
|
| 116 |
+
return thumbnail
|
| 117 |
+
|
| 118 |
+
async def video(self, link: str, videoid: Union[bool, str] = None):
|
| 119 |
+
if videoid:
|
| 120 |
+
link = self.base + link
|
| 121 |
+
if "&" in link:
|
| 122 |
+
link = link.split("&")[0]
|
| 123 |
+
proc = await asyncio.create_subprocess_exec(
|
| 124 |
+
"yt-dlp",
|
| 125 |
+
"--cookies", cookies_file,
|
| 126 |
+
"-g",
|
| 127 |
+
"-f",
|
| 128 |
+
"best[height<=?720][width<=?1280]",
|
| 129 |
+
f"{link}",
|
| 130 |
+
stdout=asyncio.subprocess.PIPE,
|
| 131 |
+
stderr=asyncio.subprocess.PIPE,
|
| 132 |
+
)
|
| 133 |
+
stdout, stderr = await proc.communicate()
|
| 134 |
+
if stdout:
|
| 135 |
+
return 1, stdout.decode().split("\n")[0]
|
| 136 |
+
else:
|
| 137 |
+
return 0, stderr.decode()
|
| 138 |
+
|
| 139 |
+
async def playlist(self, link, limit, user_id, videoid: Union[bool, str] = None):
|
| 140 |
+
if videoid:
|
| 141 |
+
link = self.listbase + link
|
| 142 |
+
if "&" in link:
|
| 143 |
+
link = link.split("&")[0]
|
| 144 |
+
playlist = await shell_cmd(
|
| 145 |
+
f"yt-dlp --cookies {cookies_file} -i --get-id --flat-playlist --playlist-end {limit} --skip-download {link}"
|
| 146 |
+
)
|
| 147 |
+
try:
|
| 148 |
+
result = playlist.split("\n")
|
| 149 |
+
for key in result:
|
| 150 |
+
if key == "":
|
| 151 |
+
result.remove(key)
|
| 152 |
+
except:
|
| 153 |
+
result = []
|
| 154 |
+
return result
|
| 155 |
+
|
| 156 |
+
async def track(self, link: str, videoid: Union[bool, str] = None):
|
| 157 |
+
if videoid:
|
| 158 |
+
link = self.base + link
|
| 159 |
+
if "&" in link:
|
| 160 |
+
link = link.split("&")[0]
|
| 161 |
+
results = VideosSearch(link, limit=1)
|
| 162 |
+
for result in (await results.next())["result"]:
|
| 163 |
+
title = result["title"]
|
| 164 |
+
duration_min = result["duration"]
|
| 165 |
+
vidid = result["id"]
|
| 166 |
+
yturl = result["link"]
|
| 167 |
+
thumbnail = result["thumbnails"][0]["url"].split("?")[0]
|
| 168 |
+
track_details = {
|
| 169 |
+
"title": title,
|
| 170 |
+
"link": yturl,
|
| 171 |
+
"vidid": vidid,
|
| 172 |
+
"duration_min": duration_min,
|
| 173 |
+
"thumb": thumbnail,
|
| 174 |
+
}
|
| 175 |
+
return track_details, vidid
|
| 176 |
+
|
| 177 |
+
async def formats(self, link: str, videoid: Union[bool, str] = None):
|
| 178 |
+
if videoid:
|
| 179 |
+
link = self.base + link
|
| 180 |
+
if "&" in link:
|
| 181 |
+
link = link.split("&")[0]
|
| 182 |
+
ytdl_opts = {"quiet": True, "cookiefile": cookies_file}
|
| 183 |
+
ydl = yt_dlp.YoutubeDL(ytdl_opts)
|
| 184 |
+
with ydl:
|
| 185 |
+
formats_available = []
|
| 186 |
+
r = ydl.extract_info(link, download=False)
|
| 187 |
+
for format in r["formats"]:
|
| 188 |
+
try:
|
| 189 |
+
str(format["format"])
|
| 190 |
+
except:
|
| 191 |
+
continue
|
| 192 |
+
if not "dash" in str(format["format"]).lower():
|
| 193 |
+
try:
|
| 194 |
+
format["format"]
|
| 195 |
+
format["filesize"]
|
| 196 |
+
format["format_id"]
|
| 197 |
+
format["ext"]
|
| 198 |
+
format["format_note"]
|
| 199 |
+
except:
|
| 200 |
+
continue
|
| 201 |
+
formats_available.append(
|
| 202 |
+
{
|
| 203 |
+
"format": format["format"],
|
| 204 |
+
"filesize": format["filesize"],
|
| 205 |
+
"format_id": format["format_id"],
|
| 206 |
+
"ext": format["ext"],
|
| 207 |
+
"format_note": format["format_note"],
|
| 208 |
+
"yturl": link,
|
| 209 |
+
}
|
| 210 |
+
)
|
| 211 |
+
return formats_available, link
|
| 212 |
+
|
| 213 |
+
async def slider(
|
| 214 |
+
self,
|
| 215 |
+
link: str,
|
| 216 |
+
query_type: int,
|
| 217 |
+
videoid: Union[bool, str] = None,
|
| 218 |
+
):
|
| 219 |
+
if videoid:
|
| 220 |
+
link = self.base + link
|
| 221 |
+
if "&" in link:
|
| 222 |
+
link = link.split("&")[0]
|
| 223 |
+
a = VideosSearch(link, limit=10)
|
| 224 |
+
result = (await a.next()).get("result")
|
| 225 |
+
title = result[query_type]["title"]
|
| 226 |
+
duration_min = result[query_type]["duration"]
|
| 227 |
+
vidid = result[query_type]["id"]
|
| 228 |
+
thumbnail = result[query_type]["thumbnails"][0]["url"].split("?")[0]
|
| 229 |
+
return title, duration_min, thumbnail, vidid
|
| 230 |
+
|
| 231 |
+
async def download(
|
| 232 |
+
self,
|
| 233 |
+
link: str,
|
| 234 |
+
mystic,
|
| 235 |
+
video: Union[bool, str] = None,
|
| 236 |
+
videoid: Union[bool, str] = None,
|
| 237 |
+
songaudio: Union[bool, str] = None,
|
| 238 |
+
songvideo: Union[bool, str] = None,
|
| 239 |
+
format_id: Union[bool, str] = None,
|
| 240 |
+
title: Union[bool, str] = None,
|
| 241 |
+
) -> str:
|
| 242 |
+
if videoid:
|
| 243 |
+
link = self.base + link
|
| 244 |
+
loop = asyncio.get_running_loop()
|
| 245 |
+
|
| 246 |
+
def audio_dl():
|
| 247 |
+
ydl_optssx = {
|
| 248 |
+
"format": "bestaudio/best",
|
| 249 |
+
"outtmpl": "downloads/%(id)s.%(ext)s",
|
| 250 |
+
"geo_bypass": True,
|
| 251 |
+
"nocheckcertificate": True,
|
| 252 |
+
"quiet": True,
|
| 253 |
+
"no_warnings": True,
|
| 254 |
+
"cookiefile": cookies_file,
|
| 255 |
+
}
|
| 256 |
+
x = yt_dlp.YoutubeDL(ydl_optssx)
|
| 257 |
+
info = x.extract_info(link, False)
|
| 258 |
+
xyz = os.path.join("downloads", f"{info['id']}.{info['ext']}")
|
| 259 |
+
if os.path.exists(xyz):
|
| 260 |
+
return xyz
|
| 261 |
+
x.download([link])
|
| 262 |
+
return xyz
|
| 263 |
+
|
| 264 |
+
def video_dl():
|
| 265 |
+
ydl_optssx = {
|
| 266 |
+
"format": "(bestvideo[height<=?720][width<=?1280][ext=mp4])+(bestaudio[ext=m4a])",
|
| 267 |
+
"outtmpl": "downloads/%(id)s.%(ext)s",
|
| 268 |
+
"geo_bypass": True,
|
| 269 |
+
"nocheckcertificate": True,
|
| 270 |
+
"quiet": True,
|
| 271 |
+
"no_warnings": True,
|
| 272 |
+
"cookiefile": cookies_file,
|
| 273 |
+
}
|
| 274 |
+
x = yt_dlp.YoutubeDL(ydl_optssx)
|
| 275 |
+
info = x.extract_info(link, False)
|
| 276 |
+
xyz = os.path.join("downloads", f"{info['id']}.{info['ext']}")
|
| 277 |
+
if os.path.exists(xyz):
|
| 278 |
+
return xyz
|
| 279 |
+
x.download([link])
|
| 280 |
+
return xyz
|
| 281 |
+
|
| 282 |
+
def song_video_dl():
|
| 283 |
+
formats = f"{format_id}+140"
|
| 284 |
+
fpath = f"downloads/{title}"
|
| 285 |
+
ydl_optssx = {
|
| 286 |
+
"format": formats,
|
| 287 |
+
"outtmpl": fpath,
|
| 288 |
+
"geo_bypass": True,
|
| 289 |
+
"nocheckcertificate": True,
|
| 290 |
+
"quiet": True,
|
| 291 |
+
"no_warnings": True,
|
| 292 |
+
"prefer_ffmpeg": True,
|
| 293 |
+
"merge_output_format": "mp4",
|
| 294 |
+
"cookiefile": cookies_file, # Add cookie file option here
|
| 295 |
+
}
|
| 296 |
+
x = yt_dlp.YoutubeDL(ydl_optssx)
|
| 297 |
+
x.download([link])
|
| 298 |
+
|
| 299 |
+
def song_audio_dl():
|
| 300 |
+
fpath = f"downloads/{title}.%(ext)s"
|
| 301 |
+
ydl_optssx = {
|
| 302 |
+
"format": format_id,
|
| 303 |
+
"outtmpl": fpath,
|
| 304 |
+
"geo_bypass": True,
|
| 305 |
+
"nocheckcertificate": True,
|
| 306 |
+
"quiet": True,
|
| 307 |
+
"no_warnings": True,
|
| 308 |
+
"prefer_ffmpeg": True,
|
| 309 |
+
"postprocessors": [
|
| 310 |
+
{
|
| 311 |
+
"key": "FFmpegExtractAudio",
|
| 312 |
+
"preferredcodec": "mp3",
|
| 313 |
+
"preferredquality": "192",
|
| 314 |
+
}
|
| 315 |
+
],
|
| 316 |
+
"cookiefile": cookies_file, # Add cookie file option here
|
| 317 |
+
}
|
| 318 |
+
x = yt_dlp.YoutubeDL(ydl_optssx)
|
| 319 |
+
x.download([link])
|
| 320 |
+
|
| 321 |
+
if songvideo:
|
| 322 |
+
await loop.run_in_executor(None, song_video_dl)
|
| 323 |
+
fpath = f"downloads/{title}.mp4"
|
| 324 |
+
return fpath
|
| 325 |
+
elif songaudio:
|
| 326 |
+
await loop.run_in_executor(None, song_audio_dl)
|
| 327 |
+
fpath = f"downloads/{title}.mp3"
|
| 328 |
+
return fpath
|
| 329 |
+
elif video:
|
| 330 |
+
if await is_on_off(1):
|
| 331 |
+
direct = True
|
| 332 |
+
downloaded_file = await loop.run_in_executor(None, video_dl)
|
| 333 |
+
else:
|
| 334 |
+
proc = await asyncio.create_subprocess_exec(
|
| 335 |
+
"yt-dlp",
|
| 336 |
+
"--cookies", cookies_file,
|
| 337 |
+
"-g",
|
| 338 |
+
"-f",
|
| 339 |
+
"best[height<=?720][width<=?1280]",
|
| 340 |
+
f"{link}",
|
| 341 |
+
stdout=asyncio.subprocess.PIPE,
|
| 342 |
+
stderr=asyncio.subprocess.PIPE,
|
| 343 |
+
)
|
| 344 |
+
stdout, stderr = await proc.communicate()
|
| 345 |
+
if stdout:
|
| 346 |
+
downloaded_file = stdout.decode().split("\n")[0]
|
| 347 |
+
direct = None
|
| 348 |
+
else:
|
| 349 |
+
return
|
| 350 |
+
else:
|
| 351 |
+
direct = True
|
| 352 |
+
downloaded_file = await loop.run_in_executor(None, audio_dl)
|
| 353 |
+
return downloaded_file, direct
|
SONALI/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
|
SONALI/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"]
|
SONALI/plugins/admins/assistant.py
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import asyncio
|
| 2 |
+
from SONALI.misc import SUDOERS
|
| 3 |
+
from pyrogram import filters
|
| 4 |
+
from SONALI import app
|
| 5 |
+
import asyncio
|
| 6 |
+
from pyrogram import filters
|
| 7 |
+
from pyrogram.enums import ChatMemberStatus
|
| 8 |
+
from SONALI import app
|
| 9 |
+
from SONALI.utils.RAUSHAN_ban import admin_filter
|
| 10 |
+
from SONALI.utils.database import get_assistant
|
| 11 |
+
|
| 12 |
+
links = {}
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
@app.on_message(
|
| 16 |
+
filters.group
|
| 17 |
+
& filters.command(["userbotjoin", f"userbotjoin@{app.username}"])
|
| 18 |
+
& ~filters.private
|
| 19 |
+
)
|
| 20 |
+
async def join_group(client, message):
|
| 21 |
+
chat_id = message.chat.id
|
| 22 |
+
userbot = await get_assistant(message.chat.id)
|
| 23 |
+
userbot_id = userbot.id
|
| 24 |
+
done = await message.reply("**ᴘʟᴇᴀsᴇ ᴡᴀɪᴛ ɪɴᴠɪᴛɪɴɢ ᴀssɪsᴛᴀɴᴛ**...")
|
| 25 |
+
await asyncio.sleep(1)
|
| 26 |
+
# Get chat member object
|
| 27 |
+
chat_member = await app.get_chat_member(chat_id, app.id)
|
| 28 |
+
|
| 29 |
+
# Condition 1: Group username is present, bot is not admin
|
| 30 |
+
if (
|
| 31 |
+
message.chat.username
|
| 32 |
+
and not chat_member.status == ChatMemberStatus.ADMINISTRATOR
|
| 33 |
+
):
|
| 34 |
+
try:
|
| 35 |
+
await userbot.join_chat(message.chat.username)
|
| 36 |
+
await done.edit_text("**✅ ᴀssɪsᴛᴀɴᴛ ᴊᴏɪɴᴇᴅ.**")
|
| 37 |
+
except Exception as e:
|
| 38 |
+
await done.edit_text("**ɪ ɴᴇᴇᴅ ᴀᴅᴍɪɴ ᴘᴏᴡᴇʀ ᴛᴏ ᴜɴʙᴀɴ ɪɴᴠɪᴛᴇ ᴍʏ ᴀssɪsᴛᴀɴᴛ!**")
|
| 39 |
+
|
| 40 |
+
# Condition 2: Group username is present, bot is admin, and Userbot is not banned
|
| 41 |
+
if message.chat.username and chat_member.status == ChatMemberStatus.ADMINISTRATOR:
|
| 42 |
+
try:
|
| 43 |
+
await userbot.join_chat(message.chat.username)
|
| 44 |
+
await done.edit_text("**✅ ᴀssɪsᴛᴀɴᴛ ᴊᴏɪɴᴇᴅ.**")
|
| 45 |
+
except Exception as e:
|
| 46 |
+
await done.edit_text(str(e))
|
| 47 |
+
|
| 48 |
+
# Condition 3: Group username is not present/group is private, bot is admin and Userbot is banned
|
| 49 |
+
if message.chat.username and chat_member.status == ChatMemberStatus.ADMINISTRATOR:
|
| 50 |
+
userbot_member = await app.get_chat_member(chat_id, userbot.id)
|
| 51 |
+
if userbot_member.status in [
|
| 52 |
+
ChatMemberStatus.BANNED,
|
| 53 |
+
ChatMemberStatus.RESTRICTED,
|
| 54 |
+
]:
|
| 55 |
+
try:
|
| 56 |
+
await app.unban_chat_member(chat_id, userbot.id)
|
| 57 |
+
await done.edit_text("**ᴀssɪsᴛᴀɴᴛ ɪs ᴜɴʙᴀɴɴɪɴɢ...**")
|
| 58 |
+
await userbot.join_chat(message.chat.username)
|
| 59 |
+
await done.edit_text(
|
| 60 |
+
"**ᴀssɪsᴛᴀɴᴛ ᴡᴀs ʙᴀɴɴᴇᴅ, ʙᴜᴛ ɴᴏᴡ ᴜɴʙᴀɴɴᴇᴅ, ᴀɴᴅ ᴊᴏɪɴᴇᴅ ᴄʜᴀᴛ ✅**"
|
| 61 |
+
)
|
| 62 |
+
except Exception as e:
|
| 63 |
+
await done.edit_text(
|
| 64 |
+
"**ғᴀɪʟᴇᴅ ᴛᴏ ᴊᴏɪɴ, ᴘʟᴇᴀsᴇ ɢɪᴠᴇ ʙᴀɴ ᴘᴏᴡᴇʀ ᴀɴᴅ ɪɴᴠɪᴛᴇ ᴜsᴇʀ ᴘᴏᴡᴇʀ ᴏʀ ᴜɴʙᴀɴ ᴀssɪsᴛᴀɴᴛ ᴍᴀɴᴜᴀʟʟʏ ᴛʜᴇɴ ᴛʀʏ ᴀɢᴀɪɴ ʙʏ /userbotjoin**"
|
| 65 |
+
)
|
| 66 |
+
return
|
| 67 |
+
|
| 68 |
+
# Condition 4: Group username is not present/group is private, bot is not admin
|
| 69 |
+
if (
|
| 70 |
+
not message.chat.username
|
| 71 |
+
and not chat_member.status == ChatMemberStatus.ADMINISTRATOR
|
| 72 |
+
):
|
| 73 |
+
await done.edit_text("**ɪ ɴᴇᴇᴅ ᴀᴅᴍɪɴ ᴘᴏᴡᴇʀ ᴛᴏ ɪɴᴠɪᴛᴇ ᴍʏ ᴀssɪsᴛᴀɴᴛ.**")
|
| 74 |
+
|
| 75 |
+
# Condition 5: Group username is not present/group is private, bot is admin
|
| 76 |
+
if (
|
| 77 |
+
not message.chat.username
|
| 78 |
+
and chat_member.status == ChatMemberStatus.ADMINISTRATOR
|
| 79 |
+
):
|
| 80 |
+
try:
|
| 81 |
+
try:
|
| 82 |
+
userbot_member = await app.get_chat_member(chat_id, userbot.id)
|
| 83 |
+
if userbot_member.status not in [
|
| 84 |
+
ChatMemberStatus.BANNED,
|
| 85 |
+
ChatMemberStatus.RESTRICTED,
|
| 86 |
+
]:
|
| 87 |
+
await done.edit_text("**✅ ᴀssɪsᴛᴀɴᴛ ᴀʟʀᴇᴀᴅʏ ᴊᴏɪɴᴇᴅ.**")
|
| 88 |
+
return
|
| 89 |
+
except Exception as e:
|
| 90 |
+
await done.edit_text("**ᴘʟᴇᴀsᴇ ᴡᴀɪᴛ ɪɴᴠɪᴛɪɴɢ ᴀssɪsᴛᴀɴᴛ**.")
|
| 91 |
+
await done.edit_text("**ᴘʟᴇᴀsᴇ ᴡᴀɪᴛ ɪɴᴠɪᴛɪɴɢ ᴀssɪsᴛᴀɴᴛ**...")
|
| 92 |
+
invite_link = await app.create_chat_invite_link(
|
| 93 |
+
chat_id, expire_date=None
|
| 94 |
+
)
|
| 95 |
+
await asyncio.sleep(2)
|
| 96 |
+
await userbot.join_chat(invite_link.invite_link)
|
| 97 |
+
await done.edit_text("**✅ ᴀssɪsᴛᴀɴᴛ ᴊᴏɪɴᴇᴅ sᴜᴄᴄᴇssғᴜʟʟʏ.**")
|
| 98 |
+
except Exception as e:
|
| 99 |
+
await done.edit_text(
|
| 100 |
+
f"**➻ ᴀᴄᴛᴜᴀʟʟʏ ɪ ғᴏᴜɴᴅ ᴛʜᴀᴛ ᴍʏ ᴀssɪsᴛᴀɴᴛ ʜᴀs ɴᴏᴛ ᴊᴏɪɴ ᴛʜɪs ɢʀᴏᴜᴘ ᴀɴᴅ ɪ ᴀᴍ ɴᴏᴛ ᴀʙʟᴇ ᴛᴏ ɪɴᴠɪᴛᴇ ᴍʏ ᴀssɪsᴛᴀɴᴛ ʙᴇᴄᴀᴜsᴇ [ ɪ ᴅᴏɴᴛ ʜᴀᴠᴇ ɪɴᴠɪᴛᴇ ᴜsᴇʀ ᴀᴅᴍɪɴ ᴘᴏᴡᴇʀ ] sᴏ ᴘʟᴇᴀsᴇ ᴘʀᴏᴠɪᴅᴇ ᴍᴇ ɪɴᴠɪᴛᴇ ᴜsᴇʀs ᴀᴅᴍɪɴ ᴘᴏᴡᴇʀ ᴛʜᴇɴ ᴛʀʏ ᴀɢᴀɪɴ ʙʏ- /userbotjoin.**\n\n**➥ ɪᴅ »** @{userbot.username}"
|
| 101 |
+
)
|
| 102 |
+
|
| 103 |
+
# Condition 6: Group username is not present/group is private, bot is admin and Userbot is banned
|
| 104 |
+
if (
|
| 105 |
+
not message.chat.username
|
| 106 |
+
and chat_member.status == ChatMemberStatus.ADMINISTRATOR
|
| 107 |
+
):
|
| 108 |
+
userbot_member = await app.get_chat_member(chat_id, userbot.id)
|
| 109 |
+
if userbot_member.status in [
|
| 110 |
+
ChatMemberStatus.BANNED,
|
| 111 |
+
ChatMemberStatus.RESTRICTED,
|
| 112 |
+
]:
|
| 113 |
+
try:
|
| 114 |
+
await app.unban_chat_member(chat_id, userbot.id)
|
| 115 |
+
await done.edit_text(
|
| 116 |
+
"**ᴀssɪsᴛᴀɴᴛ ɪs ᴜɴʙᴀɴɴᴇᴅ**\n**ᴛʏᴘᴇ ᴀɢᴀɪɴ:- /userbotjoin.**"
|
| 117 |
+
)
|
| 118 |
+
invite_link = await app.create_chat_invite_link(
|
| 119 |
+
chat_id, expire_date=None
|
| 120 |
+
)
|
| 121 |
+
await asyncio.sleep(2)
|
| 122 |
+
await userbot.join_chat(invite_link.invite_link)
|
| 123 |
+
await done.edit_text(
|
| 124 |
+
"**ᴀssɪsᴛᴀɴᴛ ᴡᴀs ʙᴀɴɴᴇᴅ, ɴᴏᴡ ᴜɴʙᴀɴɴᴇᴅ, ᴀɴᴅ ᴊᴏɪɴᴇᴅ ᴄʜᴀᴛ✅**"
|
| 125 |
+
)
|
| 126 |
+
except Exception as e:
|
| 127 |
+
await done.edit_text(
|
| 128 |
+
f"**➻ ᴀᴄᴛᴜᴀʟʟʏ ɪ ғᴏᴜɴᴅ ᴛʜᴀᴛ ᴍʏ ᴀssɪsᴛᴀɴᴛ ɪs ʙᴀɴɴᴇᴅ ɪɴ ᴛʜɪs ɢʀᴏᴜᴘ ᴀɴᴅ ɪ ᴀᴍ ɴᴏᴛ ᴀʙʟᴇ ᴛᴏ ᴜɴʙᴀɴ ᴍʏ ᴀssɪsᴛᴀɴᴛ ʙᴇᴄᴀᴜsᴇ [ ɪ ᴅᴏɴᴛ ʜᴀᴠᴇ ʙᴀɴ ᴘᴏᴡᴇʀ ] sᴏ ᴘʟᴇᴀsᴇ ᴘʀᴏᴠɪᴅᴇ ᴍᴇ ʙᴀɴ ᴘᴏᴡᴇʀ ᴏʀ ᴜɴʙᴀɴ ᴍʏ ᴀssɪsᴛᴀɴᴛ ᴍᴀɴᴜᴀʟʟʏ ᴛʜᴇɴ ᴛʀʏ ᴀɢᴀɪɴ ʙʏ- /userbotjoin.**\n\n**➥ ɪᴅ »** @{userbot.username}"
|
| 129 |
+
)
|
| 130 |
+
return
|
| 131 |
+
|
| 132 |
+
|
| 133 |
+
@app.on_message(filters.command("userbotleave") & filters.group & admin_filter)
|
| 134 |
+
async def leave_one(client, message):
|
| 135 |
+
try:
|
| 136 |
+
userbot = await get_assistant(message.chat.id)
|
| 137 |
+
await userbot.leave_chat(message.chat.id)
|
| 138 |
+
await app.send_message(
|
| 139 |
+
message.chat.id, "**✅ ᴜsᴇʀʙᴏᴛ sᴜᴄᴄᴇssғᴜʟʟʏ ʟᴇғᴛ ᴛʜɪs Chat.**"
|
| 140 |
+
)
|
| 141 |
+
except Exception as e:
|
| 142 |
+
print(e)
|
| 143 |
+
|
| 144 |
+
|
| 145 |
+
@app.on_message(filters.command(["leaveall", f"leaveall@{app.username}"]) & SUDOERS)
|
| 146 |
+
async def leave_all(client, message):
|
| 147 |
+
if message.from_user.id not in SUDOERS:
|
| 148 |
+
return
|
| 149 |
+
|
| 150 |
+
left = 0
|
| 151 |
+
failed = 0
|
| 152 |
+
lol = await message.reply("🔄 **ᴜsᴇʀʙᴏᴛ** ʟᴇᴀᴠɪɴɢ ᴀʟʟ ᴄʜᴀᴛs !")
|
| 153 |
+
try:
|
| 154 |
+
userbot = await get_assistant(message.chat.id)
|
| 155 |
+
async for dialog in userbot.get_dialogs():
|
| 156 |
+
if dialog.chat.id == -1001733534088:
|
| 157 |
+
continue
|
| 158 |
+
try:
|
| 159 |
+
await userbot.leave_chat(dialog.chat.id)
|
| 160 |
+
left += 1
|
| 161 |
+
await lol.edit(
|
| 162 |
+
f"**ᴜsᴇʀʙᴏᴛ ʟᴇᴀᴠɪɴɢ ᴀʟʟ ɢʀᴏᴜᴘ...**\n\n**ʟᴇғᴛ:** {left} ᴄʜᴀᴛs.\n**ғᴀɪʟᴇᴅ:** {failed} ᴄʜᴀᴛs."
|
| 163 |
+
)
|
| 164 |
+
except BaseException:
|
| 165 |
+
failed += 1
|
| 166 |
+
await lol.edit(
|
| 167 |
+
f"**ᴜsᴇʀʙᴏᴛ ʟᴇᴀᴠɪɴɢ...**\n\n**ʟᴇғᴛ:** {left} chats.\n**ғᴀɪʟᴇᴅ:** {failed} chats."
|
| 168 |
+
)
|
| 169 |
+
await asyncio.sleep(3)
|
| 170 |
+
finally:
|
| 171 |
+
await app.send_message(
|
| 172 |
+
message.chat.id,
|
| 173 |
+
f"**✅ ʟᴇғᴛ ғʀᴏᴍ:* {left} chats.\n**❌ ғᴀɪʟᴇᴅ ɪɴ:** {failed} chats.",
|
| 174 |
+
)
|
SONALI/plugins/admins/auth.py
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pyrogram import filters
|
| 2 |
+
from pyrogram.types import Message
|
| 3 |
+
|
| 4 |
+
from SONALI import app
|
| 5 |
+
from SONALI.utils import extract_user, int_to_alpha
|
| 6 |
+
from SONALI.utils.database import (
|
| 7 |
+
delete_authuser,
|
| 8 |
+
get_authuser,
|
| 9 |
+
get_authuser_names,
|
| 10 |
+
save_authuser,
|
| 11 |
+
)
|
| 12 |
+
from SONALI.utils.decorators import AdminActual, language
|
| 13 |
+
from SONALI.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(_))
|
SONALI/plugins/admins/ban.py
ADDED
|
@@ -0,0 +1,420 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pyrogram import filters, enums
|
| 2 |
+
from pyrogram.types import (
|
| 3 |
+
InlineKeyboardButton,
|
| 4 |
+
InlineKeyboardMarkup,
|
| 5 |
+
ChatPermissions
|
| 6 |
+
)
|
| 7 |
+
from pyrogram.errors.exceptions.bad_request_400 import (
|
| 8 |
+
ChatAdminRequired,
|
| 9 |
+
UserAdminInvalid,
|
| 10 |
+
BadRequest
|
| 11 |
+
)
|
| 12 |
+
|
| 13 |
+
import datetime
|
| 14 |
+
from SONALI import app
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
def mention(user, name, mention=True):
|
| 20 |
+
if mention == True:
|
| 21 |
+
link = f"[{name}](tg://openmessage?user_id={user})"
|
| 22 |
+
else:
|
| 23 |
+
link = f"[{name}](https://t.me/{user})"
|
| 24 |
+
return link
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
async def get_userid_from_username(username):
|
| 29 |
+
try:
|
| 30 |
+
user = await app.get_users(username)
|
| 31 |
+
except:
|
| 32 |
+
return None
|
| 33 |
+
|
| 34 |
+
user_obj = [user.id, user.first_name]
|
| 35 |
+
return user_obj
|
| 36 |
+
|
| 37 |
+
|
| 38 |
+
async def ban_user(user_id, first_name, admin_id, admin_name, chat_id, reason, time=None):
|
| 39 |
+
try:
|
| 40 |
+
await app.ban_chat_member(chat_id, user_id)
|
| 41 |
+
except ChatAdminRequired:
|
| 42 |
+
msg_text = "Ban rights? Nah, I'm just here for the digital high-fives 🙌\nGive me ban rights! 😡🥺"
|
| 43 |
+
return msg_text, False
|
| 44 |
+
except UserAdminInvalid:
|
| 45 |
+
msg_text = "I wont ban an admin bruh!!"
|
| 46 |
+
return msg_text, False
|
| 47 |
+
except Exception as e:
|
| 48 |
+
if user_id == 6711389550:
|
| 49 |
+
msg_text = "why should i ban myself? sorry but I'm not stupid like you"
|
| 50 |
+
return msg_text, False
|
| 51 |
+
|
| 52 |
+
msg_text = f"opps!!\n{e}"
|
| 53 |
+
return msg_text, False
|
| 54 |
+
|
| 55 |
+
user_mention = mention(user_id, first_name)
|
| 56 |
+
admin_mention = mention(admin_id, admin_name)
|
| 57 |
+
|
| 58 |
+
msg_text += f""
|
| 59 |
+
msg_text += f"{user_mention} was banned by {admin_mention}\n"
|
| 60 |
+
|
| 61 |
+
if reason:
|
| 62 |
+
msg_text += f"Reason: `{reason}`\n"
|
| 63 |
+
if time:
|
| 64 |
+
msg_text += f"Time: `{time}`\n"
|
| 65 |
+
|
| 66 |
+
return msg_text, True
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
async def unban_user(user_id, first_name, admin_id, admin_name, chat_id):
|
| 70 |
+
try:
|
| 71 |
+
await app.unban_chat_member(chat_id, user_id)
|
| 72 |
+
except ChatAdminRequired:
|
| 73 |
+
msg_text = "Ban rights? Nah, I'm just here for the digital high-fives 🙌\nGive me ban rights! 😡🥺"
|
| 74 |
+
return msg_text
|
| 75 |
+
except Exception as e:
|
| 76 |
+
msg_text = f"opps!!\n{e}"
|
| 77 |
+
return msg_text
|
| 78 |
+
|
| 79 |
+
user_mention = mention(user_id, first_name)
|
| 80 |
+
admin_mention = mention(admin_id, admin_name)
|
| 81 |
+
|
| 82 |
+
msg_text = f"{user_mention} was unbanned by {admin_mention}"
|
| 83 |
+
return msg_text
|
| 84 |
+
|
| 85 |
+
|
| 86 |
+
|
| 87 |
+
async def mute_user(user_id, first_name, admin_id, admin_name, chat_id, reason, time=None):
|
| 88 |
+
try:
|
| 89 |
+
if time:
|
| 90 |
+
mute_end_time = datetime.datetime.now() + time
|
| 91 |
+
await app.restrict_chat_member(chat_id, user_id, ChatPermissions(), mute_end_time)
|
| 92 |
+
else:
|
| 93 |
+
await app.restrict_chat_member(chat_id, user_id, ChatPermissions())
|
| 94 |
+
except ChatAdminRequired:
|
| 95 |
+
msg_text = "Mute rights? Nah, I'm just here for the digital high-fives 🙌\nGive me mute rights! 😡🥺"
|
| 96 |
+
return msg_text, False
|
| 97 |
+
except UserAdminInvalid:
|
| 98 |
+
msg_text = "I wont mute an admin bruh!!"
|
| 99 |
+
return msg_text, False
|
| 100 |
+
except Exception as e:
|
| 101 |
+
if user_id == 6664582540:
|
| 102 |
+
msg_text = "why should i mute myself? sorry but I'm not stupid like you"
|
| 103 |
+
return msg_text, False
|
| 104 |
+
|
| 105 |
+
msg_text = f"opps!!\n{e}"
|
| 106 |
+
return msg_text, False
|
| 107 |
+
|
| 108 |
+
user_mention = mention(user_id, first_name)
|
| 109 |
+
admin_mention = mention(admin_id, admin_name)
|
| 110 |
+
|
| 111 |
+
msg_text += f"{user_mention} was muted by {admin_mention}\n"
|
| 112 |
+
|
| 113 |
+
if reason:
|
| 114 |
+
msg_text += f"Reason: `{reason}`\n"
|
| 115 |
+
if time:
|
| 116 |
+
msg_text += f"Time: `{time}`\n"
|
| 117 |
+
|
| 118 |
+
return msg_text, True
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
async def unmute_user(user_id, first_name, admin_id, admin_name, chat_id):
|
| 122 |
+
try:
|
| 123 |
+
await app.restrict_chat_member(
|
| 124 |
+
chat_id,
|
| 125 |
+
user_id,
|
| 126 |
+
ChatPermissions(
|
| 127 |
+
can_send_media_messages=True,
|
| 128 |
+
can_send_messages=True,
|
| 129 |
+
can_send_other_messages=True,
|
| 130 |
+
can_send_polls=True,
|
| 131 |
+
can_add_web_page_previews=True,
|
| 132 |
+
can_invite_users=True
|
| 133 |
+
)
|
| 134 |
+
)
|
| 135 |
+
except ChatAdminRequired:
|
| 136 |
+
msg_text = "Mute rights? Nah, I'm just here for the digital high-fives 🙌\nGive me unmute rights! 😡🥺"
|
| 137 |
+
return msg_text
|
| 138 |
+
except Exception as e:
|
| 139 |
+
msg_text = f"opps!!\n{e}"
|
| 140 |
+
return msg_text
|
| 141 |
+
|
| 142 |
+
user_mention = mention(user_id, first_name)
|
| 143 |
+
admin_mention = mention(admin_id, admin_name)
|
| 144 |
+
|
| 145 |
+
msg_text = f"{user_mention} was unmuted by {admin_mention}"
|
| 146 |
+
return msg_text
|
| 147 |
+
|
| 148 |
+
|
| 149 |
+
|
| 150 |
+
@app.on_message(filters.command(["ban"]))
|
| 151 |
+
async def ban_command_handler(client, message):
|
| 152 |
+
chat = message.chat
|
| 153 |
+
chat_id = chat.id
|
| 154 |
+
admin_id = message.from_user.id
|
| 155 |
+
admin_name = message.from_user.first_name
|
| 156 |
+
member = await chat.get_member(admin_id)
|
| 157 |
+
if member.status == enums.ChatMemberStatus.ADMINISTRATOR or member.status == enums.ChatMemberStatus.OWNER:
|
| 158 |
+
if member.privileges.can_restrict_members:
|
| 159 |
+
pass
|
| 160 |
+
else:
|
| 161 |
+
msg_text = "You dont have permission to ban someone"
|
| 162 |
+
return await message.reply_text(msg_text)
|
| 163 |
+
else:
|
| 164 |
+
msg_text = "You dont have permission to ban someone"
|
| 165 |
+
return await message.reply_text(msg_text)
|
| 166 |
+
|
| 167 |
+
# Extract the user ID from the command or reply
|
| 168 |
+
if len(message.command) > 1:
|
| 169 |
+
if message.reply_to_message:
|
| 170 |
+
user_id = message.reply_to_message.from_user.id
|
| 171 |
+
first_name = message.reply_to_message.from_user.first_name
|
| 172 |
+
reason = message.text.split(None, 1)[1]
|
| 173 |
+
else:
|
| 174 |
+
try:
|
| 175 |
+
user_id = int(message.command[1])
|
| 176 |
+
first_name = "User"
|
| 177 |
+
except:
|
| 178 |
+
user_obj = await get_userid_from_username(message.command[1])
|
| 179 |
+
if user_obj == None:
|
| 180 |
+
return await message.reply_text("I can't find that user")
|
| 181 |
+
user_id = user_obj[0]
|
| 182 |
+
first_name = user_obj[1]
|
| 183 |
+
|
| 184 |
+
try:
|
| 185 |
+
reason = message.text.partition(message.command[1])[2]
|
| 186 |
+
except:
|
| 187 |
+
reason = None
|
| 188 |
+
|
| 189 |
+
elif message.reply_to_message:
|
| 190 |
+
user_id = message.reply_to_message.from_user.id
|
| 191 |
+
first_name = message.reply_to_message.from_user.first_name
|
| 192 |
+
reason = None
|
| 193 |
+
else:
|
| 194 |
+
await message.reply_text("Please specify a valid user or reply to that user's message")
|
| 195 |
+
return
|
| 196 |
+
|
| 197 |
+
msg_text, result = await ban_user(user_id, first_name, admin_id, admin_name, chat_id, reason)
|
| 198 |
+
if result == True:
|
| 199 |
+
await message.reply_text(msg_text)
|
| 200 |
+
if result == False:
|
| 201 |
+
await message.reply_text(msg_text)
|
| 202 |
+
|
| 203 |
+
|
| 204 |
+
@app.on_message(filters.command(["unban"]))
|
| 205 |
+
async def unban_command_handler(client, message):
|
| 206 |
+
chat = message.chat
|
| 207 |
+
chat_id = chat.id
|
| 208 |
+
admin_id = message.from_user.id
|
| 209 |
+
admin_name = message.from_user.first_name
|
| 210 |
+
member = await chat.get_member(admin_id)
|
| 211 |
+
if member.status == enums.ChatMemberStatus.ADMINISTRATOR or member.status == enums.ChatMemberStatus.OWNER:
|
| 212 |
+
if member.privileges.can_restrict_members:
|
| 213 |
+
pass
|
| 214 |
+
else:
|
| 215 |
+
msg_text = "You dont have permission to unban someone"
|
| 216 |
+
return await message.reply_text(msg_text)
|
| 217 |
+
else:
|
| 218 |
+
msg_text = "You dont have permission to unban someone"
|
| 219 |
+
return await message.reply_text(msg_text)
|
| 220 |
+
|
| 221 |
+
# Extract the user ID from the command or reply
|
| 222 |
+
if len(message.command) > 1:
|
| 223 |
+
try:
|
| 224 |
+
user_id = int(message.command[1])
|
| 225 |
+
first_name = "User"
|
| 226 |
+
except:
|
| 227 |
+
user_obj = await get_userid_from_username(message.command[1])
|
| 228 |
+
if user_obj == None:
|
| 229 |
+
return await message.reply_text("I can't find that user")
|
| 230 |
+
user_id = user_obj[0]
|
| 231 |
+
first_name = user_obj[1]
|
| 232 |
+
|
| 233 |
+
elif message.reply_to_message:
|
| 234 |
+
user_id = message.reply_to_message.from_user.id
|
| 235 |
+
first_name = message.reply_to_message.from_user.first_name
|
| 236 |
+
else:
|
| 237 |
+
await message.reply_text("Please specify a valid user or reply to that user's message")
|
| 238 |
+
return
|
| 239 |
+
|
| 240 |
+
msg_text = await unban_user(user_id, first_name, admin_id, admin_name, chat_id)
|
| 241 |
+
await message.reply_text(msg_text)
|
| 242 |
+
|
| 243 |
+
|
| 244 |
+
|
| 245 |
+
|
| 246 |
+
@app.on_message(filters.command(["mute"]))
|
| 247 |
+
async def mute_command_handler(client, message):
|
| 248 |
+
chat = message.chat
|
| 249 |
+
chat_id = chat.id
|
| 250 |
+
admin_id = message.from_user.id
|
| 251 |
+
admin_name = message.from_user.first_name
|
| 252 |
+
member = await chat.get_member(admin_id)
|
| 253 |
+
if member.status == enums.ChatMemberStatus.ADMINISTRATOR or member.status == enums.ChatMemberStatus.OWNER:
|
| 254 |
+
if member.privileges.can_restrict_members:
|
| 255 |
+
pass
|
| 256 |
+
else:
|
| 257 |
+
msg_text = "You dont have permission to mute someone"
|
| 258 |
+
return await message.reply_text(msg_text)
|
| 259 |
+
else:
|
| 260 |
+
msg_text = "You dont have permission to mute someone"
|
| 261 |
+
return await message.reply_text(msg_text)
|
| 262 |
+
|
| 263 |
+
# Extract the user ID from the command or reply
|
| 264 |
+
if len(message.command) > 1:
|
| 265 |
+
if message.reply_to_message:
|
| 266 |
+
user_id = message.reply_to_message.from_user.id
|
| 267 |
+
first_name = message.reply_to_message.from_user.first_name
|
| 268 |
+
reason = message.text.split(None, 1)[1]
|
| 269 |
+
else:
|
| 270 |
+
try:
|
| 271 |
+
user_id = int(message.command[1])
|
| 272 |
+
first_name = "User"
|
| 273 |
+
except:
|
| 274 |
+
user_obj = await get_userid_from_username(message.command[1])
|
| 275 |
+
if user_obj == None:
|
| 276 |
+
return await message.reply_text("I can't find that user")
|
| 277 |
+
user_id = user_obj[0]
|
| 278 |
+
first_name = user_obj[1]
|
| 279 |
+
|
| 280 |
+
try:
|
| 281 |
+
reason = message.text.partition(message.command[1])[2]
|
| 282 |
+
except:
|
| 283 |
+
reason = None
|
| 284 |
+
|
| 285 |
+
elif message.reply_to_message:
|
| 286 |
+
user_id = message.reply_to_message.from_user.id
|
| 287 |
+
first_name = message.reply_to_message.from_user.first_name
|
| 288 |
+
reason = None
|
| 289 |
+
else:
|
| 290 |
+
await message.reply_text("Please specify a valid user or reply to that user's message")
|
| 291 |
+
return
|
| 292 |
+
|
| 293 |
+
msg_text, result = await mute_user(user_id, first_name, admin_id, admin_name, chat_id, reason)
|
| 294 |
+
if result == True:
|
| 295 |
+
await message.reply_text(msg_text)
|
| 296 |
+
|
| 297 |
+
if result == False:
|
| 298 |
+
await message.reply_text(msg_text)
|
| 299 |
+
|
| 300 |
+
|
| 301 |
+
@app.on_message(filters.command(["unmute"]))
|
| 302 |
+
async def unmute_command_handler(client, message):
|
| 303 |
+
chat = message.chat
|
| 304 |
+
chat_id = chat.id
|
| 305 |
+
admin_id = message.from_user.id
|
| 306 |
+
admin_name = message.from_user.first_name
|
| 307 |
+
member = await chat.get_member(admin_id)
|
| 308 |
+
if member.status == enums.ChatMemberStatus.ADMINISTRATOR or member.status == enums.ChatMemberStatus.OWNER:
|
| 309 |
+
if member.privileges.can_restrict_members:
|
| 310 |
+
pass
|
| 311 |
+
else:
|
| 312 |
+
msg_text = "You dont have permission to unmute someone"
|
| 313 |
+
return await message.reply_text(msg_text)
|
| 314 |
+
else:
|
| 315 |
+
msg_text = "You dont have permission to unmute someone"
|
| 316 |
+
return await message.reply_text(msg_text)
|
| 317 |
+
|
| 318 |
+
# Extract the user ID from the command or reply
|
| 319 |
+
if len(message.command) > 1:
|
| 320 |
+
try:
|
| 321 |
+
user_id = int(message.command[1])
|
| 322 |
+
first_name = "User"
|
| 323 |
+
except:
|
| 324 |
+
user_obj = await get_userid_from_username(message.command[1])
|
| 325 |
+
if user_obj == None:
|
| 326 |
+
return await message.reply_text("I can't find that user")
|
| 327 |
+
user_id = user_obj[0]
|
| 328 |
+
first_name = user_obj[1]
|
| 329 |
+
|
| 330 |
+
elif message.reply_to_message:
|
| 331 |
+
user_id = message.reply_to_message.from_user.id
|
| 332 |
+
first_name = message.reply_to_message.from_user.first_name
|
| 333 |
+
else:
|
| 334 |
+
await message.reply_text("Please specify a valid user or reply to that user's message")
|
| 335 |
+
return
|
| 336 |
+
|
| 337 |
+
msg_text = await unmute_user(user_id, first_name, admin_id, admin_name, chat_id)
|
| 338 |
+
await message.reply_text(msg_text)
|
| 339 |
+
|
| 340 |
+
|
| 341 |
+
|
| 342 |
+
|
| 343 |
+
|
| 344 |
+
@app.on_message(filters.command(["tmute"]))
|
| 345 |
+
async def tmute_command_handler(client, message):
|
| 346 |
+
chat = message.chat
|
| 347 |
+
chat_id = chat.id
|
| 348 |
+
admin_id = message.from_user.id
|
| 349 |
+
admin_name = message.from_user.first_name
|
| 350 |
+
member = await chat.get_member(admin_id)
|
| 351 |
+
if member.status == enums.ChatMemberStatus.ADMINISTRATOR or member.status == enums.ChatMemberStatus.OWNER:
|
| 352 |
+
if member.privileges.can_restrict_members:
|
| 353 |
+
pass
|
| 354 |
+
else:
|
| 355 |
+
msg_text = "You dont have permission to mute someone"
|
| 356 |
+
return await message.reply_text(msg_text)
|
| 357 |
+
else:
|
| 358 |
+
msg_text = "You dont have permission to mute someone"
|
| 359 |
+
return await message.reply_text(msg_text)
|
| 360 |
+
|
| 361 |
+
# Extract the user ID from the command or reply
|
| 362 |
+
if len(message.command) > 1:
|
| 363 |
+
if message.reply_to_message:
|
| 364 |
+
user_id = message.reply_to_message.from_user.id
|
| 365 |
+
first_name = message.reply_to_message.from_user.first_name
|
| 366 |
+
time = message.text.split(None, 1)[1]
|
| 367 |
+
|
| 368 |
+
try:
|
| 369 |
+
time_amount = time.split(time[-1])[0]
|
| 370 |
+
time_amount = int(time_amount)
|
| 371 |
+
except:
|
| 372 |
+
return await message.reply_text("wrong format!!\nFormat: `/tmute 2m`")
|
| 373 |
+
|
| 374 |
+
if time[-1] == "m":
|
| 375 |
+
mute_duration = datetime.timedelta(minutes=time_amount)
|
| 376 |
+
elif time[-1] == "h":
|
| 377 |
+
mute_duration = datetime.timedelta(hours=time_amount)
|
| 378 |
+
elif time[-1] == "d":
|
| 379 |
+
mute_duration = datetime.timedelta(days=time_amount)
|
| 380 |
+
else:
|
| 381 |
+
return await message.reply_text("wrong format!!\nFormat:\nm: Minutes\nh: Hours\nd: Days")
|
| 382 |
+
else:
|
| 383 |
+
try:
|
| 384 |
+
user_id = int(message.command[1])
|
| 385 |
+
first_name = "User"
|
| 386 |
+
except:
|
| 387 |
+
user_obj = await get_userid_from_username(message.command[1])
|
| 388 |
+
if user_obj == None:
|
| 389 |
+
return await message.reply_text("I can't find that user")
|
| 390 |
+
user_id = user_obj[0]
|
| 391 |
+
first_name = user_obj[1]
|
| 392 |
+
|
| 393 |
+
try:
|
| 394 |
+
time = message.text.partition(message.command[1])[2]
|
| 395 |
+
try:
|
| 396 |
+
time_amount = time.split(time[-1])[0]
|
| 397 |
+
time_amount = int(time_amount)
|
| 398 |
+
except:
|
| 399 |
+
return await message.reply_text("wrong format!!\nFormat: `/tmute 2m`")
|
| 400 |
+
|
| 401 |
+
if time[-1] == "m":
|
| 402 |
+
mute_duration = datetime.timedelta(minutes=time_amount)
|
| 403 |
+
elif time[-1] == "h":
|
| 404 |
+
mute_duration = datetime.timedelta(hours=time_amount)
|
| 405 |
+
elif time[-1] == "d":
|
| 406 |
+
mute_duration = datetime.timedelta(days=time_amount)
|
| 407 |
+
else:
|
| 408 |
+
return await message.reply_text("wrong format!!\nFormat:\nm: Minutes\nh: Hours\nd: Days")
|
| 409 |
+
except:
|
| 410 |
+
return await message.reply_text("Please specify a valid user or reply to that user's message\nFormat: `/tmute @user 2m`")
|
| 411 |
+
|
| 412 |
+
else:
|
| 413 |
+
await message.reply_text("Please specify a valid user or reply to that user's message\nFormat: /tmute <username> <time>")
|
| 414 |
+
return
|
| 415 |
+
|
| 416 |
+
msg_text, result = await mute_user(user_id, first_name, admin_id, admin_name, chat_id, reason=None, time=mute_duration)
|
| 417 |
+
if result == True:
|
| 418 |
+
await message.reply_text(msg_text)
|
| 419 |
+
if result == False:
|
| 420 |
+
await message.reply_text(msg_text)
|
SONALI/plugins/admins/callback.py
ADDED
|
@@ -0,0 +1,423 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import asyncio
|
| 2 |
+
|
| 3 |
+
from pyrogram import filters
|
| 4 |
+
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup
|
| 5 |
+
|
| 6 |
+
from SONALI import YouTube, app
|
| 7 |
+
from SONALI.core.call import RAUSHAN
|
| 8 |
+
from SONALI.misc import SUDOERS, db
|
| 9 |
+
from SONALI.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 SONALI.utils.decorators.language import languageCB
|
| 21 |
+
from SONALI.utils.formatters import seconds_to_min
|
| 22 |
+
from SONALI.utils.inline import (
|
| 23 |
+
close_markup,
|
| 24 |
+
stream_markup,
|
| 25 |
+
stream_markup_timer,
|
| 26 |
+
telegram_markup,
|
| 27 |
+
telegram_markup_timer,
|
| 28 |
+
)
|
| 29 |
+
from SONALI.utils.stream.autoclear import auto_clean
|
| 30 |
+
from SONALI.utils.thumbnails import get_thumb
|
| 31 |
+
from config import (
|
| 32 |
+
BANNED_USERS,
|
| 33 |
+
SOUNCLOUD_IMG_URL,
|
| 34 |
+
STREAM_IMG_URL,
|
| 35 |
+
TELEGRAM_AUDIO_URL,
|
| 36 |
+
TELEGRAM_VIDEO_URL,
|
| 37 |
+
adminlist,
|
| 38 |
+
confirmer,
|
| 39 |
+
votemode,
|
| 40 |
+
)
|
| 41 |
+
from strings import get_string
|
| 42 |
+
|
| 43 |
+
checker = {}
|
| 44 |
+
upvoters = {}
|
| 45 |
+
|
| 46 |
+
|
| 47 |
+
@app.on_callback_query(filters.regex("ADMIN") & ~BANNED_USERS)
|
| 48 |
+
@languageCB
|
| 49 |
+
async def del_back_playlist(client, CallbackQuery, _):
|
| 50 |
+
callback_data = CallbackQuery.data.strip()
|
| 51 |
+
callback_request = callback_data.split(None, 1)[1]
|
| 52 |
+
command, chat = callback_request.split("|")
|
| 53 |
+
if "_" in str(chat):
|
| 54 |
+
bet = chat.split("_")
|
| 55 |
+
chat = bet[0]
|
| 56 |
+
counter = bet[1]
|
| 57 |
+
chat_id = int(chat)
|
| 58 |
+
if not await is_active_chat(chat_id):
|
| 59 |
+
return await CallbackQuery.answer(_["general_5"], show_alert=True)
|
| 60 |
+
mention = CallbackQuery.from_user.mention
|
| 61 |
+
if command == "UpVote":
|
| 62 |
+
if chat_id not in votemode:
|
| 63 |
+
votemode[chat_id] = {}
|
| 64 |
+
if chat_id not in upvoters:
|
| 65 |
+
upvoters[chat_id] = {}
|
| 66 |
+
|
| 67 |
+
voters = (upvoters[chat_id]).get(CallbackQuery.message.id)
|
| 68 |
+
if not voters:
|
| 69 |
+
upvoters[chat_id][CallbackQuery.message.id] = []
|
| 70 |
+
|
| 71 |
+
vote = (votemode[chat_id]).get(CallbackQuery.message.id)
|
| 72 |
+
if not vote:
|
| 73 |
+
votemode[chat_id][CallbackQuery.message.id] = 0
|
| 74 |
+
|
| 75 |
+
if CallbackQuery.from_user.id in upvoters[chat_id][CallbackQuery.message.id]:
|
| 76 |
+
(upvoters[chat_id][CallbackQuery.message.id]).remove(
|
| 77 |
+
CallbackQuery.from_user.id
|
| 78 |
+
)
|
| 79 |
+
votemode[chat_id][CallbackQuery.message.id] -= 1
|
| 80 |
+
else:
|
| 81 |
+
(upvoters[chat_id][CallbackQuery.message.id]).append(
|
| 82 |
+
CallbackQuery.from_user.id
|
| 83 |
+
)
|
| 84 |
+
votemode[chat_id][CallbackQuery.message.id] += 1
|
| 85 |
+
upvote = await get_upvote_count(chat_id)
|
| 86 |
+
get_upvotes = int(votemode[chat_id][CallbackQuery.message.id])
|
| 87 |
+
if get_upvotes >= upvote:
|
| 88 |
+
votemode[chat_id][CallbackQuery.message.id] = upvote
|
| 89 |
+
try:
|
| 90 |
+
exists = confirmer[chat_id][CallbackQuery.message.id]
|
| 91 |
+
current = db[chat_id][0]
|
| 92 |
+
except:
|
| 93 |
+
return await CallbackQuery.edit_message_text(f"ғᴀɪʟᴇᴅ.")
|
| 94 |
+
try:
|
| 95 |
+
if current["vidid"] != exists["vidid"]:
|
| 96 |
+
return await CallbackQuery.edit_message.text(_["admin_35"])
|
| 97 |
+
if current["file"] != exists["file"]:
|
| 98 |
+
return await CallbackQuery.edit_message.text(_["admin_35"])
|
| 99 |
+
except:
|
| 100 |
+
return await CallbackQuery.edit_message_text(_["admin_36"])
|
| 101 |
+
try:
|
| 102 |
+
await CallbackQuery.edit_message_text(_["admin_37"].format(upvote))
|
| 103 |
+
except:
|
| 104 |
+
pass
|
| 105 |
+
command = counter
|
| 106 |
+
mention = "ᴜᴘᴠᴏᴛᴇs"
|
| 107 |
+
else:
|
| 108 |
+
if (
|
| 109 |
+
CallbackQuery.from_user.id
|
| 110 |
+
in upvoters[chat_id][CallbackQuery.message.id]
|
| 111 |
+
):
|
| 112 |
+
await CallbackQuery.answer(_["admin_38"], show_alert=True)
|
| 113 |
+
else:
|
| 114 |
+
await CallbackQuery.answer(_["admin_39"], show_alert=True)
|
| 115 |
+
upl = InlineKeyboardMarkup(
|
| 116 |
+
[
|
| 117 |
+
[
|
| 118 |
+
InlineKeyboardButton(
|
| 119 |
+
text=f"👍 {get_upvotes}",
|
| 120 |
+
callback_data=f"ADMIN UpVote|{chat_id}_{counter}",
|
| 121 |
+
)
|
| 122 |
+
]
|
| 123 |
+
]
|
| 124 |
+
)
|
| 125 |
+
await CallbackQuery.answer(_["admin_40"], show_alert=True)
|
| 126 |
+
return await CallbackQuery.edit_message_reply_markup(reply_markup=upl)
|
| 127 |
+
else:
|
| 128 |
+
is_non_admin = await is_nonadmin_chat(CallbackQuery.message.chat.id)
|
| 129 |
+
if not is_non_admin:
|
| 130 |
+
if CallbackQuery.from_user.id not in SUDOERS:
|
| 131 |
+
admins = adminlist.get(CallbackQuery.message.chat.id)
|
| 132 |
+
if not admins:
|
| 133 |
+
return await CallbackQuery.answer(_["admin_13"], show_alert=True)
|
| 134 |
+
else:
|
| 135 |
+
if CallbackQuery.from_user.id not in admins:
|
| 136 |
+
return await CallbackQuery.answer(
|
| 137 |
+
_["admin_14"], show_alert=True
|
| 138 |
+
)
|
| 139 |
+
if command == "Pause":
|
| 140 |
+
if not await is_music_playing(chat_id):
|
| 141 |
+
return await CallbackQuery.answer(_["admin_1"], show_alert=True)
|
| 142 |
+
await CallbackQuery.answer()
|
| 143 |
+
await music_off(chat_id)
|
| 144 |
+
await RAUSHAN.pause_stream(chat_id)
|
| 145 |
+
await CallbackQuery.message.reply_text(
|
| 146 |
+
_["admin_2"].format(mention),
|
| 147 |
+
)
|
| 148 |
+
elif command == "Resume":
|
| 149 |
+
if await is_music_playing(chat_id):
|
| 150 |
+
return await CallbackQuery.answer(_["admin_3"], show_alert=True)
|
| 151 |
+
await CallbackQuery.answer()
|
| 152 |
+
await music_on(chat_id)
|
| 153 |
+
await RAUSHAN.resume_stream(chat_id)
|
| 154 |
+
await CallbackQuery.message.reply_text(
|
| 155 |
+
_["admin_4"].format(mention),
|
| 156 |
+
)
|
| 157 |
+
elif command == "Stop" or command == "End":
|
| 158 |
+
await CallbackQuery.answer()
|
| 159 |
+
await RAUSHAN.stop_stream(chat_id)
|
| 160 |
+
await set_loop(chat_id, 0)
|
| 161 |
+
await CallbackQuery.message.reply_text(
|
| 162 |
+
_["admin_5"].format(mention),
|
| 163 |
+
)
|
| 164 |
+
elif command == "Skip" or command == "Replay":
|
| 165 |
+
check = db.get(chat_id)
|
| 166 |
+
if command == "Skip":
|
| 167 |
+
txt = f"➻ sᴛʀᴇᴀᴍ sᴋɪᴩᴩᴇᴅ 🎄\n│ \n└ʙʏ : {mention} 🥀"
|
| 168 |
+
popped = None
|
| 169 |
+
try:
|
| 170 |
+
popped = check.pop(0)
|
| 171 |
+
if popped:
|
| 172 |
+
await auto_clean(popped)
|
| 173 |
+
if not check:
|
| 174 |
+
await CallbackQuery.edit_message_text(
|
| 175 |
+
f"➻ sᴛʀᴇᴀᴍ sᴋɪᴩᴩᴇᴅ 🎄\n│ \n└ʙʏ : {mention} 🥀"
|
| 176 |
+
)
|
| 177 |
+
await CallbackQuery.message.reply_text(
|
| 178 |
+
text=_["admin_6"].format(
|
| 179 |
+
mention, CallbackQuery.message.chat.title
|
| 180 |
+
),
|
| 181 |
+
|
| 182 |
+
)
|
| 183 |
+
try:
|
| 184 |
+
return await RAUSHAN.stop_stream(chat_id)
|
| 185 |
+
except:
|
| 186 |
+
return
|
| 187 |
+
except:
|
| 188 |
+
try:
|
| 189 |
+
await CallbackQuery.edit_message_text(
|
| 190 |
+
f"➻ sᴛʀᴇᴀᴍ sᴋɪᴩᴩᴇᴅ 🎄\n│ \n└ʙʏ : {mention} 🥀"
|
| 191 |
+
)
|
| 192 |
+
await CallbackQuery.message.reply_text(
|
| 193 |
+
text=_["admin_6"].format(
|
| 194 |
+
mention, CallbackQuery.message.chat.title
|
| 195 |
+
),
|
| 196 |
+
)
|
| 197 |
+
return await RAUSHAN.stop_stream(chat_id)
|
| 198 |
+
except:
|
| 199 |
+
return
|
| 200 |
+
else:
|
| 201 |
+
txt = f"➻ sᴛʀᴇᴀᴍ ʀᴇ-ᴘʟᴀʏᴇᴅ 🎄\n│ \n└ʙʏ : {mention} 🥀"
|
| 202 |
+
await CallbackQuery.answer()
|
| 203 |
+
queued = check[0]["file"]
|
| 204 |
+
title = (check[0]["title"]).title()
|
| 205 |
+
user = check[0]["by"]
|
| 206 |
+
duration = check[0]["dur"]
|
| 207 |
+
streamtype = check[0]["streamtype"]
|
| 208 |
+
videoid = check[0]["vidid"]
|
| 209 |
+
status = True if str(streamtype) == "video" else None
|
| 210 |
+
db[chat_id][0]["played"] = 0
|
| 211 |
+
exis = (check[0]).get("old_dur")
|
| 212 |
+
if exis:
|
| 213 |
+
db[chat_id][0]["dur"] = exis
|
| 214 |
+
db[chat_id][0]["seconds"] = check[0]["old_second"]
|
| 215 |
+
db[chat_id][0]["speed_path"] = None
|
| 216 |
+
db[chat_id][0]["speed"] = 1.0
|
| 217 |
+
if "live_" in queued:
|
| 218 |
+
n, link = await YouTube.video(videoid, True)
|
| 219 |
+
if n == 0:
|
| 220 |
+
return await CallbackQuery.message.reply_text(
|
| 221 |
+
text=_["admin_7"].format(title),
|
| 222 |
+
|
| 223 |
+
)
|
| 224 |
+
try:
|
| 225 |
+
image = await YouTube.thumbnail(videoid, True)
|
| 226 |
+
except:
|
| 227 |
+
image = None
|
| 228 |
+
try:
|
| 229 |
+
await RAUSHAN.skip_stream(chat_id, link, video=status, image=image)
|
| 230 |
+
except:
|
| 231 |
+
return await CallbackQuery.message.reply_text(_["call_6"])
|
| 232 |
+
button = telegram_markup(_, chat_id)
|
| 233 |
+
img = await get_thumb(videoid)
|
| 234 |
+
run = await CallbackQuery.message.reply_photo(
|
| 235 |
+
photo=img,
|
| 236 |
+
caption=_["stream_1"].format(
|
| 237 |
+
f"https://t.me/{app.username}?start=info_{videoid}",
|
| 238 |
+
title[:23],
|
| 239 |
+
duration,
|
| 240 |
+
user,
|
| 241 |
+
),
|
| 242 |
+
reply_markup=InlineKeyboardMarkup(button),
|
| 243 |
+
)
|
| 244 |
+
db[chat_id][0]["mystic"] = run
|
| 245 |
+
db[chat_id][0]["markup"] = "tg"
|
| 246 |
+
await CallbackQuery.edit_message_text(txt, reply_markup=close_markup(_))
|
| 247 |
+
elif "vid_" in queued:
|
| 248 |
+
mystic = await CallbackQuery.message.reply_text(
|
| 249 |
+
_["call_7"], disable_web_page_preview=True
|
| 250 |
+
)
|
| 251 |
+
try:
|
| 252 |
+
file_path, direct = await YouTube.download(
|
| 253 |
+
videoid,
|
| 254 |
+
mystic,
|
| 255 |
+
videoid=True,
|
| 256 |
+
video=status,
|
| 257 |
+
)
|
| 258 |
+
except Exception:
|
| 259 |
+
try:
|
| 260 |
+
file_path, direct = await YTB.download(
|
| 261 |
+
videoid,
|
| 262 |
+
mystic,
|
| 263 |
+
videoid=True,
|
| 264 |
+
video=status,
|
| 265 |
+
)
|
| 266 |
+
except:
|
| 267 |
+
return await mystic.edit_text(_["call_6"])
|
| 268 |
+
try:
|
| 269 |
+
image = await YouTube.thumbnail(videoid, True)
|
| 270 |
+
except:
|
| 271 |
+
image = None
|
| 272 |
+
try:
|
| 273 |
+
await RAUSHAN.skip_stream(chat_id, file_path, video=status, image=image)
|
| 274 |
+
except:
|
| 275 |
+
return await mystic.edit_text(_["call_6"])
|
| 276 |
+
button = stream_markup(_, videoid, chat_id)
|
| 277 |
+
img = await get_thumb(videoid)
|
| 278 |
+
run = await CallbackQuery.message.reply_photo(
|
| 279 |
+
photo=img,
|
| 280 |
+
caption=_["stream_1"].format(
|
| 281 |
+
f"https://t.me/{app.username}?start=info_{videoid}",
|
| 282 |
+
title[:23],
|
| 283 |
+
duration,
|
| 284 |
+
user,
|
| 285 |
+
),
|
| 286 |
+
reply_markup=InlineKeyboardMarkup(button),
|
| 287 |
+
)
|
| 288 |
+
db[chat_id][0]["mystic"] = run
|
| 289 |
+
db[chat_id][0]["markup"] = "stream"
|
| 290 |
+
await CallbackQuery.edit_message_text(txt, reply_markup=close_markup(_))
|
| 291 |
+
await mystic.delete()
|
| 292 |
+
elif "index_" in queued:
|
| 293 |
+
try:
|
| 294 |
+
await RAUSHAN.skip_stream(chat_id, videoid, video=status)
|
| 295 |
+
except:
|
| 296 |
+
return await CallbackQuery.message.reply_text(_["call_6"])
|
| 297 |
+
button = telegram_markup(_, chat_id)
|
| 298 |
+
run = await CallbackQuery.message.reply_photo(
|
| 299 |
+
photo=STREAM_IMG_URL,
|
| 300 |
+
caption=_["stream_2"].format(user),
|
| 301 |
+
reply_markup=InlineKeyboardMarkup(button),
|
| 302 |
+
)
|
| 303 |
+
db[chat_id][0]["mystic"] = run
|
| 304 |
+
db[chat_id][0]["markup"] = "tg"
|
| 305 |
+
await CallbackQuery.edit_message_text(txt, reply_markup=close_markup(_))
|
| 306 |
+
else:
|
| 307 |
+
if videoid == "telegram":
|
| 308 |
+
image = None
|
| 309 |
+
elif videoid == "soundcloud":
|
| 310 |
+
image = None
|
| 311 |
+
else:
|
| 312 |
+
try:
|
| 313 |
+
image = await YouTube.thumbnail(videoid, True)
|
| 314 |
+
except:
|
| 315 |
+
image = None
|
| 316 |
+
try:
|
| 317 |
+
await RAUSHAN.skip_stream(chat_id, queued, video=status, image=image)
|
| 318 |
+
except:
|
| 319 |
+
return await CallbackQuery.message.reply_text(_["call_6"])
|
| 320 |
+
if videoid == "telegram":
|
| 321 |
+
button = telegram_markup(_, chat_id)
|
| 322 |
+
run = await CallbackQuery.message.reply_photo(
|
| 323 |
+
photo=(
|
| 324 |
+
TELEGRAM_AUDIO_URL
|
| 325 |
+
if str(streamtype) == "audio"
|
| 326 |
+
else TELEGRAM_VIDEO_URL
|
| 327 |
+
),
|
| 328 |
+
caption=_["stream_1"].format(
|
| 329 |
+
config.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 |
+
elif videoid == "soundcloud":
|
| 336 |
+
button = telegram_markup(_, chat_id)
|
| 337 |
+
run = await CallbackQuery.message.reply_photo(
|
| 338 |
+
photo=(
|
| 339 |
+
SOUNCLOUD_IMG_URL
|
| 340 |
+
if str(streamtype) == "audio"
|
| 341 |
+
else TELEGRAM_VIDEO_URL
|
| 342 |
+
),
|
| 343 |
+
caption=_["stream_1"].format(
|
| 344 |
+
config.SUPPORT_CHAT, title[:23], duration, user
|
| 345 |
+
),
|
| 346 |
+
reply_markup=InlineKeyboardMarkup(button),
|
| 347 |
+
)
|
| 348 |
+
db[chat_id][0]["mystic"] = run
|
| 349 |
+
db[chat_id][0]["markup"] = "tg"
|
| 350 |
+
else:
|
| 351 |
+
button = stream_markup(_, videoid, chat_id)
|
| 352 |
+
img = await get_thumb(videoid)
|
| 353 |
+
run = await CallbackQuery.message.reply_photo(
|
| 354 |
+
photo=img,
|
| 355 |
+
caption=_["stream_1"].format(
|
| 356 |
+
f"https://t.me/{app.username}?start=info_{videoid}",
|
| 357 |
+
title[:23],
|
| 358 |
+
duration,
|
| 359 |
+
user,
|
| 360 |
+
),
|
| 361 |
+
reply_markup=InlineKeyboardMarkup(button),
|
| 362 |
+
)
|
| 363 |
+
db[chat_id][0]["mystic"] = run
|
| 364 |
+
db[chat_id][0]["markup"] = "stream"
|
| 365 |
+
await CallbackQuery.edit_message_text(txt, reply_markup=close_markup(_))
|
| 366 |
+
|
| 367 |
+
|
| 368 |
+
async def markup_timer():
|
| 369 |
+
while not await asyncio.sleep(4):
|
| 370 |
+
active_chats = await get_active_chats()
|
| 371 |
+
for chat_id in active_chats:
|
| 372 |
+
try:
|
| 373 |
+
if not await is_music_playing(chat_id):
|
| 374 |
+
continue
|
| 375 |
+
playing = db.get(chat_id)
|
| 376 |
+
if not playing:
|
| 377 |
+
continue
|
| 378 |
+
duration_seconds = int(playing[0]["seconds"])
|
| 379 |
+
if duration_seconds == 0:
|
| 380 |
+
continue
|
| 381 |
+
try:
|
| 382 |
+
mystic = playing[0]["mystic"]
|
| 383 |
+
markup = playing[0]["markup"]
|
| 384 |
+
except:
|
| 385 |
+
continue
|
| 386 |
+
try:
|
| 387 |
+
check = wrong[chat_id][mystic.id]
|
| 388 |
+
if check is False:
|
| 389 |
+
continue
|
| 390 |
+
except:
|
| 391 |
+
pass
|
| 392 |
+
try:
|
| 393 |
+
language = await get_lang(chat_id)
|
| 394 |
+
_ = get_string(language)
|
| 395 |
+
except:
|
| 396 |
+
_ = get_string("en")
|
| 397 |
+
try:
|
| 398 |
+
buttons = (
|
| 399 |
+
stream_markup_timer(
|
| 400 |
+
_,
|
| 401 |
+
playing[0]["vidid"],
|
| 402 |
+
chat_id,
|
| 403 |
+
seconds_to_min(playing[0]["played"]),
|
| 404 |
+
playing[0]["dur"],
|
| 405 |
+
)
|
| 406 |
+
if markup == "stream"
|
| 407 |
+
else telegram_markup_timer(
|
| 408 |
+
_,
|
| 409 |
+
chat_id,
|
| 410 |
+
seconds_to_min(playing[0]["played"]),
|
| 411 |
+
playing[0]["dur"],
|
| 412 |
+
)
|
| 413 |
+
)
|
| 414 |
+
await mystic.edit_reply_markup(
|
| 415 |
+
reply_markup=InlineKeyboardMarkup(buttons)
|
| 416 |
+
)
|
| 417 |
+
except:
|
| 418 |
+
continue
|
| 419 |
+
except:
|
| 420 |
+
continue
|
| 421 |
+
|
| 422 |
+
|
| 423 |
+
asyncio.create_task(markup_timer())
|
SONALI/plugins/admins/connection.py
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pyrogram import filters
|
| 2 |
+
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
|
| 3 |
+
from pyrogram.enums import ChatMembersFilter
|
| 4 |
+
from SONALI import app
|
| 5 |
+
from SONALI.utils.database import connect_to_chat
|
| 6 |
+
from SONALI.utils.decorators import AdminActual
|
| 7 |
+
from config import BANNED_USERS
|
| 8 |
+
|
| 9 |
+
|
| 10 |
+
@app.on_message(filters.command("connect") & filters.group & ~BANNED_USERS)
|
| 11 |
+
async def auth(client, message: Message):
|
| 12 |
+
admin_ids = [ member.user.id async for member in app.get_chat_members(message.chat.id, filter=ChatMembersFilter.ADMINISTRATORS)]
|
| 13 |
+
if not message.from_user.id in admin_ids:
|
| 14 |
+
return
|
| 15 |
+
user_id = message.from_user.id
|
| 16 |
+
chat_id = message.chat.id
|
| 17 |
+
# re = await connect_to_chat(message.from_user.id, message.chat.id)
|
| 18 |
+
|
| 19 |
+
markup = InlineKeyboardMarkup([[InlineKeyboardButton("ᴄᴏɴɴᴇᴄᴛ ᴛᴏ ᴄʜᴀᴛ ", url=f"http://t.me/{app.username}?start=connect_{chat_id}")]])
|
| 20 |
+
await message.reply_text("ᴛᴀᴘ ᴛʜᴇ ғᴏʟʟᴏᴡɪɴɢ ʙᴜᴛᴛᴏɴ ᴛᴏ ᴄᴏɴɴᴇᴄᴛ ᴛᴏ ᴛʜɪs ᴄʜᴀᴛ ɪɴ ᴘᴍ", reply_markup = markup)
|
SONALI/plugins/admins/gmtag.py
ADDED
|
@@ -0,0 +1,234 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from SONALI 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 |
+
" **➠ ᴘʜᴏɴᴇ ʀᴀᴋʜ ᴋᴀʀ sᴏ ᴊᴀ, ɴᴀʜɪ ᴛᴏ ʙʜᴏᴏᴛ ᴀᴀ ᴊᴀʏᴇɢᴀ..👻** ",
|
| 54 |
+
" **➠ ᴀᴡᴇᴇ ʙᴀʙᴜ sᴏɴᴀ ᴅɪɴ ᴍᴇɪɴ ᴋᴀʀ ʟᴇɴᴀ ᴀʙʜɪ sᴏ ᴊᴀᴏ..?? 🥲** ",
|
| 55 |
+
" **➠ ᴍᴜᴍᴍʏ ᴅᴇᴋʜᴏ ʏᴇ ᴀᴘɴᴇ ɢғ sᴇ ʙᴀᴀᴛ ᴋʀ ʀʜᴀ ʜ ʀᴀᴊᴀɪ ᴍᴇ ɢʜᴜs ᴋᴀʀ, sᴏ ɴᴀʜɪ ʀᴀʜᴀ 😜** ",
|
| 56 |
+
" **➠ ᴘᴀᴘᴀ ʏᴇ ᴅᴇᴋʜᴏ ᴀᴘɴᴇ ʙᴇᴛᴇ ᴋᴏ ʀᴀᴀᴛ ʙʜᴀʀ ᴘʜᴏɴᴇ ᴄʜᴀʟᴀ ʀʜᴀ ʜᴀɪ 🤭** ",
|
| 57 |
+
" **➠ ᴊᴀɴᴜ ᴀᴀᴊ ʀᴀᴀᴛ ᴋᴀ sᴄᴇɴᴇ ʙɴᴀ ʟᴇ..?? 🌠** ",
|
| 58 |
+
" **➠ ɢɴ sᴅ ᴛᴄ.. 🙂** ",
|
| 59 |
+
" **➠ ɢᴏᴏᴅ ɴɪɢʜᴛ sᴡᴇᴇᴛ ᴅʀᴇᴀᴍ ᴛᴀᴋᴇ ᴄᴀʀᴇ..?? ✨** ",
|
| 60 |
+
" **➠ ʀᴀᴀᴛ ʙʜᴜᴛ ʜᴏ ɢʏɪ ʜᴀɪ sᴏ ᴊᴀᴏ, ɢɴ..?? 🌌** ",
|
| 61 |
+
" **➠ ᴍᴜᴍᴍʏ ᴅᴇᴋʜᴏ 11 ʙᴀᴊɴᴇ ᴡᴀʟᴇ ʜᴀɪ ʏᴇ ᴀʙʜɪ ᴛᴀᴋ ᴘʜᴏɴᴇ ᴄʜᴀʟᴀ ʀʜᴀ ɴᴀʜɪ sᴏ ɴᴀʜɪ ʀʜᴀ 🕦** ",
|
| 62 |
+
" **➠ ᴋᴀʟ sᴜʙʜᴀ sᴄʜᴏᴏʟ ɴᴀʜɪ ᴊᴀɴᴀ ᴋʏᴀ, ᴊᴏ ᴀʙʜɪ ᴛᴀᴋ ᴊᴀɢ ʀʜᴇ ʜᴏ 🏫** ",
|
| 63 |
+
" **➠ ʙᴀʙᴜ, ɢᴏᴏᴅ ɴɪɢʜᴛ sᴅ ᴛᴄ..?? 😊** ",
|
| 64 |
+
" **➠ ᴀᴀᴊ ʙʜᴜᴛ ᴛʜᴀɴᴅ ʜᴀɪ, ᴀᴀʀᴀᴍ sᴇ ᴊᴀʟᴅɪ sᴏ ᴊᴀᴛɪ ʜᴏᴏɴ 🌼** ",
|
| 65 |
+
" **➠ ᴊᴀɴᴇᴍᴀɴ, ɢᴏᴏᴅ ɴɪɢʜᴛ 🌷** ",
|
| 66 |
+
" **➠ ᴍᴇ ᴊᴀ ʀᴀʜɪ sᴏɴᴇ, ɢɴ sᴅ ᴛᴄ 🏵️** ",
|
| 67 |
+
" **➠ ʜᴇʟʟᴏ ᴊɪ ɴᴀᴍᴀsᴛᴇ, ɢᴏᴏᴅ ɴɪɢʜᴛ 🍃** ",
|
| 68 |
+
" **➠ ʜᴇʏ, ʙᴀʙʏ ᴋᴋʀʜ..? sᴏɴᴀ ɴᴀʜɪ ʜᴀɪ ᴋʏᴀ ☃️** ",
|
| 69 |
+
" **➠ ɢᴏᴏᴅ ɴɪɢʜᴛ ᴊɪ, ʙʜᴜᴛ ʀᴀᴀᴛ ʜᴏ ɢʏɪ..? ⛄** ",
|
| 70 |
+
" **➠ ᴍᴇ ᴊᴀ ʀᴀʜɪ ʀᴏɴᴇ, ɪ ᴍᴇᴀɴ sᴏɴᴇ ɢᴏᴏᴅ ɴɪɢʜᴛ ᴊɪ 😁** ",
|
| 71 |
+
" **➠ ᴍᴀᴄʜʜᴀʟɪ ᴋᴏ ᴋᴇʜᴛᴇ ʜᴀɪ ғɪsʜ, ɢᴏᴏᴅ ɴɪɢʜᴛ ᴅᴇᴀʀ ᴍᴀᴛ ᴋʀɴᴀ ᴍɪss, ᴊᴀ ʀʜɪ sᴏɴᴇ 🌄** ",
|
| 72 |
+
" **➠ ɢᴏᴏᴅ ɴɪɢʜᴛ ʙʀɪɢʜᴛғᴜʟʟ ɴɪɢʜᴛ 🤭** ",
|
| 73 |
+
" **➠ ᴛʜᴇ ɴɪɢʜᴛ ʜᴀs ғᴀʟʟᴇɴ, ᴛʜᴇ ᴅᴀʏ ɪs ᴅᴏɴᴇ,, ᴛʜᴇ ᴍᴏᴏɴ ʜᴀs ᴛᴀᴋᴇɴ ᴛʜᴇ ᴘʟᴀᴄᴇ ᴏғ ᴛʜᴇ sᴜɴ... 😊** ",
|
| 74 |
+
" **➠ ᴍᴀʏ ᴀʟʟ ʏᴏᴜʀ ᴅʀᴇᴀᴍs ᴄᴏᴍᴇ ᴛʀᴜᴇ ❤️** ",
|
| 75 |
+
" **➠ ɢᴏᴏᴅ ɴɪɢʜᴛ sᴘʀɪɴᴋʟᴇs sᴡᴇᴇᴛ ᴅʀᴇᴀᴍ 💚** ",
|
| 76 |
+
" **➠ ɢᴏᴏᴅ ɴɪɢʜᴛ, ɴɪɴᴅ ᴀᴀ ʀʜɪ ʜᴀɪ 🥱** ",
|
| 77 |
+
" **➠ ᴅᴇᴀʀ ғʀɪᴇɴᴅ ɢᴏᴏᴅ ɴɪɢʜᴛ 💤** ",
|
| 78 |
+
" **➠ ʙᴀʙʏ ᴀᴀᴊ ʀᴀᴀᴛ ᴋᴀ sᴄᴇɴᴇ ʙɴᴀ ʟᴇ 🥰** ",
|
| 79 |
+
" **➠ ɪᴛɴɪ ʀᴀᴀᴛ ᴍᴇ ᴊᴀɢ ᴋᴀʀ ᴋʏᴀ ᴋᴀʀ ʀʜᴇ ʜᴏ sᴏɴᴀ ɴᴀʜɪ ʜᴀɪ ᴋʏᴀ 😜** ",
|
| 80 |
+
" **➠ ᴄʟᴏsᴇ ʏᴏᴜʀ ᴇʏᴇs sɴᴜɢɢʟᴇ ᴜᴘ ᴛɪɢʜᴛ,, ᴀɴᴅ ʀᴇᴍᴇᴍʙᴇʀ ᴛʜᴀᴛ ᴀɴɢ��ʟs, ᴡɪʟʟ ᴡᴀᴛᴄʜ ᴏᴠᴇʀ ʏᴏᴜ ᴛᴏɴɪɢʜᴛ... 💫** ",
|
| 81 |
+
]
|
| 82 |
+
|
| 83 |
+
VC_TAG = [ "**➠ ɢᴏᴏᴅ ᴍᴏʀɴɪɴɢ, ᴋᴇsᴇ ʜᴏ 🐱**",
|
| 84 |
+
"**➠ ɢᴍ, sᴜʙʜᴀ ʜᴏ ɢʏɪ ᴜᴛʜɴᴀ ɴᴀʜɪ ʜᴀɪ ᴋʏᴀ 🌤️**",
|
| 85 |
+
"**➠ ɢᴍ ʙᴀʙʏ, ᴄʜᴀɪ ᴘɪ ʟᴏ ☕**",
|
| 86 |
+
"**➠ ᴊᴀʟᴅɪ ᴜᴛʜᴏ, sᴄʜᴏᴏʟ ɴᴀʜɪ ᴊᴀɴᴀ ᴋʏᴀ 🏫**",
|
| 87 |
+
"**➠ ɢᴍ, ᴄʜᴜᴘ ᴄʜᴀᴘ ʙɪsᴛᴇʀ sᴇ ᴜᴛʜᴏ ᴠʀɴᴀ ᴘᴀɴɪ ᴅᴀʟ ᴅᴜɴɢɪ 🧊**",
|
| 88 |
+
"**➠ ʙᴀʙʏ ᴜᴛʜᴏ ᴀᴜʀ ᴊᴀʟᴅɪ ғʀᴇsʜ ʜᴏ ᴊᴀᴏ, ɴᴀsᴛᴀ ʀᴇᴀᴅʏ ʜᴀɪ 🫕**",
|
| 89 |
+
"**➠ ᴏғғɪᴄᴇ ɴᴀʜɪ ᴊᴀɴᴀ ᴋʏᴀ ᴊɪ ᴀᴀᴊ, ᴀʙʜɪ ᴛᴀᴋ ᴜᴛʜᴇ ɴᴀʜɪ 🏣**",
|
| 90 |
+
"**➠ ɢᴍ ᴅᴏsᴛ, ᴄᴏғғᴇᴇ/ᴛᴇᴀ ᴋʏᴀ ʟᴏɢᴇ ☕🍵**",
|
| 91 |
+
"**➠ ʙᴀʙʏ 8 ʙᴀᴊɴᴇ ᴡᴀʟᴇ ʜᴀɪ, ᴀᴜʀ ᴛᴜᴍ ᴀʙʜɪ ᴛᴋ ᴜᴛʜᴇ ɴᴀʜɪ 🕖**",
|
| 92 |
+
"**➠ ᴋʜᴜᴍʙʜᴋᴀʀᴀɴ ᴋɪ ᴀᴜʟᴀᴅ ᴜᴛʜ ᴊᴀᴀ... ☃️**",
|
| 93 |
+
"**➠ ɢᴏᴏᴅ ᴍᴏʀɴɪɴɢ ʜᴀᴠᴇ ᴀ ɴɪᴄᴇ ᴅᴀʏ... 🌄**",
|
| 94 |
+
"**➠ ɢᴏᴏᴅ ᴍᴏʀɴɪɴɢ, ʜᴀᴠᴇ ᴀ ɢᴏᴏᴅ ᴅᴀʏ... 🪴**",
|
| 95 |
+
"**➠ ɢᴏᴏᴅ ᴍᴏʀɴɪɴɢ, ʜᴏᴡ ᴀʀᴇ ʏᴏᴜ ʙᴀʙʏ 😇**",
|
| 96 |
+
"**➠ ᴍᴜᴍᴍʏ ᴅᴇᴋʜᴏ ʏᴇ ɴᴀʟᴀʏᴋ ᴀʙʜɪ ᴛᴀᴋ sᴏ ʀʜᴀ ʜᴀɪ... 😵💫**",
|
| 97 |
+
"**➠ ʀᴀᴀᴛ ʙʜᴀʀ ʙᴀʙᴜ sᴏɴᴀ ᴋʀ ʀʜᴇ ᴛʜᴇ ᴋʏᴀ, ᴊᴏ ᴀʙʜɪ ᴛᴋ sᴏ ʀʜᴇ ʜᴏ ᴜᴛʜɴᴀ ɴᴀʜɪ ʜᴀɪ ᴋʏᴀ... 😏**",
|
| 98 |
+
"**➠ ʙᴀʙᴜ ɢᴏᴏᴅ ᴍᴏʀɴɪɴɢ ᴜᴛʜ ᴊᴀᴏ ᴀᴜʀ ɢʀᴏᴜᴘ ᴍᴇ sᴀʙ ғʀɪᴇɴᴅs ᴋᴏ ɢᴍ ᴡɪsʜ ᴋʀᴏ... 🌟**",
|
| 99 |
+
"**➠ ᴘᴀᴘᴀ ʏᴇ ᴀʙʜɪ ᴛᴀᴋ ᴜᴛʜ ɴᴀʜɪ, sᴄʜᴏᴏʟ ᴋᴀ ᴛɪᴍᴇ ɴɪᴋᴀʟᴛᴀ ᴊᴀ ʀʜᴀ ʜᴀɪ... 🥲**",
|
| 100 |
+
"**➠ ᴊᴀɴᴇᴍᴀɴ ɢᴏᴏᴅ ᴍᴏʀɴɪɴɢ, ᴋʏᴀ ᴋʀ ʀʜᴇ ʜᴏ ... 😅**",
|
| 101 |
+
"**➠ ɢᴍ ʙᴇᴀsᴛɪᴇ, ʙʀᴇᴀᴋғᴀsᴛ ʜᴜᴀ ᴋʏᴀ... 🍳**",
|
| 102 |
+
]
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
@app.on_message(filters.command(["gntag", "tagmember" ], prefixes=["/", "@", "#"]))
|
| 106 |
+
async def mentionall(client, message):
|
| 107 |
+
chat_id = message.chat.id
|
| 108 |
+
if message.chat.type == ChatType.PRIVATE:
|
| 109 |
+
return await message.reply("๏ ᴛʜɪs ᴄᴏᴍᴍᴀɴᴅ ᴏɴʟʏ ғᴏʀ ɢʀᴏᴜᴘs.")
|
| 110 |
+
|
| 111 |
+
is_admin = False
|
| 112 |
+
try:
|
| 113 |
+
participant = await client.get_chat_member(chat_id, message.from_user.id)
|
| 114 |
+
except UserNotParticipant:
|
| 115 |
+
is_admin = False
|
| 116 |
+
else:
|
| 117 |
+
if participant.status in (
|
| 118 |
+
ChatMemberStatus.ADMINISTRATOR,
|
| 119 |
+
ChatMemberStatus.OWNER
|
| 120 |
+
):
|
| 121 |
+
is_admin = True
|
| 122 |
+
if not is_admin:
|
| 123 |
+
return await message.reply("๏ ʏᴏᴜ ᴀʀᴇ ɴᴏᴛ ᴀᴅᴍɪɴ ʙᴀʙʏ, ᴏɴʟʏ ᴀᴅᴍɪɴs ᴄᴀɴ ᴛᴀɢ ᴍᴇᴍʙᴇʀs. ")
|
| 124 |
+
|
| 125 |
+
if message.reply_to_message and message.text:
|
| 126 |
+
return await message.reply("/tagall ɢᴏᴏᴅ ᴍᴏʀɴɪɴɢ ᴛʏᴘᴇ ʟɪᴋᴇ ᴛʜɪs / ʀᴇᴘʟʏ ᴀɴʏ ᴍᴇssᴀɢᴇ ɴᴇxᴛ ᴛɪᴍᴇ ʙᴏᴛ ᴛᴀɢɢɪɴɢ...")
|
| 127 |
+
elif message.text:
|
| 128 |
+
mode = "text_on_cmd"
|
| 129 |
+
msg = message.text
|
| 130 |
+
elif message.reply_to_message:
|
| 131 |
+
mode = "text_on_reply"
|
| 132 |
+
msg = message.reply_to_message
|
| 133 |
+
if not msg:
|
| 134 |
+
return await message.reply("/tagall ɢᴏᴏᴅ ᴍᴏʀɴɪɴɢ ᴛʏᴘᴇ ʟɪᴋᴇ ᴛʜɪs / ʀᴇᴘʟʏ ᴀɴʏ ᴍᴇssᴀɢᴇ ɴᴇxᴛ ᴛɪᴍᴇ ғᴏᴛ ᴛᴀɢɢɪɴɢ...")
|
| 135 |
+
else:
|
| 136 |
+
return await message.reply("/tagall ɢᴏᴏᴅ ᴍᴏʀɴɪɴɢ ᴛʏᴘᴇ ʟɪᴋᴇ ᴛʜɪs / ʀᴇᴘʟʏ ᴀɴʏ ᴍᴇssᴀɢᴇ ɴᴇxᴛ ᴛɪᴍᴇ ʙᴏᴛ ᴛᴀɢɢɪɴɢ...")
|
| 137 |
+
if chat_id in spam_chats:
|
| 138 |
+
return await message.reply("๏ ᴘʟᴇᴀsᴇ ᴀᴛ ғɪʀsᴛ sᴛᴏᴘ ʀᴜɴɴɪɴɢ ᴍᴇɴᴛɪᴏɴ ᴘʀᴏᴄᴇss...")
|
| 139 |
+
spam_chats.append(chat_id)
|
| 140 |
+
usrnum = 0
|
| 141 |
+
usrtxt = ""
|
| 142 |
+
async for usr in client.get_chat_members(chat_id):
|
| 143 |
+
if not chat_id in spam_chats:
|
| 144 |
+
break
|
| 145 |
+
if usr.user.is_bot:
|
| 146 |
+
continue
|
| 147 |
+
usrnum += 1
|
| 148 |
+
usrtxt += f"[{usr.user.first_name}](tg://user?id={usr.user.id}) "
|
| 149 |
+
|
| 150 |
+
if usrnum == 1:
|
| 151 |
+
if mode == "text_on_cmd":
|
| 152 |
+
txt = f"{usrtxt} {random.choice(TAGMES)}"
|
| 153 |
+
await client.send_message(chat_id, txt)
|
| 154 |
+
elif mode == "text_on_reply":
|
| 155 |
+
await msg.reply(f"[{random.choice(EMOJI)}](tg://user?id={usr.user.id})")
|
| 156 |
+
await asyncio.sleep(4)
|
| 157 |
+
usrnum = 0
|
| 158 |
+
usrtxt = ""
|
| 159 |
+
try:
|
| 160 |
+
spam_chats.remove(chat_id)
|
| 161 |
+
except:
|
| 162 |
+
pass
|
| 163 |
+
|
| 164 |
+
|
| 165 |
+
@app.on_message(filters.command(["gmtag"], prefixes=["/", "@", "#"]))
|
| 166 |
+
async def mention_allvc(client, message):
|
| 167 |
+
chat_id = message.chat.id
|
| 168 |
+
if message.chat.type == ChatType.PRIVATE:
|
| 169 |
+
return await message.reply("๏ ᴛʜɪs ᴄᴏᴍᴍᴀɴᴅ ᴏɴʟʏ ғᴏʀ ɢʀᴏᴜᴘs.")
|
| 170 |
+
|
| 171 |
+
is_admin = False
|
| 172 |
+
try:
|
| 173 |
+
participant = await client.get_chat_member(chat_id, message.from_user.id)
|
| 174 |
+
except UserNotParticipant:
|
| 175 |
+
is_admin = False
|
| 176 |
+
else:
|
| 177 |
+
if participant.status in (
|
| 178 |
+
ChatMemberStatus.ADMINISTRATOR,
|
| 179 |
+
ChatMemberStatus.OWNER
|
| 180 |
+
):
|
| 181 |
+
is_admin = True
|
| 182 |
+
if not is_admin:
|
| 183 |
+
return await message.reply("๏ ʏᴏᴜ ᴀʀᴇ ɴᴏᴛ ᴀᴅᴍɪɴ ʙᴀʙʏ, ᴏɴʟʏ ᴀᴅᴍɪɴs ᴄᴀɴ ᴛᴀɢ ᴍᴇᴍʙᴇʀs. ")
|
| 184 |
+
if chat_id in spam_chats:
|
| 185 |
+
return await message.reply("๏ ᴘʟᴇᴀsᴇ ᴀᴛ ғɪʀsᴛ sᴛᴏᴘ ʀᴜɴɴɪɴɢ ᴍᴇɴᴛɪᴏɴ ᴘʀᴏᴄᴇss...")
|
| 186 |
+
spam_chats.append(chat_id)
|
| 187 |
+
usrnum = 0
|
| 188 |
+
usrtxt = ""
|
| 189 |
+
async for usr in client.get_chat_members(chat_id):
|
| 190 |
+
if not chat_id in spam_chats:
|
| 191 |
+
break
|
| 192 |
+
if usr.user.is_bot:
|
| 193 |
+
continue
|
| 194 |
+
usrnum += 1
|
| 195 |
+
usrtxt += f"[{usr.user.first_name}](tg://user?id={usr.user.id}) "
|
| 196 |
+
|
| 197 |
+
if usrnum == 1:
|
| 198 |
+
txt = f"{usrtxt} {random.choice(VC_TAG)}"
|
| 199 |
+
await client.send_message(chat_id, txt)
|
| 200 |
+
await asyncio.sleep(4)
|
| 201 |
+
usrnum = 0
|
| 202 |
+
usrtxt = ""
|
| 203 |
+
try:
|
| 204 |
+
spam_chats.remove(chat_id)
|
| 205 |
+
except:
|
| 206 |
+
pass
|
| 207 |
+
|
| 208 |
+
|
| 209 |
+
|
| 210 |
+
@app.on_message(filters.command(["gmstop", "gnstop", "cancle"]))
|
| 211 |
+
async def cancel_spam(client, message):
|
| 212 |
+
if not message.chat.id in spam_chats:
|
| 213 |
+
return await message.reply("๏ ᴄᴜʀʀᴇɴᴛʟʏ ɪ'ᴍ ɴᴏᴛ ᴛᴀɢɢɪɴɢ ʙᴀʙʏ.")
|
| 214 |
+
is_admin = False
|
| 215 |
+
try:
|
| 216 |
+
participant = await client.get_chat_member(message.chat.id, message.from_user.id)
|
| 217 |
+
except UserNotParticipant:
|
| 218 |
+
is_admin = False
|
| 219 |
+
else:
|
| 220 |
+
if participant.status in (
|
| 221 |
+
ChatMemberStatus.ADMINISTRATOR,
|
| 222 |
+
ChatMemberStatus.OWNER
|
| 223 |
+
):
|
| 224 |
+
is_admin = True
|
| 225 |
+
if not is_admin:
|
| 226 |
+
return await message.reply("๏ ʏᴏᴜ ᴀʀᴇ ɴᴏᴛ ᴀᴅᴍɪɴ ʙᴀʙʏ, ᴏɴʟʏ ᴀᴅᴍɪɴs ᴄᴀɴ ᴛᴀɢ ᴍᴇᴍʙᴇʀs.")
|
| 227 |
+
else:
|
| 228 |
+
try:
|
| 229 |
+
spam_chats.remove(message.chat.id)
|
| 230 |
+
except:
|
| 231 |
+
pass
|
| 232 |
+
return await message.reply("๏ ᴘʀᴏᴄᴇss sᴛᴏᴘᴘᴇᴅ sᴜᴄᴄᴇssғᴜʟʟʏ ๏")
|
| 233 |
+
|
| 234 |
+
|
SONALI/plugins/admins/hitag.py
ADDED
|
@@ -0,0 +1,342 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from SONALI 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 |
+
" **❅ ओए सो गए क्या, ऑनलाइन आओ ।😊** ",
|
| 53 |
+
" **❅ ओए वीसी आओ बात करते हैं । 😃** ",
|
| 54 |
+
" **❅ खाना खाया कि नही। 🥲** ",
|
| 55 |
+
" **❅ घर में सब कैसे हैं। 🥺** ",
|
| 56 |
+
" **❅ पता है बहुत याद आ रही आपकी। 🤭** ",
|
| 57 |
+
" **❅ और बताओ कैसे हो।..?? 🤨** ",
|
| 58 |
+
" **❅ मेरी भी सैटिंग करवा दो प्लीज..?? 🙂** ",
|
| 59 |
+
" **❅ आपका नाम क्या है।..?? 🥲** ",
|
| 60 |
+
" **❅ नाश्ता हो गया..?? 😋** ",
|
| 61 |
+
" **❅ मुझे अपने ग्रूप में ऐड कर लो। 😍** ",
|
| 62 |
+
" **❅ आपका दोस्त आपको बुला रहा है। 😅** ",
|
| 63 |
+
" **❅ मुझसे शादी करोगे ..?? 🤔** ",
|
| 64 |
+
" **❅ सोने चले गए क्या 🙄** ",
|
| 65 |
+
" **❅ अरे यार कोई AC चला दो 😕** ",
|
| 66 |
+
" **❅ आप कहा से हो..?? 🙃** ",
|
| 67 |
+
" **❅ हेलो जी नमस्ते 😛** ",
|
| 68 |
+
" **❅ BABY क्या कर रही हो..? 🤔** ",
|
| 69 |
+
" **❅ क्या आप मुझे जानते हो .? ☺️** ",
|
| 70 |
+
" **❅ आओ baby Ludo खेलते है .🤗** ",
|
| 71 |
+
" **❅ चलती है क्या 9 से 12... 😇** ",
|
| 72 |
+
" **❅ आपके पापा क्या करते है 🤭** ",
|
| 73 |
+
" **❅ आओ baby बाजार चलते है गोलगप्पे खाने। 🥺** ",
|
| 74 |
+
" **❅ अकेली ना बाजार जाया करो, नज़र लग जायेगी। 😶** ",
|
| 75 |
+
" **❅ और बताओ BF कैसा है ..?? 🤔** ",
|
| 76 |
+
" **❅ गुड मॉर्निंग 😜** ",
|
| 77 |
+
" **❅ मेरा एक काम करोगे। 🙂** ",
|
| 78 |
+
" **❅ DJ वाले बाबू मेरा गाना चला दो। 😪** ",
|
| 79 |
+
" **❅ आप से मिलकर अच्छा लगा।☺** ",
|
| 80 |
+
" **❅ मेरे बाबू ने थाना थाया।..? 🙊** ",
|
| 81 |
+
" **❅ पढ़ाई कैसी चल रही हैं ? 😺** ",
|
| 82 |
+
" **❅ हम को प्यार हुआ। 🥲** ",
|
| 83 |
+
" **❅ Nykaa कौन है...? 😅** ",
|
| 84 |
+
" **❅ तू खींच मेरी फ़ोटो ..? 😅** ",
|
| 85 |
+
" **❅ Phone काट मम्मी आ गई क्या। 😆** ",
|
| 86 |
+
" **❅ और भाबी से कब मिल वा रहे हो । 😉** ",
|
| 87 |
+
" **❅ क्या आप मुझसे प्यार करते हो 💚** ",
|
| 88 |
+
" **❅ मैं तुम से बहुत प्यार करती हूं..? 👀** ",
|
| 89 |
+
" **❅ बेबी एक kiss दो ना..?? 🙉** ",
|
| 90 |
+
" **❅ एक जॉक सुनाऊं..? 😹** ",
|
| 91 |
+
" **❅ vc पर आओ कुछ दिखाती हूं 😻** ",
|
| 92 |
+
" **❅ क्या तुम instagram चलते हो..?? 🙃** ",
|
| 93 |
+
" **❅ whatsapp नंबर दो ना अपना..? 😕** ",
|
| 94 |
+
" **❅ आप की दोस्त से मेरी सेटिंग करा दो ..? 🙃** ",
|
| 95 |
+
" **❅ सारा काम हो गया हो तो ऑनलाइन आ जाओ।..? 🙃** ",
|
| 96 |
+
" **❅ कहा से हो आप 😊** ",
|
| 97 |
+
" **❅ जा तुझे आज़ाद कर दिया मैंने मेरे दिल से। 🥺** ",
|
| 98 |
+
" **❅ मेरा एक काम करोगे, ग्रूप मे कुछ मेंबर ऐड कर दो ..? ♥️** ",
|
| 99 |
+
" **❅ मैं तुमसे नाराज़ हूं 😠** ",
|
| 100 |
+
" **❅ आपकी फैमिली कैसी है..? ❤** ",
|
| 101 |
+
" **❅ क्या हुआ..? 🤔** ",
|
| 102 |
+
" **❅ बहुत याद आ रही है आपकी 😒** ",
|
| 103 |
+
" **❅ भूल गए मुझे 😏** ",
|
| 104 |
+
" **❅ झूठ क्यों बोला आपने मुझसे 🤐** ",
|
| 105 |
+
" **❅ इतना भाव मत खाया करो, रोटी खाया करो कम से कम मोटी तो हो जाओगी 😒** ",
|
| 106 |
+
" **❅ ये attitude किसे दिखा रहे हो 😮** ",
|
| 107 |
+
" **❅ हेमलो कहा busy ho 👀** ",
|
| 108 |
+
" **❅ आपके जैसा दोस्त पाकर मे बहुत खुश हूं। 🙈** ",
|
| 109 |
+
" **❅ आज मन बहुत उदास है ☹️** ",
|
| 110 |
+
" **❅ मुझसे भी बात कर लो ना 🥺** ",
|
| 111 |
+
" **❅ आज खाने में क्या बनाया है 👀** ",
|
| 112 |
+
" **❅ क्या चल रहा है 🙂** ",
|
| 113 |
+
" **❅ message क्यों नहीं करती हो..🥺** ",
|
| 114 |
+
" **❅ मैं मासूम हूं ना 🥺** ",
|
| 115 |
+
" **❅ कल मज़ा आया था ना 😅** ",
|
| 116 |
+
" **❅ कल कहा busy थे 😕** ",
|
| 117 |
+
" **❅ आप relationship में हो क्या..? 👀** ",
|
| 118 |
+
" **❅ कितने शांत रहते हो यार आप 😼** ",
|
| 119 |
+
" **❅ आपको गाना, गाना आता है..? 😸** ",
|
| 120 |
+
" **❅ घूमने चलोगे मेरे साथ..?? 🙈** ",
|
| 121 |
+
" **❅ हमेशा हैप्पी रहा करो यार 🤞** ",
|
| 122 |
+
" **❅ क्या हम दोस्त बन सकते है...? 🥰** ",
|
| 123 |
+
" **❅ आप का विवाह हो गया क्या.. 🥺** ",
|
| 124 |
+
" **❅ कहा busy the इतने दिनों से 🥲** ",
|
| 125 |
+
" **❅ single हो या mingle 😉** ",
|
| 126 |
+
" **❅ आओ पार्टी करते है 🥳** ",
|
| 127 |
+
" **❅ join कर लो @WORLD_ALPHA 🧐** ",
|
| 128 |
+
" **❅ मैं तुमसे प्यार नहीं करती, 🥺** ",
|
| 129 |
+
" **❅ यहां आ जाओ ना @PURVI_SUPPORT मस्ती करेंगे 🤭** ",
|
| 130 |
+
" **❅ भूल जाओ मुझे,..? 😊** ",
|
| 131 |
+
" **❅ अपना बना ले पिया, अपना बना ले 🥺** ",
|
| 132 |
+
" **❅ मेरा ग्रुप भी join कर लो ना 🤗** ",
|
| 133 |
+
" **❅ मैने तेरा नाम Dil rakh diya 😗** ",
|
| 134 |
+
" **❅ तुमारे सारे दोस्त कहा गए 🥺** ",
|
| 135 |
+
" **❅ my cute owner @ll_ALPHA_BABY_lll 🥰** ",
|
| 136 |
+
" **❅ किसकी याद मे खोए हो जान 😜** ",
|
| 137 |
+
" **❅ गुड नाईट जी बहुत रात हो गई 🥰** ",
|
| 138 |
+
]
|
| 139 |
+
|
| 140 |
+
VC_TAG = [ "**❅ ɪғ ʏᴏᴜ ᴅᴏ ɴᴏᴛ sᴛᴇᴘ ғᴏʀᴡᴀʀᴅ ʏᴏᴜ ᴡɪʟʟ ʀᴇᴍᴀɪɴ ɪɴ ᴛʜᴇ sᴀᴍᴇ ᴘʟᴀᴄᴇ.**",
|
| 141 |
+
"**❅ ʟɪғᴇ ɪs ʜᴀʀᴅ ʙᴜᴛ ɴᴏᴛ ɪᴍᴘᴏssɪʙʟᴇ.**",
|
| 142 |
+
"**❅ ʟɪғᴇ’s ᴛᴏᴏ sʜᴏʀᴛ ᴛᴏ ᴀʀɢᴜᴇ ᴀɴᴅ ғɪɢʜᴛ.**",
|
| 143 |
+
"**❅ ᴅᴏɴ’ᴛ ᴡᴀɪᴛ ғᴏʀ ᴛʜᴇ ᴘᴇʀғᴇᴄᴛ ᴍᴏᴍᴇɴᴛ ᴛᴀᴋᴇ ᴍᴏᴍᴇɴᴛ ᴀɴᴅ ᴍᴀᴋᴇ ɪᴛ ᴘᴇʀғᴇᴄᴛ.**",
|
| 144 |
+
"**❅ sɪʟᴇɴᴄᴇ ɪs ᴛʜᴇ ʙᴇsᴛ ᴀɴsᴡᴇʀ ᴛᴏ sᴏᴍᴇᴏɴᴇ ᴡʜᴏ ᴅᴏᴇsɴ’ᴛ ᴠᴀʟᴜᴇ ʏᴏᴜʀ ᴡᴏʀᴅs.**",
|
| 145 |
+
"**❅ ᴇᴠᴇʀʏ ɴᴇᴡ ᴅᴀʏ ɪs ᴀ ᴄʜᴀɴᴄᴇ ᴛᴏ ᴄʜᴀɴɢᴇ ʏᴏᴜʀ ʟɪғᴇ.**",
|
| 146 |
+
"**❅ ᴛᴏ ᴄʜᴀɴɢᴇ ʏᴏᴜʀ ʟɪғᴇ, ʏᴏᴜ ɴᴇᴇᴅ ᴛᴏ ᴄʜᴀɴɢᴇ ʏᴏᴜʀ ᴘʀɪᴏʀɪᴛɪᴇs.**",
|
| 147 |
+
"**❅ ʟɪғᴇ ɪs ᴀ ᴊᴏᴜʀɴᴇʏ, ɴᴏᴛ ᴀ ʀᴀᴄᴇ..**",
|
| 148 |
+
"**❅ sᴍɪʟᴇ ᴀɴᴅ ᴅᴏɴ’ᴛ ᴡᴏʀʀʏ, ʟɪғᴇ ɪs ᴀᴡᴇsᴏᴍᴇ.**",
|
| 149 |
+
"**❅ ᴅᴏ ɴᴏᴛ ᴄᴏᴍᴘᴀʀᴇ ʏᴏᴜʀsᴇʟғ ᴛᴏ ᴏᴛʜᴇʀs ɪғ ʏᴏᴜ ᴅᴏ sᴏ ʏᴏᴜ ᴀʀᴇ ɪɴsᴜʟᴛɪɴɢ ʏᴏᴜʀsᴇʟғ.**",
|
| 150 |
+
"**❅ ɪ ᴀᴍ ɪɴ ᴛʜᴇ ᴘʀᴏᴄᴇss ᴏғ ʙᴇᴄᴏᴍɪɴɢ ᴛʜᴇ ʙᴇsᴛ ᴠᴇʀsɪᴏɴ ᴏғ ᴍʏsᴇʟғ.**",
|
| 151 |
+
"**❅ ʟɪғᴇ ɪs ʟɪᴋᴇ ɪᴄᴇ ᴇɴᴊᴏʏ ɪᴛ ʙᴇғᴏʀᴇ ɪᴛ ᴍᴇʟᴛs.**",
|
| 152 |
+
"**❅ ʙᴇ ғʀᴇᴇ ʟɪᴋᴇ ᴀ ʙɪʀᴅ.**",
|
| 153 |
+
"**❅ ɴᴏ ᴏɴᴇ ɪs ᴄᴏᴍɪɴɢ ᴛᴏ sᴀᴠᴇ ʏᴏᴜ. ᴛʜɪs ʟɪғᴇ ᴏғ ʏᴏᴜʀ ɪs 100% ʏᴏᴜʀ ʀᴇsᴘᴏɴsɪʙɪʟɪᴛʏ..**",
|
| 154 |
+
"**❅ ʟɪғᴇ ᴀʟᴡᴀʏs ᴏғғᴇʀs ʏᴏᴜ ᴀ sᴇᴄᴏɴᴅ ᴄʜᴀɴᴄᴇ. ɪᴛ’s ᴄᴀʟʟᴇᴅ ᴛᴏᴍᴏʀʀᴏᴡ.**",
|
| 155 |
+
"**❅ ʟɪғᴇ ʙᴇɢɪɴs ᴀᴛ ᴛʜᴇ ᴇɴᴅ ᴏғ ʏᴏᴜʀ ᴄᴏᴍғᴏʀᴛ ᴢᴏɴᴇ.**",
|
| 156 |
+
"**❅ ᴀʟʟ ᴛʜᴇ ᴛʜɪɴɢs ᴛʜᴀᴛ ʜᴜʀᴛ ʏᴏᴜ, ᴀᴄᴛᴜᴀʟʟʏ ᴛᴇᴀᴄʜ ʏᴏᴜ.**",
|
| 157 |
+
"**❅ ʟɪғᴇ ɪs ʟɪᴋᴇ ᴀ ᴄᴀᴍᴇʀᴀ. sᴏ ғᴀᴄᴇ ɪᴛ ᴡɪᴛʜ ᴀ sᴍɪʟᴇ.**",
|
| 158 |
+
"**❅ ʟɪғᴇ ɪs 10% ᴏғ ᴡʜᴀᴛ ʜᴀᴘᴘᴇɴs ᴛᴏ ʏᴏᴜ ᴀɴᴅ 90% ᴏғ ʜᴏᴡ ʏᴏᴜ ʀᴇsᴘᴏɴᴅ ᴛᴏ ɪᴛ.**",
|
| 159 |
+
"**❅ ʟɪғᴇ ᴀʟᴡᴀʏs ᴏғғᴇʀs ʏᴏᴜ ᴀ sᴇᴄᴏɴᴅ ᴄʜᴀɴᴄᴇ. ɪᴛ’s ᴄᴀʟʟᴇᴅ ᴛᴏᴍᴏʀʀᴏᴡ.**",
|
| 160 |
+
"**❅ ɴᴏ ᴏɴᴇ ɪs ᴄᴏᴍɪɴɢ ᴛᴏ sᴀᴠᴇ ʏᴏᴜ. ᴛʜɪs ʟɪғᴇ ᴏғ ʏᴏᴜʀ ɪs 100% ʏᴏᴜʀ ʀᴇsᴘᴏɴsɪʙɪʟɪᴛʏ..**",
|
| 161 |
+
"**❅ ʟɪғᴇ ɪs ɴᴏᴛ ᴀɴ ᴇᴀsʏ ᴛᴀsᴋ.**",
|
| 162 |
+
"**❅ ʟɪғᴇ ɪs ᴀ ᴡᴏɴᴅᴇʀғᴜʟ ᴀᴅᴠᴇɴᴛᴜʀᴇ.**",
|
| 163 |
+
"**❅ ʟɪғᴇ ʙᴇɢɪɴs ᴏɴ ᴛʜᴇ ᴏᴛʜᴇʀ sɪᴅᴇ ᴏғ ᴅᴇsᴘᴀɪʀ.**",
|
| 164 |
+
"**❅ ʟɪғᴇ ɪs ɴᴏᴛ ᴀ ᴘʀᴏʙʟᴇᴍ ᴛᴏ ʙᴇ sᴏʟᴠᴇᴅ ʙᴜᴛ ᴀ ʀᴇᴀʟɪᴛʏ ᴛᴏ ʙᴇ ᴇxᴘᴇʀɪᴇɴᴄᴇᴅ.**",
|
| 165 |
+
"**❅ ʟɪғᴇ ᴅᴏᴇs ɴᴏᴛ ʜᴀᴠᴇ ᴀ ʀᴇᴍᴏᴛᴇ; ɢᴇᴛ ᴜᴘ ᴀɴᴅ ᴄʜᴀɴɢᴇ ɪᴛ ʏᴏᴜʀsᴇʟғ.**",
|
| 166 |
+
"**❅ sᴛᴀʀᴛ ᴛʀᴜsᴛɪɴɢ ʏᴏᴜʀsᴇʟғ, ᴀɴᴅ ʏᴏᴜ’ʟʟ ᴋɴᴏᴡ ʜᴏᴡ ᴛᴏ ʟɪᴠᴇ.**",
|
| 167 |
+
"**❅ ʜᴇᴀʟᴛʜ ɪs ᴛʜᴇ ᴍᴏsᴛ ɪᴍᴘᴏʀᴛᴀɴᴛ ɢᴏᴏᴅ ᴏғ ʟɪғᴇ.**",
|
| 168 |
+
"**❅ ᴛɪᴍᴇ ᴄʜᴀɴɢᴇ ᴘʀɪᴏʀɪᴛʏ ᴄʜᴀɴɢᴇs.**",
|
| 169 |
+
"**❅ ᴛᴏ sᴇᴇ ᴀɴᴅ ᴛᴏ ғᴇᴇʟ ᴍᴇᴀɴs ᴛᴏ ʙᴇ, ᴛʜɪɴᴋ ᴀɴᴅ ʟɪᴠᴇ.**",
|
| 170 |
+
"**❅ ʙᴇ ᴡɪᴛʜ sᴏᴍᴇᴏɴᴇ ᴡʜᴏ ʙʀɪɴɢs ᴏᴜᴛ ᴛʜᴇ ʙᴇsᴛ ᴏғ ʏᴏᴜ.**",
|
| 171 |
+
"**❅ ʏᴏᴜʀ ᴛʜᴏᴜɢʜᴛs ᴀʀᴇ ʏᴏᴜʀ ʟɪғᴇ.**",
|
| 172 |
+
"**❅ ᴘᴇᴏᴘʟᴇ ᴄʜᴀɴɢᴇ, ᴍᴇᴍᴏʀɪᴇs ᴅᴏɴ’ᴛ.**",
|
| 173 |
+
"**❅ ᴏᴜʀ ʟɪғᴇ ɪs ᴡʜᴀᴛ ᴡᴇ ᴛʜɪɴᴋ ɪᴛ ɪs.**",
|
| 174 |
+
"**❅ ʟɪɢʜᴛ ʜᴇᴀʀᴛ ʟɪᴠᴇs ʟᴏɴɢᴇʀ.**",
|
| 175 |
+
"**❅ ᴅᴇᴘʀᴇssɪᴏɴ ᴇᴠᴇɴᴛᴜᴀʟʟʏ ʙᴇᴄᴏᴍᴇs ᴀ ʜᴀʙɪᴛ.**",
|
| 176 |
+
"**❅ ʟɪғᴇ ɪs ᴀ ɢɪғᴛ. ᴛʀᴇᴀᴛ ɪᴛ ᴡᴇʟʟ.**",
|
| 177 |
+
"**❅ ʟɪғᴇ ɪs ᴡʜᴀᴛ ᴏᴜʀ ғᴇᴇʟɪɴɢs ᴅᴏ ᴡɪᴛʜ ᴜs.**",
|
| 178 |
+
"**❅ ᴡʀɪɴᴋʟᴇs ᴀʀᴇ ᴛʜᴇ ʟɪɴᴇs ᴏғ ʟɪғᴇ ᴏɴ ᴛʜᴇ ғᴀᴄᴇ.**",
|
| 179 |
+
"**❅ ʟɪғᴇ ɪs ᴍᴀᴅᴇ ᴜᴘ ᴏғ sᴏʙs, sɴɪғғʟᴇs, ᴀɴᴅ sᴍɪʟᴇs.**",
|
| 180 |
+
"**❅ ɴᴏᴛ ʟɪғᴇ, ʙᴜᴛ ɢᴏᴏᴅ ʟɪғᴇ, ɪs ᴛᴏ ʙᴇ ᴄʜɪᴇғʟʏ ᴠᴀʟᴜᴇᴅ.**",
|
| 181 |
+
"**❅ ʏᴏᴜ ᴄʜᴀɴɢᴇ ʏᴏᴜʀ ʟɪғᴇ ʙʏ ᴄʜᴀɴɢɪɴɢ ʏᴏᴜʀ ʜᴇᴀʀᴛ.",
|
| 182 |
+
"**❅ ʟɪғᴇ ɪs ɴᴏᴛʜɪɴɢ ᴡɪᴛʜᴏᴜᴛ ᴛʀᴜᴇ ғʀɪᴇɴᴅsʜɪᴘ.**",
|
| 183 |
+
"**❅ ɪғ ʏᴏᴜ ᴀʀᴇ ʙʀᴀᴠᴇ ᴛᴏ sᴀʏ ɢᴏᴏᴅ ʙʏᴇ, ʟɪғᴇ ᴡɪʟʟ ʀᴇᴡᴀʀᴅ ʏᴏᴜ ᴡɪᴛʜ ᴀ ɴᴇᴡ ʜᴇʟʟᴏ.**",
|
| 184 |
+
"**❅ ᴛʜᴇʀᴇ ɪs ɴᴏᴛʜɪɴɢ ᴍᴏʀᴇ ᴇxᴄɪᴛɪɴɢ ɪɴ ᴛʜᴇ ᴡᴏʀʟᴅ, ʙᴜᴛ ᴘᴇᴏᴘʟᴇ.**",
|
| 185 |
+
"**❅ ʏᴏᴜ ᴄᴀɴ ᴅᴏ ᴀɴʏᴛʜɪɴɢ, ʙᴜᴛ ɴᴏᴛ ᴇᴠᴇʀʏᴛʜɪɴɢ.**",
|
| 186 |
+
"**❅ ʟɪғᴇ ʙᴇᴄᴏᴍᴇ ᴇᴀsʏ ᴡʜᴇɴ ʏᴏᴜ ʙᴇᴄᴏᴍᴇ sᴛʀᴏɴɢ.**",
|
| 187 |
+
"**❅ ᴍʏ ʟɪғᴇ ɪsɴ’ᴛ ᴘᴇʀғᴇᴄᴛ ʙᴜᴛ ɪᴛ ᴅᴏᴇs ʜᴀᴠᴇ ᴘᴇʀғᴇᴄᴛ ᴍᴏᴍᴇɴᴛs.**",
|
| 188 |
+
"**❅ ʟɪғᴇ ɪs ɢᴏᴅ’s ɴᴏᴠᴇʟ. ʟᴇᴛ ʜɪᴍ ᴡʀɪᴛᴇ ɪᴛ.**",
|
| 189 |
+
"**❅ ᴏᴜʀ ʟɪғᴇ ɪs ᴀ ʀᴇsᴜʟᴛ ᴏғ ᴏᴜʀ ᴅᴏᴍɪɴᴀɴᴛ ᴛʜᴏᴜɢʜᴛs.**",
|
| 190 |
+
"**❅ ʟɪғᴇ ɪs ᴀ ᴍᴏᴛɪᴏɴ ғʀᴏᴍ ᴀ ᴅᴇsɪʀᴇ ᴛᴏ ᴀɴᴏᴛʜᴇʀ ᴅᴇsɪʀᴇ.**",
|
| 191 |
+
"**❅ ᴛᴏ ʟɪᴠᴇ ᴍᴇᴀɴs ᴛᴏ ғɪɢʜᴛ.**",
|
| 192 |
+
"**❅ ʟɪғᴇ ɪs ʟɪᴋᴇ ᴀ ᴍᴏᴜɴᴛᴀɪɴ, ɴᴏᴛ ᴀ ʙᴇᴀᴄʜ.**",
|
| 193 |
+
"**❅ ᴛʜᴇ ᴡᴏʀsᴛ ᴛʜɪɴɢ ɪɴ ʟɪғᴇ ɪs ᴛʜᴀᴛ ɪᴛ ᴘᴀssᴇs.**",
|
| 194 |
+
"**❅ ʟɪғᴇ ɪs sɪᴍᴘʟᴇ ɪғ ᴡᴇ ᴀʀᴇ sɪᴍᴘʟᴇ.**",
|
| 195 |
+
"**❅ ᴀʟᴡᴀʏs ᴛʜɪɴᴋ ᴛᴡɪᴄᴇ, sᴘᴇᴀᴋ ᴏɴᴄᴇ.**",
|
| 196 |
+
"**❅ ʟɪғᴇ ɪs sɪᴍᴘʟᴇ, ᴡᴇ ᴍᴀᴋᴇ ɪᴛ ᴄᴏᴍᴘʟɪᴄᴀᴛᴇᴅ.**",
|
| 197 |
+
"**❅ ʟɪғᴇ ɪs ɴᴏᴛ ᴍᴜᴄʜ ᴏʟᴅᴇʀ ᴛʜᴀɴ ᴛʜᴇ ᴅᴇᴀᴛʜ.**",
|
| 198 |
+
"**❅ ᴛʜᴇ sᴇᴄʀᴇᴛ ᴏғ ʟɪғᴇ ɪs ʟᴏᴡ ᴇxᴘᴇᴄᴛᴀᴛɪᴏɴs!**",
|
| 199 |
+
"**❅ ʟɪғᴇ ɪs ᴀ ᴛᴇᴀᴄʜᴇʀ..,ᴛʜᴇ ᴍᴏʀᴇ ᴡᴇ ʟɪᴠᴇ, ᴛʜᴇ ᴍᴏʀᴇ ᴡᴇ ʟᴇᴀʀɴ.**",
|
| 200 |
+
"**❅ ʜᴜᴍᴀɴ ʟɪғᴇ ɪs ɴᴏᴛʜɪɴɢ ʙᴜᴛ ᴀɴ ᴇᴛᴇʀɴᴀʟ ɪʟʟᴜsɪᴏɴ.**",
|
| 201 |
+
"**❅ ᴛʜᴇ ʜᴀᴘᴘɪᴇʀ ᴛʜᴇ ᴛɪᴍᴇ, ᴛʜᴇ sʜᴏʀᴛᴇʀ ɪᴛ ɪs.**",
|
| 202 |
+
"**❅ ʟɪғᴇ ɪs ʙᴇᴀᴜᴛɪғᴜʟ ɪғ ʏᴏᴜ ᴋɴᴏᴡ ᴡʜᴇʀᴇ ᴛᴏ ʟᴏᴏᴋ.**",
|
| 203 |
+
"**❅ ʟɪғᴇ ɪs ᴀᴡᴇsᴏᴍᴇ ᴡɪᴛʜ ʏᴏᴜ ʙʏ ᴍʏ sɪᴅᴇ.**",
|
| 204 |
+
"**❅ ʟɪғᴇ – ʟᴏᴠᴇ = ᴢᴇʀᴏ**",
|
| 205 |
+
"**❅ ʟɪғᴇ ɪs ғᴜʟʟ ᴏғ sᴛʀᴜɢɢʟᴇs.**",
|
| 206 |
+
"**❅ ɪ ɢᴏᴛ ʟᴇss ʙᴜᴛ ɪ ɢᴏᴛ ʙᴇsᴛ **",
|
| 207 |
+
"**❅ ʟɪғᴇ ɪs 10% ᴡʜᴀᴛ ʏᴏᴜ ᴍᴀᴋᴇ ɪᴛ, ᴀɴᴅ 90% ʜᴏᴡ ʏᴏᴜ ᴛᴀᴋᴇ ɪᴛ.**",
|
| 208 |
+
"**❅ ᴛʜᴇʀᴇ ɪs sᴛɪʟʟ sᴏ ᴍᴜᴄʜ ᴛᴏ sᴇᴇ**",
|
| 209 |
+
"**❅ ʟɪғᴇ ᴅᴏᴇsɴ’ᴛ ɢᴇᴛ ᴇᴀsɪᴇʀ ʏᴏᴜ ɢᴇᴛ sᴛʀᴏɴɢᴇʀ.**",
|
| 210 |
+
"**❅ ʟɪғᴇ ɪs ᴀʙᴏᴜᴛ ʟᴀᴜɢʜɪɴɢ & ʟɪᴠɪɴɢ.**",
|
| 211 |
+
"**❅ ᴇᴀᴄʜ ᴘᴇʀsᴏɴ ᴅɪᴇs ᴡʜᴇɴ ʜɪs ᴛɪᴍᴇ ᴄᴏᴍᴇs.**",
|
| 212 |
+
]
|
| 213 |
+
|
| 214 |
+
|
| 215 |
+
@app.on_message(filters.command(["hitag" ], prefixes=["/", "@", "#"]))
|
| 216 |
+
async def mentionall(client, message):
|
| 217 |
+
chat_id = message.chat.id
|
| 218 |
+
if message.chat.type == ChatType.PRIVATE:
|
| 219 |
+
return await message.reply("๏ ᴛʜɪs ᴄᴏᴍᴍᴀɴᴅ ᴏɴʟʏ ғᴏʀ ɢʀᴏᴜᴘs.")
|
| 220 |
+
|
| 221 |
+
is_admin = False
|
| 222 |
+
try:
|
| 223 |
+
participant = await client.get_chat_member(chat_id, message.from_user.id)
|
| 224 |
+
except UserNotParticipant:
|
| 225 |
+
is_admin = False
|
| 226 |
+
else:
|
| 227 |
+
if participant.status in (
|
| 228 |
+
ChatMemberStatus.ADMINISTRATOR,
|
| 229 |
+
ChatMemberStatus.OWNER
|
| 230 |
+
):
|
| 231 |
+
is_admin = True
|
| 232 |
+
if not is_admin:
|
| 233 |
+
return await message.reply("๏ ʏᴏᴜ ᴀʀᴇ ɴᴏᴛ ᴀᴅᴍɪɴ ʙᴀʙʏ, ᴏɴʟʏ ᴀᴅᴍɪɴs ᴄᴀɴ ᴛᴀɢ ᴍᴇᴍʙᴇʀs. ")
|
| 234 |
+
|
| 235 |
+
if message.reply_to_message and message.text:
|
| 236 |
+
return await message.reply("/hitag ɢᴏᴏᴅ ᴍᴏʀɴɪɴɢ ᴛʏᴘᴇ ʟɪᴋᴇ ᴛʜɪs / ʀᴇᴘʟʏ ᴀɴʏ ᴍᴇssᴀɢᴇ ɴᴇxᴛ ᴛɪᴍᴇ ʙᴏᴛ ᴛᴀɢɢɪɴɢ...")
|
| 237 |
+
elif message.text:
|
| 238 |
+
mode = "text_on_cmd"
|
| 239 |
+
msg = message.text
|
| 240 |
+
elif message.reply_to_message:
|
| 241 |
+
mode = "text_on_reply"
|
| 242 |
+
msg = message.reply_to_message
|
| 243 |
+
if not msg:
|
| 244 |
+
return await message.reply("/hitag ɢᴏᴏᴅ ᴍᴏʀɴɪɴɢ ᴛʏᴘᴇ ʟɪᴋᴇ ᴛʜɪs / ʀᴇᴘʟʏ ᴀɴʏ ᴍᴇssᴀɢᴇ ɴᴇxᴛ ᴛɪᴍᴇ ғᴏᴛ ᴛᴀɢɢɪɴɢ...")
|
| 245 |
+
else:
|
| 246 |
+
return await message.reply("/hitag ɢᴏᴏᴅ ᴍᴏʀɴɪɴɢ ᴛʏᴘᴇ ʟɪᴋᴇ ᴛʜɪs / ʀᴇᴘʟʏ ᴀɴʏ ᴍᴇssᴀɢᴇ ɴᴇxᴛ ᴛɪᴍᴇ ʙᴏᴛ ᴛᴀɢɢɪɴɢ...")
|
| 247 |
+
if chat_id in spam_chats:
|
| 248 |
+
return await message.reply("๏ ᴘʟᴇᴀsᴇ ᴀᴛ ғɪʀsᴛ sᴛᴏᴘ ʀᴜɴɴɪɴɢ ᴍᴇɴᴛɪᴏɴ ᴘʀᴏᴄᴇss...")
|
| 249 |
+
spam_chats.append(chat_id)
|
| 250 |
+
usrnum = 0
|
| 251 |
+
usrtxt = ""
|
| 252 |
+
async for usr in client.get_chat_members(chat_id):
|
| 253 |
+
if not chat_id in spam_chats:
|
| 254 |
+
break
|
| 255 |
+
if usr.user.is_bot:
|
| 256 |
+
continue
|
| 257 |
+
usrnum += 1
|
| 258 |
+
usrtxt += f"[{usr.user.first_name}](tg://user?id={usr.user.id}) "
|
| 259 |
+
|
| 260 |
+
if usrnum == 1:
|
| 261 |
+
if mode == "text_on_cmd":
|
| 262 |
+
txt = f"{usrtxt} {random.choice(TAGMES)}"
|
| 263 |
+
await client.send_message(chat_id, txt)
|
| 264 |
+
elif mode == "text_on_reply":
|
| 265 |
+
await msg.reply(f"[{random.choice(EMOJI)}](tg://user?id={usr.user.id})")
|
| 266 |
+
await asyncio.sleep(4)
|
| 267 |
+
usrnum = 0
|
| 268 |
+
usrtxt = ""
|
| 269 |
+
try:
|
| 270 |
+
spam_chats.remove(chat_id)
|
| 271 |
+
except:
|
| 272 |
+
pass
|
| 273 |
+
|
| 274 |
+
|
| 275 |
+
@app.on_message(filters.command(["lifetag"], prefixes=["/", "@", "#"]))
|
| 276 |
+
async def mention_allvc(client, message):
|
| 277 |
+
chat_id = message.chat.id
|
| 278 |
+
if message.chat.type == ChatType.PRIVATE:
|
| 279 |
+
return await message.reply("๏ ᴛʜɪs ᴄᴏᴍᴍᴀɴᴅ ᴏɴʟʏ ғᴏʀ ɢʀᴏᴜᴘs.")
|
| 280 |
+
|
| 281 |
+
is_admin = False
|
| 282 |
+
try:
|
| 283 |
+
participant = await client.get_chat_member(chat_id, message.from_user.id)
|
| 284 |
+
except UserNotParticipant:
|
| 285 |
+
is_admin = False
|
| 286 |
+
else:
|
| 287 |
+
if participant.status in (
|
| 288 |
+
ChatMemberStatus.ADMINISTRATOR,
|
| 289 |
+
ChatMemberStatus.OWNER
|
| 290 |
+
):
|
| 291 |
+
is_admin = True
|
| 292 |
+
if not is_admin:
|
| 293 |
+
return await message.reply("๏ ʏᴏᴜ ᴀʀᴇ ɴᴏᴛ ᴀᴅᴍɪɴ ʙᴀʙʏ, ᴏɴʟʏ ᴀᴅᴍɪɴs ᴄᴀɴ ᴛᴀɢ ᴍᴇᴍʙᴇʀs. ")
|
| 294 |
+
if chat_id in spam_chats:
|
| 295 |
+
return await message.reply("๏ ᴘʟᴇᴀsᴇ ᴀᴛ ғɪʀsᴛ sᴛᴏᴘ ʀᴜɴɴɪɴɢ ᴍᴇɴᴛɪᴏɴ ᴘʀᴏᴄᴇss...")
|
| 296 |
+
spam_chats.append(chat_id)
|
| 297 |
+
usrnum = 0
|
| 298 |
+
usrtxt = ""
|
| 299 |
+
async for usr in client.get_chat_members(chat_id):
|
| 300 |
+
if not chat_id in spam_chats:
|
| 301 |
+
break
|
| 302 |
+
if usr.user.is_bot:
|
| 303 |
+
continue
|
| 304 |
+
usrnum += 1
|
| 305 |
+
usrtxt += f"[{usr.user.first_name}](tg://user?id={usr.user.id}) "
|
| 306 |
+
|
| 307 |
+
if usrnum == 1:
|
| 308 |
+
txt = f"{usrtxt} {random.choice(VC_TAG)}"
|
| 309 |
+
await client.send_message(chat_id, txt)
|
| 310 |
+
await asyncio.sleep(4)
|
| 311 |
+
usrnum = 0
|
| 312 |
+
usrtxt = ""
|
| 313 |
+
try:
|
| 314 |
+
spam_chats.remove(chat_id)
|
| 315 |
+
except:
|
| 316 |
+
pass
|
| 317 |
+
|
| 318 |
+
|
| 319 |
+
|
| 320 |
+
@app.on_message(filters.command(["cancel", "histop", "lifestop"]))
|
| 321 |
+
async def cancel_spam(client, message):
|
| 322 |
+
if not message.chat.id in spam_chats:
|
| 323 |
+
return await message.reply("๏ ᴄᴜʀʀᴇɴᴛʟʏ ɪ'ᴍ ɴᴏᴛ ᴛᴀɢɢɪɴɢ ʙᴀʙʏ.")
|
| 324 |
+
is_admin = False
|
| 325 |
+
try:
|
| 326 |
+
participant = await client.get_chat_member(message.chat.id, message.from_user.id)
|
| 327 |
+
except UserNotParticipant:
|
| 328 |
+
is_admin = False
|
| 329 |
+
else:
|
| 330 |
+
if participant.status in (
|
| 331 |
+
ChatMemberStatus.ADMINISTRATOR,
|
| 332 |
+
ChatMemberStatus.OWNER
|
| 333 |
+
):
|
| 334 |
+
is_admin = True
|
| 335 |
+
if not is_admin:
|
| 336 |
+
return await message.reply("๏ ʏᴏᴜ ᴀʀᴇ ɴᴏᴛ ᴀᴅᴍɪɴ ʙᴀʙʏ, ᴏɴʟʏ ᴀᴅᴍɪɴs ᴄᴀɴ ᴛᴀɢ ᴍᴇᴍʙᴇʀs.")
|
| 337 |
+
else:
|
| 338 |
+
try:
|
| 339 |
+
spam_chats.remove(message.chat.id)
|
| 340 |
+
except:
|
| 341 |
+
pass
|
| 342 |
+
return await message.reply("๏ ᴘʀᴏᴄᴇss sᴛᴏᴘᴘᴇᴅ sᴜᴄᴄᴇssғᴜʟʟʏ ๏")
|
SONALI/plugins/admins/loop.py
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pyrogram import filters
|
| 2 |
+
from pyrogram.types import Message
|
| 3 |
+
|
| 4 |
+
from SONALI import app
|
| 5 |
+
from SONALI.utils.database import get_loop, set_loop
|
| 6 |
+
from SONALI.utils.decorators import AdminRightsCheck
|
| 7 |
+
from SONALI.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)
|
SONALI/plugins/admins/mention.py
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import asyncio
|
| 2 |
+
from pyrogram.enums import ChatType, ChatMemberStatus
|
| 3 |
+
from SONALI import app
|
| 4 |
+
from pyrogram import filters
|
| 5 |
+
from SONALI.utils.RAUSHAN_ban import admin_filter
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
SPAM_CHATS = []
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
@app.on_message(filters.command(["mention", "all"]) & filters.group & admin_filter)
|
| 13 |
+
async def tag_all_users(_,message):
|
| 14 |
+
replied = message.reply_to_message
|
| 15 |
+
if len(message.command) < 2 and not replied:
|
| 16 |
+
await message.reply_text("**ʀᴇᴘʟʏ ᴛᴏ ᴀ ᴍᴇssᴀɢᴇ ᴏʀ ɢɪᴠᴇ sᴏᴍᴇ ᴛᴇxᴛ ᴛᴏ ᴛᴀɢ ᴀʟʟ**")
|
| 17 |
+
return
|
| 18 |
+
if replied:
|
| 19 |
+
SPAM_CHATS.append(message.chat.id)
|
| 20 |
+
usernum= 0
|
| 21 |
+
usertxt = ""
|
| 22 |
+
async for m in app.get_chat_members(message.chat.id):
|
| 23 |
+
if message.chat.id not in SPAM_CHATS:
|
| 24 |
+
break
|
| 25 |
+
usernum += 5
|
| 26 |
+
usertxt += f"\n⊚ [{m.user.first_name}](tg://user?id={m.user.id})\n"
|
| 27 |
+
if usernum == 1:
|
| 28 |
+
await replied.reply_text(usertxt)
|
| 29 |
+
await asyncio.sleep(2)
|
| 30 |
+
usernum = 0
|
| 31 |
+
usertxt = ""
|
| 32 |
+
try :
|
| 33 |
+
SPAM_CHATS.remove(message.chat.id)
|
| 34 |
+
except Exception:
|
| 35 |
+
pass
|
| 36 |
+
else:
|
| 37 |
+
text = message.text.split(None, 1)[1]
|
| 38 |
+
|
| 39 |
+
SPAM_CHATS.append(message.chat.id)
|
| 40 |
+
usernum= 0
|
| 41 |
+
usertxt = ""
|
| 42 |
+
async for m in app.get_chat_members(message.chat.id):
|
| 43 |
+
if message.chat.id not in SPAM_CHATS:
|
| 44 |
+
break
|
| 45 |
+
usernum += 1
|
| 46 |
+
usertxt += f"\n⊚ [{m.user.first_name}](tg://user?id={m.user.id})\n"
|
| 47 |
+
if usernum == 5:
|
| 48 |
+
await app.send_message(message.chat.id,f'{text}\n{usertxt}\n\n|| ➥ ᴏғғ ᴛᴀɢɢɪɴɢ ʙʏ » /alloff ||')
|
| 49 |
+
await asyncio.sleep(2)
|
| 50 |
+
usernum = 0
|
| 51 |
+
usertxt = ""
|
| 52 |
+
try :
|
| 53 |
+
SPAM_CHATS.remove(message.chat.id)
|
| 54 |
+
except Exception:
|
| 55 |
+
pass
|
| 56 |
+
|
| 57 |
+
@app.on_message(filters.command("alloff") & ~filters.private)
|
| 58 |
+
async def cancelcmd(_, message):
|
| 59 |
+
chat_id = message.chat.id
|
| 60 |
+
if chat_id in SPAM_CHATS:
|
| 61 |
+
try :
|
| 62 |
+
SPAM_CHATS.remove(chat_id)
|
| 63 |
+
except Exception:
|
| 64 |
+
pass
|
| 65 |
+
return await message.reply_text("**ᴛᴀɢ ᴀʟʟ sᴜᴄᴄᴇssғᴜʟʟʏ sᴛᴏᴘᴘᴇᴅ!**")
|
| 66 |
+
|
| 67 |
+
else :
|
| 68 |
+
await message.reply_text("**ɴᴏ ᴘʀᴏᴄᴇss ᴏɴɢᴏɪɴɢ!**")
|
| 69 |
+
return
|
SONALI/plugins/admins/pause.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pyrogram import filters
|
| 2 |
+
from pyrogram.types import Message
|
| 3 |
+
|
| 4 |
+
from SONALI import app
|
| 5 |
+
from SONALI.core.call import RAUSHAN
|
| 6 |
+
from SONALI.utils.database import is_music_playing, music_off
|
| 7 |
+
from SONALI.utils.decorators import AdminRightsCheck
|
| 8 |
+
from SONALI.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 RAUSHAN.pause_stream(chat_id)
|
| 19 |
+
await message.reply_text(
|
| 20 |
+
_["admin_2"].format(message.from_user.mention), reply_markup=close_markup(_)
|
| 21 |
+
)
|