File size: 8,586 Bytes
80287e2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
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 Devine import app
from Devine.misc import _boot_
from Devine.plugins.sudo.sudoers import sudoers_list
from Devine.utils.database import (
    add_served_chat,
    add_served_user,
    blacklisted_chats,
    get_lang,
    is_banned_user,
    is_on_off,
)
from Devine.utils.decorators.language import LanguageStart
from Devine.utils.formatters import get_readable_time
from Devine.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(["musicstart"]) & 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://telegra.ph//file/db4ac98cf05117a23561c.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> t.me/{message.from_user.username}",
                )
            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)

            # Ensure that you're using an async method to get results
            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}.t.me",
                    )
            else:
                await m.edit_text("ғᴀɪʟᴇᴅ ᴛᴏ ʀᴇᴛʀɪᴇᴠᴇ ɪɴғᴏʀᴍᴀᴛɪᴏɴ.")
                return  # Early exit
    else:
        out = private_panel(_)
        await message.reply_text(
            text=(
                 f"<b>ʏᴏᴏ {message.from_user.mention}, <a href='https://telegra.ph//file/db4ac98cf05117a23561c.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}.t.me",
            )


@app.on_message(filters.command(["musicstart"]) & 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)


# @app.on_message(filters.new_chat_members, group=-1)
# async def welcome(client, message: Message):
  #   for member in message.new_chat_members:
    #     try:
      #       language = await get_lang(message.chat.id)
           #  _ = get_string(language)
           #  if await is_banned_user(member.id):
            #     try:
            #         await message.chat.ban_member(member.id)
              #   except:
                #     pass
       #      if member.id == app.id:
         #        if message.chat.type != ChatType.SUPERGROUP:
              #       await message.reply_text(_["start_4"])
                #     return await app.leave_chat(message.chat.id)
          #       if message.chat.id in await blacklisted_chats():
            #         await message.reply_text(
        #                 _["start_5"].format(
      #                       app.mention,
    #                   #       f"https://t.me/{app.username}?start=sudolist",
                     #        config.SUPPORT_CHAT,
                    #     ),
                  #       disable_web_page_preview=True,
               #      )
                  #   return await app.leave_chat(message.chat.id)
# 
                # out = start_panel(_)
               #  await message.reply_text(
                 #    text=_["start_3"].format(
                     #    message.from_user.first_name,
                    #     app.mention,
                  #       message.chat.title,
                #         app.mention,
              #       ),
            #         reply_markup=InlineKeyboardMarkup(out),
          #       )
        #         await add_served_chat(message.chat.id)
      #           await message.stop_propagation()
    #     except Exception as ex:
  #           print(ex)
#