File size: 6,807 Bytes
30a00bc
a8e9b84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30a00bc
a8e9b84
 
4ebaa1c
30a00bc
 
a8e9b84
 
30a00bc
 
a8e9b84
 
30a00bc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a8e9b84
 
 
30a00bc
a8e9b84
30a00bc
 
 
 
 
 
 
a8e9b84
 
30a00bc
a8e9b84
 
 
30a00bc
 
 
 
616a9b8
a8e9b84
 
30a00bc
 
 
 
a8e9b84
 
 
30a00bc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
616a9b8
30a00bc
 
 
 
a8e9b84
 
30a00bc
 
 
 
 
 
 
a8e9b84
 
 
 
30a00bc
 
 
 
616a9b8
a8e9b84
 
 
30a00bc
 
 
a8e9b84
 
30a00bc
 
a8e9b84
 
30a00bc
1
2
3
4
5
6
7
8
9
10
11
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
import asyncio
import time
from pyrogram import filters
from pyrogram.enums import ChatType
from pyrogram.types import InlineKeyboardButton, InlineKeyboardMarkup, Message
from youtubesearchpython.__future__ import VideosSearch

import config
from DragMusic import app
from DragMusic.misc import _boot_
from DragMusic.plugins.sudo.sudoers import sudoers_list
from DragMusic.utils.database import (
    add_served_chat,
    add_served_user,
    blacklisted_chats,
    get_lang,
    is_banned_user,
    is_on_off,
)
from DragMusic.utils.decorators.language import LanguageStart
from DragMusic.utils.formatters import get_readable_time
from DragMusic.utils.inline import help_pannel, private_panel, start_panel
from config import BANNED_USERS, OWNER_ID
from strings import get_string


@app.on_message(filters.command(["start"]) & filters.private & ~BANNED_USERS)
@LanguageStart
async def start_pm(client, message: Message, _):
    await add_served_user(message.from_user.id)

    loading_1 = await message.reply_text("🔥")
    await asyncio.sleep(0.3)
    
    await loading_1.edit_text("<b>ʟᴏᴀᴅɪɴɢ</b>")
    await asyncio.sleep(0.2)
    await loading_1.edit_text("<b>ʟᴏᴀᴅɪɴɢ.</b>")
    await asyncio.sleep(0.1)
    await loading_1.edit_text("<b>ʟᴏᴀᴅɪɴɢ..</b>")
    await asyncio.sleep(0.1)
    await loading_1.edit_text("<b>ʟᴏᴀᴅɪɴɢ...</b>")
    await asyncio.sleep(0.1)
    await loading_1.delete()

    started_msg = await message.reply_text(text="<b>sᴛᴀʀᴛᴇᴅ...</b>")
    await asyncio.sleep(0.2)
    await started_msg.delete()

    if len(message.text.split()) > 1:
        name = message.text.split(None, 1)[1]
        if name.startswith("help"):
            keyboard = help_pannel(_)
            await message.reply_text(
                text=(
                    f"<b>ʏᴏᴏ {message.from_user.mention}, <a href='https://files.catbox.moe/w8m75t.jpg' target='_blank'>🫧</a></b>\n\n"
                    f"<b>ɪ'ᴍ {app.mention}</b>\n"
                    f"<b>ɪ ᴄᴀɴ sᴛʀᴇᴀᴍ ʜɪɢʜ-ǫᴜᴀʟɪᴛʏ ᴍᴜsɪᴄ ᴀɴᴅ ᴠɪᴅᴇᴏs ᴇғғᴏʀᴛʟᴇssʟʏ ᴡɪᴛʜ ᴛʜɪs ᴀᴅᴠᴀɴᴄᴇᴅ ᴛᴇʟᴇɢʀᴀᴍ ʙᴏᴛ.</b>\n\n"
                    f"<b>sʜᴀʀᴇ ᴛʀᴀᴄᴋs ᴀɴᴅ ᴄʀᴇᴀᴛᴇ ᴛʜᴇ ᴘᴇʀғᴇᴄᴛ ᴀᴛᴍᴏsᴘʜᴇʀᴇ ғᴏʀ ᴇᴠᴇʀʏ ᴄʜᴀᴛ.</b>"
                ),
                reply_markup=keyboard,
            )
        if name.startswith("sud"):
            await sudoers_list(client=client, message=message, _=_)
            if await is_on_off(2):
                await app.send_message(
                    chat_id=config.LOGGER_ID,
                    text=f"{message.from_user.mention} ᴄʜᴇᴄᴋᴇᴅ <b>sᴜᴅᴏʟɪsᴛ</b>.\n\n"
                         f"<b>• ɪᴅᴇɴᴛɪғɪᴇʀ ⌯</b> <code>{message.from_user.id}</code>\n"
                         f"<b>• ʜᴀɴᴅʟᴇ ⌯</b> @{message.from_user.username}",
                    message_thread_id=9,
                )
            return

        if name.startswith("inf"):
            m = await message.reply_text("⚡️")
            query = name.replace("info_", "", 1)
            query = f"https://www.youtube.com/watch?v={query}"
            results = VideosSearch(query, limit=1)

            next_result = await results.next()

            if isinstance(next_result, dict) and "result" in next_result:
                for result in next_result["result"]:
                    title = result["title"]
                    duration = result["duration"]
                    views = result["viewCount"]["short"]
                    thumbnail = result["thumbnails"][0]["url"].split("?")[0]
                    channellink = result["channel"]["link"]
                    channel = result["channel"]["name"]
                    link = result["link"]
                    published = result["publishedTime"]
                    searched_text = _["start_6"].format(
                        title, duration, views, published, channellink, channel
                    )
                    key = InlineKeyboardMarkup(
                        [[InlineKeyboardButton(text="ʏᴏᴜᴛᴜʙᴇ", url=link)]]
                    )
                await m.delete()

                await app.send_photo(
                    chat_id=message.chat.id,
                    photo=thumbnail,
                    caption=searched_text,
                    reply_markup=key,
                )
                if await is_on_off(2):
                    await app.send_message(
                        chat_id=config.LOGGER_ID,
                        text=f"<b>{message.from_user.mention} ᴄʜᴇᴄᴋᴇᴅ ᴛʀᴀᴄᴋ ɪɴғᴏ.</b>\n\n"
                             f"<b>• ɪᴅᴇɴᴛɪғɪᴇʀ ⌯</b> <code>{message.from_user.id}</code>\n"
                             f"<b>• ʜᴀɴᴅʟᴇ ⌯</b> @{message.from_user.username}",
                        message_thread_id=9,
                    )
            else:
                await m.edit_text("ғᴀɪʟᴇᴅ ᴛᴏ ʀᴇᴛʀɪᴇᴠᴇ ɪɴғᴏʀᴍᴀᴛɪᴏɴ.")
                return
    else:
        out = private_panel(_)
        await message.reply_text(
            text=(
                 f"<b>ʏᴏᴏ {message.from_user.mention}, <a href='https://files.catbox.moe/w8m75t.jpg' target='_blank'>🫧</a></b>\n\n"
                 f"<b>ɪ'ᴍ {app.mention}</b>\n"
                 f"<b>ɪ ᴄᴀɴ sᴛʀᴇᴀᴍ ʜɪɢʜ-ǫᴜᴀʟɪᴛʏ ᴍᴜsɪᴄ ᴀɴᴅ ᴠɪᴅᴇᴏs ᴇғғᴏʀᴛʟᴇssʟʏ ᴡɪᴛʜ ᴛʜɪs ᴀᴅᴠᴀɴᴄᴇᴅ ᴛᴇʟᴇɢʀᴀᴍ ʙᴏᴛ.</b>\n\n"
                 f"<b>sʜᴀʀᴇ ᴛʀᴀᴄᴋs ᴀɴᴅ ᴄʀᴇᴀᴛᴇ ᴛʜᴇ ᴘᴇʀғᴇᴄᴛ ᴀᴛᴍᴏsᴘʜᴇʀᴇ ғᴏʀ ᴇᴠᴇʀʏ ᴄʜᴀᴛ.</b>"
            ),
            reply_markup=InlineKeyboardMarkup(out),
        )
        if await is_on_off(2):
            await app.send_message(
                chat_id=config.LOGGER_ID,
                text=f"<b>{message.from_user.mention} sᴛᴀʀᴛᴇᴅ ᴛʜᴇ ʙᴏᴛ.</b>\n\n"
                     f"<b>• ɪᴅᴇɴᴛɪғɪᴇʀ ⌯</b> <code>{message.from_user.id}</code>\n"
                     f"<b>• ʜᴀɴᴅʟᴇ ⌯</b> @{message.from_user.username}",
                message_thread_id=9,
            )


@app.on_message(filters.command(["start"]) & filters.group & ~BANNED_USERS)
@LanguageStart
async def start_gp(client, message: Message, _):
    out = start_panel(_)
    uptime = int(time.time() - _boot_)
    await message.reply_text(
        text=_["start_1"].format(app.mention, get_readable_time(uptime)),
        reply_markup=InlineKeyboardMarkup(out),
    )
    await add_served_chat(message.chat.id)