xteamki commited on
Commit
5126418
·
verified ·
1 Parent(s): a58f1cc

Upload 10 files

Browse files
Zaid/plugins/__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+
Zaid/plugins/activevoice.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+
3
+ from telethon import Button, events
4
+ from Zaid import Zaid
5
+ from Zaid.helpers.queues import get_active_chats
6
+
7
+
8
+ @Zaid.on(events.NewMessage(pattern="^/activevoice"))
9
+ async def activevc(message):
10
+ mystic = await message.reply(
11
+ "Getting active voice chats.. Please hold"
12
+ )
13
+ served_chats = await get_active_chats()
14
+ text = ""
15
+ j = 0
16
+ for x in served_chats:
17
+ try:
18
+ title = (await message.client.get_entity(x)).title
19
+ except Exception:
20
+ title = "Private Group"
21
+ if (await message.client.get_entity(x)).username:
22
+ user = (await message.client.get_entity(x)).username
23
+ text += f"{j + 1}. [{title}](https://t.me/{user})[`{x}`]\n"
24
+ else:
25
+ text += f"{j + 1}. {title} [`{x}`]\n"
26
+ j += 1
27
+ if not text:
28
+ await mystic.edit("No Active Voice Chats")
29
+ else:
30
+ await mystic.edit(
31
+ f"**Active Voice Chats:-**\n\n{text}"
32
+ )
Zaid/plugins/admins.py ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from telethon import events, Button
2
+ from Zaid import Zaid
3
+ from Zaid.status import *
4
+ from Config import Config
5
+ from telethon.tl.functions.channels import EditAdminRequest
6
+ from telethon.tl.types import ChatAdminRights
7
+ from telethon.tl.functions.users import GetFullUserRequest
8
+ from telethon.tl.functions.messages import ExportChatInviteRequest
9
+
10
+ @Zaid.on(events.callbackquery.CallbackQuery(data="admin"))
11
+ async def _(event):
12
+
13
+ await event.edit(ADMIN_TEXT, buttons=[[Button.inline("« Bᴀᴄᴋ", data="help")]])
14
+
15
+ @Zaid.on(events.callbackquery.CallbackQuery(data="play"))
16
+ async def _(event):
17
+
18
+ await event.edit(PLAY_TEXT, buttons=[[Button.inline("« Bᴀᴄᴋ", data="help")]])
19
+
20
+
21
+ ADMIN_TEXT = """
22
+ **✘ A module from which admins of the chat can use!**
23
+
24
+ ‣ `?end` - To End music streaming.
25
+ ‣ `?skip` - To Skip Tracks Going on.
26
+ ‣ `?pause` - To Pause streaming.
27
+ ‣ `?resume` - to Resume Streaming.
28
+ ‣ `?leavevc` - force The Userbot to leave Vc Chat (Sometimes Joined).
29
+ ‣ `?playlist` - to check playlists.
30
+ """
31
+
32
+ PLAY_TEXT = """
33
+ **✘ A module from which users of the chat can use!**
34
+
35
+ ‣ `?play` - To Play Audio from Else Reply to audio file.
36
+ ‣ `?vplay` - To Stream Videos (HEROKU_MODE > Doesn't support).
37
+ """
Zaid/plugins/autoleave.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import asyncio
2
+ from Zaid import call_py, client
3
+ from Config import Config
4
+ from telethon.tl.functions.channels import LeaveChannelRequest
5
+
6
+ AUTO_LEAVE_TIME = Config.AUTO_LEAVE_TIME
7
+ AUTO_LEAVE = Config.AUTO_LEAVE
8
+
9
+ async def leave_from_inactive_call():
10
+ if AUTO_LEAVE == True:
11
+ while not await asyncio.sleep(AUTO_LEAVE_TIME):
12
+ all_chat_id = []
13
+ async for chat in client.iter_dialogs():
14
+ chat_id = chat.id
15
+ if chat_id != -1001578320240:
16
+ if chat.is_group:
17
+ for call in call_py.calls:
18
+ call_chat_id = int(getattr(call, "chat_id"))
19
+ if call_chat_id in all_chat_id:
20
+ pass
21
+ else:
22
+ all_chat_id.append(call_chat_id)
23
+ call_status = getattr(call, "status")
24
+ try:
25
+ if call_chat_id == chat_id and call_status == "not_playing":
26
+ await client(LeaveChannelRequest(chat_id))
27
+ elif chat_id not in all_chat_id:
28
+ await client(LeaveChannelRequest(chat_id))
29
+ except Exception:
30
+ pass
31
+ if chat_id not in all_chat_id:
32
+ try:
33
+ await client(LeaveChannelRequest(chat_id))
34
+ except Exception:
35
+ pass
Zaid/plugins/help.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from telethon import events, Button
2
+ from Zaid import Zaid, BOT_USERNAME
3
+ from Config import Config
4
+
5
+
6
+ btn =[
7
+ [Button.inline("ᴀᴅᴍɪɴ", data="admin"), Button.inline("ᴘʟᴀʏ", data="play")],
8
+ [Button.inline("ʜᴏᴍᴇ", data="start")]]
9
+
10
+ HELP_TEXT = "ᴄʜᴏᴏsᴇ ᴛʜᴇ ᴄᴀᴛᴇɢᴏʀʏ ғᴏʀ ᴡʜɪᴄʜ ʏᴏᴜ ᴡᴀɴɴᴀ ɢᴇᴛ ʜᴇʟᴩ\n\nᴀʟʟ ᴄᴏᴍᴍᴀɴᴅs ᴄᴀɴ ʙᴇ ᴜsᴇᴅ ᴡɪᴛʜ : `/`"
11
+
12
+
13
+ @Zaid.on(events.NewMessage(pattern="[!?/]help"))
14
+ async def help(event):
15
+ if Config.MANAGEMENT_MODE == "ENABLE":
16
+ return
17
+ if event.is_group:
18
+ await event.reply("Contact me in PM to get available help menu!", buttons=[
19
+ [Button.url("Help And Commands!", "t.me/{}?start=help".format(BOT_USERNAME))]])
20
+ return
21
+
22
+ await event.reply(HELP_TEXT, buttons=btn)
23
+
24
+ @Zaid.on(events.NewMessage(pattern="^/start help"))
25
+ async def _(event):
26
+ if Config.MANAGEMENT_MODE == "ENABLE":
27
+ return
28
+ await event.reply(HELP_TEXT, buttons=btn)
29
+
30
+ @Zaid.on(events.callbackquery.CallbackQuery(data="help"))
31
+ async def _(event):
32
+ if Config.MANAGEMENT_MODE == "ENABLE":
33
+ return
34
+ await event.edit(HELP_TEXT, buttons=btn)
Zaid/plugins/ping.py ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import sys
3
+ import asyncio
4
+ from time import time
5
+ from datetime import datetime
6
+
7
+
8
+ from telethon import Button, events
9
+
10
+ from Zaid import *
11
+
12
+ START_TIME = datetime.utcnow()
13
+ TIME_DURATION_UNITS = (
14
+ ('Week', 60 * 60 * 24 * 7),
15
+ ('Day', 60 * 60 * 24),
16
+ ('Hour', 60 * 60),
17
+ ('Min', 60),
18
+ ('Sec', 1)
19
+ )
20
+ async def _human_time_duration(seconds):
21
+ if seconds == 0:
22
+ return 'inf'
23
+ parts = []
24
+ for unit, div in TIME_DURATION_UNITS:
25
+ amount, seconds = divmod(int(seconds), div)
26
+ if amount > 0:
27
+ parts.append('{} {}{}'
28
+ .format(amount, unit, "" if amount == 1 else "s"))
29
+ return ', '.join(parts)
30
+
31
+
32
+ @Zaid.on(events.NewMessage(pattern="^/ping"))
33
+ async def _(event):
34
+ start = time()
35
+ current_time = datetime.utcnow()
36
+ delta_ping = time() - start
37
+ uptime_sec = (current_time - START_TIME).total_seconds()
38
+ uptime = await _human_time_duration(int(uptime_sec))
39
+ UMM = [[Button.url("⚜ Cԋαɳɳҽʅ ⚜", "https://t.me/TheUpdatesChannel")]]
40
+ await event.reply(f"╰☞ 𝗣𝗢𝗡𝗚™╮\n☞ {delta_ping * 1000:.3f}\n☞ {uptime}", buttons=UMM)
Zaid/plugins/play.py ADDED
@@ -0,0 +1,549 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pytgcalls import StreamType
2
+ from pytgcalls.types import Update
3
+ from pytgcalls.types.input_stream import AudioPiped, AudioVideoPiped
4
+ from pytgcalls.types.input_stream.quality import (
5
+ HighQualityAudio,
6
+ HighQualityVideo,
7
+ LowQualityVideo,
8
+ MediumQualityVideo,
9
+ )
10
+ from telethon.tl.functions.channels import LeaveChannelRequest
11
+ from telethon.tl.functions.messages import ImportChatInviteRequest
12
+ from telethon.tl.functions.messages import ImportChatInviteRequest
13
+ from pytgcalls.exceptions import (
14
+ NoActiveGroupCall,
15
+ NotInGroupCallError
16
+ )
17
+ from Zaid.status import *
18
+ from telethon.tl.functions.users import GetFullUserRequest
19
+ from telethon.tl.functions.messages import ExportChatInviteRequest
20
+ import telethon.utils
21
+ from telethon.tl import functions
22
+ from telethon.tl import types
23
+ from telethon.utils import get_display_name
24
+ from telethon.tl.functions.users import GetFullUserRequest
25
+ from youtubesearchpython import VideosSearch
26
+
27
+
28
+ fotoplay = "https://telegra.ph/file/b6402152be44d90836339.jpg"
29
+ ngantri = "https://telegra.ph/file/b6402152be44d90836339.jpg"
30
+ from Zaid import call_py, Zaid, client as Client
31
+ owner = "1669178360"
32
+ from Zaid.helpers.yt_dlp import bash
33
+ from Zaid.helpers.chattitle import CHAT_TITLE
34
+ from Zaid.helpers.queues import (
35
+ QUEUE,
36
+ add_to_queue,
37
+ clear_queue,
38
+ get_queue,
39
+ pop_an_item,
40
+ active,
41
+ )
42
+ from telethon import Button, events
43
+ from Config import Config
44
+
45
+ from Zaid.helpers.thumbnail import gen_thumb
46
+ from Zaid.helpers.joiner import AssistantAdd
47
+
48
+ def vcmention(user):
49
+ full_name = get_display_name(user)
50
+ if not isinstance(user, types.User):
51
+ return full_name
52
+ return f"[{full_name}](tg://user?id={user.id})"
53
+
54
+
55
+ def ytsearch(query: str):
56
+ try:
57
+ search = VideosSearch(query, limit=1).result()
58
+ data = search["result"][0]
59
+ songname = data["title"]
60
+ url = data["link"]
61
+ duration = data["duration"]
62
+ thumbnail = f"https://i.ytimg.com/vi/{data['id']}/hqdefault.jpg"
63
+ videoid = data["id"]
64
+ return [songname, url, duration, thumbnail, videoid]
65
+ except Exception as e:
66
+ print(e)
67
+ return 0
68
+
69
+
70
+ async def ytdl(format: str, link: str):
71
+ stdout, stderr = await bash(f'yt-dlp -g -f "{format}" {link}')
72
+ if stdout:
73
+ return 1, stdout.split("\n")[0]
74
+ return 0, stderr
75
+
76
+
77
+ async def skip_item(chat_id: int, x: int):
78
+ if chat_id not in QUEUE:
79
+ return 0
80
+ chat_queue = get_queue(chat_id)
81
+ try:
82
+ songname = chat_queue[x][0]
83
+ chat_queue.pop(x)
84
+ return songname
85
+ except Exception as e:
86
+ print(e)
87
+ return 0
88
+
89
+
90
+ async def skip_current_song(chat_id: int):
91
+ if chat_id not in QUEUE:
92
+ return 0
93
+ chat_queue = get_queue(chat_id)
94
+ if len(chat_queue) == 1:
95
+ await call_py.leave_group_call(chat_id)
96
+ clear_queue(chat_id)
97
+ active.remove(chat_id)
98
+ return 1
99
+ songname = chat_queue[1][0]
100
+ url = chat_queue[1][1]
101
+ link = chat_queue[1][2]
102
+ type = chat_queue[1][3]
103
+ RESOLUSI = chat_queue[1][4]
104
+ if type == "Audio":
105
+ await call_py.change_stream(
106
+ chat_id,
107
+ AudioPiped(
108
+ url,
109
+ ),
110
+ )
111
+ elif type == "Video":
112
+ if RESOLUSI == 720:
113
+ hm = HighQualityVideo()
114
+ elif RESOLUSI == 480:
115
+ hm = MediumQualityVideo()
116
+ elif RESOLUSI == 360:
117
+ hm = LowQualityVideo()
118
+ await call_py.change_stream(
119
+ chat_id, AudioVideoPiped(url, HighQualityAudio(), hm)
120
+ )
121
+ pop_an_item(chat_id)
122
+ return [songname, link, type]
123
+
124
+
125
+ @Zaid.on(events.callbackquery.CallbackQuery(data="cls"))
126
+ async def _(event):
127
+
128
+ await event.delete()
129
+
130
+ btnn =[[Button.inline("✯ cʟᴏꜱᴇ ✯", data="cls")]]
131
+
132
+
133
+ #play
134
+ @Zaid.on(events.NewMessage(pattern="^[?!/]play"))
135
+ @AssistantAdd
136
+ async def play(event):
137
+ title = ' '.join(event.text[5:])
138
+ replied = await event.get_reply_message()
139
+ sender = await event.get_sender()
140
+ chat = await event.get_chat()
141
+ chat_id = event.chat_id
142
+ from_user = vcmention(event.sender)
143
+ public = event.chat_id
144
+ if (
145
+ replied
146
+ and not replied.audio
147
+ and not replied.voice
148
+ and not title
149
+ or not replied
150
+ and not title
151
+ ):
152
+ return await event.client.send_file(chat_id, Config.CMD_IMG, caption="**Give Me Your Query Which You want to Play**\n\n **Example**: `/play Nira Ishq Bass boosted`", buttons=btnn)
153
+ elif replied and not replied.audio and not replied.voice or not replied:
154
+ botman = await event.reply("🔎")
155
+ query = event.text.split(maxsplit=1)[1]
156
+ search = ytsearch(query)
157
+ if search == 0:
158
+ await botman.edit(
159
+ "**Can't Find Song** Try searching with More Specific Title"
160
+ )
161
+ else:
162
+ songname = search[0]
163
+ title = search[0]
164
+ url = search[1]
165
+ duration = search[2]
166
+ thumbnail = search[3]
167
+ videoid = search[4]
168
+ userid = sender.id
169
+ titlegc = chat.title
170
+ ctitle = await CHAT_TITLE(titlegc)
171
+ thumb = await gen_thumb(videoid)
172
+ format = "best[height<=?720][width<=?1280]"
173
+ hm, ytlink = await ytdl(format, url)
174
+ if hm == 0:
175
+ await botman.edit(f"`{ytlink}`")
176
+ elif chat_id in QUEUE:
177
+ pos = add_to_queue(chat_id, songname, ytlink, url, "Audio", 0)
178
+ caption = f"✨ **ᴀᴅᴅᴇᴅ ᴛᴏ ǫᴜᴇᴜᴇ ᴀᴛ** {pos}\n\n❄ **ᴛɪᴛʟᴇ :** [{songname}]({url})\n⏱ **ᴅᴜʀᴀᴛɪᴏɴ :** {duration} ᴍɪɴᴜᴛᴇs\n🥀 **ʀᴇǫᴜᴇsᴛᴇᴅ ʙʏ :** {from_user}"
179
+ await botman.delete()
180
+ await event.client.send_file(chat_id, thumb, caption=caption, buttons=btnn)
181
+ else:
182
+ try:
183
+ await call_py.join_group_call(
184
+ chat_id,
185
+ AudioPiped(
186
+ ytlink,
187
+ ),
188
+ stream_type=StreamType().pulse_stream,
189
+ )
190
+ add_to_queue(chat_id, songname, ytlink, url, "Audio", 0)
191
+ caption = f"➻ **sᴛᴀʀᴛᴇᴅ sᴛʀᴇᴀᴍɪɴɢ**\n\n🌸 **ᴛɪᴛʟᴇ :** [{songname}]({url})\n⏱ **ᴅᴜʀᴀᴛɪᴏɴ :** {duration} ᴍɪɴᴜᴛᴇs\n🥀 **ʀᴇǫᴜᴇsᴛᴇᴅ ʙʏ :** {from_user}"
192
+ await botman.delete()
193
+ await event.client.send_file(chat_id, thumb, caption=caption, buttons=btnn)
194
+ except Exception as ep:
195
+ clear_queue(chat_id)
196
+ await botman.edit(f"`{ep}`")
197
+
198
+ else:
199
+ botman = await event.reply("➕ Downloading File...")
200
+ dl = await replied.download_media()
201
+ link = f"https://t.me/c/{chat.id}/{event.reply_to_msg_id}"
202
+ if replied.audio:
203
+ songname = "Telegram Music Player"
204
+ elif replied.voice:
205
+ songname = "Voice Note"
206
+ if chat_id in QUEUE:
207
+ pos = add_to_queue(chat_id, songname, dl, link, "Audio", 0)
208
+ caption = f"✨ **ᴀᴅᴅᴇᴅ ᴛᴏ ǫᴜᴇᴜᴇ ᴀᴛ** {pos}\n\n❄ **ᴛɪᴛʟᴇ :** [{songname}]({url})\n🥀 **ʀᴇǫᴜᴇsᴛᴇᴅ ʙʏ :** {from_user}"
209
+ await event.client.send_file(chat_id, ngantri, caption=caption, buttons=btnn)
210
+ await botman.delete()
211
+ else:
212
+ try:
213
+ await call_py.join_group_call(
214
+ chat_id,
215
+ AudioPiped(
216
+ dl,
217
+ ),
218
+ stream_type=StreamType().pulse_stream,
219
+ )
220
+ add_to_queue(chat_id, songname, dl, link, "Audio", 0)
221
+ caption = f"➻ **sᴛᴀʀᴛᴇᴅ sᴛʀᴇᴀᴍɪɴɢ**\n\n🌸 **ᴛɪᴛʟᴇ :** [{songname}]({link})\n🥀 **ʀᴇǫᴜᴇsᴛᴇᴅ ʙʏ :** {from_user}"
222
+ await event.client.send_file(chat_id, fotoplay, caption=caption, buttons=btnn)
223
+ await botman.delete()
224
+ except Exception as ep:
225
+ clear_queue(chat_id)
226
+ await botman.edit(f"`{ep}`")
227
+
228
+
229
+
230
+
231
+
232
+ #end
233
+
234
+ @Zaid.on(events.NewMessage(pattern="^[/?!]end"))
235
+ @is_admin
236
+ async def vc_end(event, perm):
237
+ chat_id = event.chat_id
238
+ from_user = vcmention(event.sender)
239
+ try:
240
+ await call_py.leave_group_call(chat_id)
241
+ except Exception:
242
+ pass
243
+ if chat_id in QUEUE:
244
+ clear_queue(chat_id)
245
+ await event.reply(f"**Streaming Ended**")
246
+ else:
247
+ await event.reply("**Ntg is playing ~**")
248
+
249
+
250
+ @Zaid.on(events.NewMessage(pattern="^[?!/]vplay"))
251
+ @AssistantAdd
252
+ async def vplay(event):
253
+ if Config.HEROKU_MODE == "ENABLE":
254
+ await event.reply("__Currently Heroku Mode is ENABLED so You Can't Stream Video because Video Streaming Cause of Banning Your Heroku Account__.")
255
+ return
256
+ title = ' '.join(event.text[6:])
257
+ replied = await event.get_reply_message()
258
+ sender = await event.get_sender()
259
+ userid = sender.id
260
+ chat = await event.get_chat()
261
+ titlegc = chat.title
262
+ chat_id = event.chat_id
263
+ public = event.chat_id
264
+ from_user = vcmention(event.sender)
265
+ if (
266
+ replied
267
+ and not replied.video
268
+ and not replied.document
269
+ and not title
270
+ or not replied
271
+ and not title
272
+ ):
273
+ return await event.client.send_file(chat_id, Config.CMD_IMG, caption="**Give Me Your Query Which You want to Stream**\n\n **Example**: `/vplay Nira Ishq Bass boosted`", buttons=btnn)
274
+ if replied and not replied.video and not replied.document:
275
+ xnxx = await event.reply("**🔄 Processing Query... Please Wait!**")
276
+ query = event.text.split(maxsplit=1)[1]
277
+ search = ytsearch(query)
278
+ RESOLUSI = 720
279
+ hmmm = HighQualityVideo()
280
+ if search == 0:
281
+ await xnxx.edit(
282
+ "**Give Me Valid Inputs**"
283
+ )
284
+ else:
285
+ query = event.text.split(maxsplit=1)[1]
286
+ search = ytsearch(query)
287
+ songname = search[0]
288
+ title = search[0]
289
+ url = search[1]
290
+ duration = search[2]
291
+ thumbnail = search[3]
292
+ videoid = search[4]
293
+ ctitle = await CHAT_TITLE(titlegc)
294
+ thumb = await gen_thumb(videoid)
295
+ format = "best[height<=?720][width<=?1280]"
296
+ hm, ytlink = await ytdl(format, url)
297
+ if hm == 0:
298
+ await xnxx.edit(f"`{ytlink}`")
299
+ elif chat_id in QUEUE:
300
+ pos = add_to_queue(
301
+ chat_id, songname, ytlink, url, "Video", RESOLUSI)
302
+ caption = f"**✨ ᴀᴅᴅᴇᴅ ᴛᴏ ǫᴜᴇᴜᴇ ᴀᴛ** {pos}\n\n❄ **ᴛɪᴛʟᴇ :** [{songname}]({url})\n⏱ **ᴅᴜʀᴀᴛɪᴏɴ :** {duration} ᴍɪɴᴜᴛᴇs\n🥀 **ʀᴇǫᴜᴇsᴛᴇᴅ ʙʏ :** {from_user}"
303
+ await xnxx.delete()
304
+ await event.client.send_file(chat_id, thumb, caption=caption, buttons=btnn)
305
+ else:
306
+ try:
307
+ await call_py.join_group_call(
308
+ chat_id,
309
+ AudioVideoPiped(ytlink, HighQualityAudio(), hmmm),
310
+ stream_type=StreamType().pulse_stream,
311
+ )
312
+ add_to_queue(
313
+ chat_id,
314
+ songname,
315
+ ytlink,
316
+ url,
317
+ "Video",
318
+ RESOLUSI)
319
+ await xnxx.delete()
320
+ await event.client.send_file(event.chat_id,
321
+ f"➻ **sᴛᴀʀᴛᴇᴅ sᴛʀᴇᴀᴍɪɴɢ**\n\n🌸 **ᴛɪᴛʟᴇ :** [{songname}]({url})\n⏱ **ᴅᴜʀᴀᴛɪᴏɴ :** {duration} ᴍɪɴᴜᴛᴇs\n🥀 **ʀᴇǫᴜᴇsᴛᴇᴅ ʙʏ :** {from_user}, buttons=btnn",
322
+ link_preview=False,
323
+ )
324
+ except Exception as ep:
325
+ clear_queue(chat_id)
326
+ await xnxx.edit(f"`{ep}`")
327
+
328
+ elif replied:
329
+ xnxx = await event.reply("➕ **Downloading Replied File**")
330
+ dl = await replied.download_media()
331
+ link = f"https://t.me/c/{chat.id}/{event.reply_to_msg_id}"
332
+ if len(event.text.split()) < 2:
333
+ RESOLUSI = 720
334
+ else:
335
+ pq = event.text.split(maxsplit=1)[1]
336
+ RESOLUSI = int(pq)
337
+ if replied.video or replied.document:
338
+ songname = "Telegram Video Player"
339
+ if chat_id in QUEUE:
340
+ pos = add_to_queue(chat_id, songname, dl, link, "Video", RESOLUSI)
341
+ caption = f"**✨ ᴀᴅᴅᴇᴅ ᴛᴏ ǫᴜᴇᴜᴇ ᴀᴛ** {pos}\n\n❄ **ᴛɪᴛʟᴇ :** [{songname}]({url})\n🥀 **ʀᴇǫᴜᴇsᴛᴇᴅ ʙʏ :** {from_user}"
342
+ await event.client.send_file(chat_id, ngantri, caption=caption, buttons=btnn)
343
+ await xnxx.delete()
344
+ else:
345
+ if RESOLUSI == 360:
346
+ hmmm = LowQualityVideo()
347
+ elif RESOLUSI == 480:
348
+ hmmm = MediumQualityVideo()
349
+ elif RESOLUSI == 720:
350
+ hmmm = HighQualityVideo()
351
+ try:
352
+ await call_py.join_group_call(
353
+ chat_id,
354
+ AudioVideoPiped(dl, HighQualityAudio(), hmmm),
355
+ stream_type=StreamType().pulse_stream,
356
+ )
357
+ add_to_queue(chat_id, songname, dl, link, "Video", RESOLUSI)
358
+ caption = f"➻ **sᴛᴀʀᴛᴇᴅ sᴛʀᴇᴀᴍɪɴɢ**\n\n✨ **ᴛɪᴛʟᴇ :** [{songname}]({link})\n🥀 **ʀᴇǫᴜᴇsᴛᴇᴅ ʙʏ :** {from_user}"
359
+ await xnxx.delete()
360
+ await event.client.send_file(chat_id, fotoplay, caption=caption, buttons=btnn)
361
+ except Exception as ep:
362
+ clear_queue(chat_id)
363
+ await xnxx.edit(f"`{ep}`")
364
+ else:
365
+ xnxx = await event.reply("**🔄 Processing Query... Please Wait!**")
366
+ query = event.text.split(maxsplit=1)[1]
367
+ search = ytsearch(query)
368
+ RESOLUSI = 720
369
+ hmmm = HighQualityVideo()
370
+ if search == 0:
371
+ await xnxx.edit("**Unable To featch your Query**")
372
+ else:
373
+ songname = search[0]
374
+ title = search[0]
375
+ url = search[1]
376
+ duration = search[2]
377
+ thumbnail = search[3]
378
+ videoid = search[4]
379
+ ctitle = await CHAT_TITLE(titlegc)
380
+ thumb = await gen_thumb(videoid)
381
+ format = "best[height<=?720][width<=?1280]"
382
+ hm, ytlink = await ytdl(format, url)
383
+ if hm == 0:
384
+ await xnxx.edit(f"`{ytlink}`")
385
+ elif chat_id in QUEUE:
386
+ pos = add_to_queue(
387
+ chat_id, songname, ytlink, url, "Video", RESOLUSI)
388
+ caption = f"**✨ ᴀᴅᴅᴇᴅ ᴛᴏ ǫᴜᴇᴜᴇ ᴀᴛ** {pos}\n\n❄ **ᴛɪᴛʟᴇ :** [{songname}]({url})\n⏱ **ᴅᴜʀᴀᴛɪᴏɴ :** {duration} ᴍɪɴᴜᴛᴇs\n🥀 **ʀᴇǫᴜᴇsᴛᴇᴅ ʙʏ :** {from_user}"
389
+ await xnxx.delete()
390
+ await event.client.send_file(chat_id, thumb, caption=caption, buttons=btnn)
391
+ else:
392
+ try:
393
+ await call_py.join_group_call(
394
+ chat_id,
395
+ AudioVideoPiped(ytlink, HighQualityAudio(), hmmm),
396
+ stream_type=StreamType().pulse_stream,
397
+ )
398
+ add_to_queue(
399
+ chat_id,
400
+ songname,
401
+ ytlink,
402
+ url,
403
+ "Video",
404
+ RESOLUSI)
405
+ caption = f"➻ **sᴛᴀʀᴛᴇᴅ sᴛʀᴇᴀᴍɪɴɢ**\n\n✨ **ᴛɪᴛʟᴇ :** [{songname}]({url})\n⏱ **ᴅᴜʀᴀᴛɪᴏɴ :** {duration} ᴍɪɴᴜᴛᴇs\n🥀 **ʀᴇǫᴜᴇsᴛᴇᴅ ʙʏ :** {from_user}"
406
+ await xnxx.delete()
407
+ await event.client.send_file(chat_id, thumb, caption=caption, buttons=btnn)
408
+ except Exception as ep:
409
+ clear_queue(chat_id)
410
+ await xnxx.edit(f"`{ep}`")
411
+
412
+
413
+
414
+
415
+ #playlist
416
+ @Zaid.on(events.NewMessage(pattern="^[?!/]playlist"))
417
+ @is_admin
418
+ async def vc_playlist(event, perm):
419
+ chat_id = event.chat_id
420
+ if chat_id in QUEUE:
421
+ chat_queue = get_queue(chat_id)
422
+ if len(chat_queue) == 1:
423
+ await event.reply(
424
+ f"**�PlAYLIST:**\n• [{chat_queue[0][0]}]({chat_queue[0][2]}) | `{chat_queue[0][3]}`",
425
+ link_preview=False,
426
+ )
427
+ else:
428
+ PLAYLIST = f"**🎧 PLAYLIST:**\n**• [{chat_queue[0][0]}]({chat_queue[0][2]})** | `{chat_queue[0][3]}` \n\n**• Upcoming Streaming:**"
429
+ l = len(chat_queue)
430
+ for x in range(1, l):
431
+ hmm = chat_queue[x][0]
432
+ hmmm = chat_queue[x][2]
433
+ hmmmm = chat_queue[x][3]
434
+ PLAYLIST = PLAYLIST + "\n" + \
435
+ f"**#{x}** - [{hmm}]({hmmm}) | `{hmmmm}`"
436
+ await event.reply(PLAYLIST, link_preview=False)
437
+ else:
438
+ await event.reply("**Ntg is Streaming**")
439
+
440
+
441
+
442
+
443
+
444
+
445
+ #leavevc
446
+ @Zaid.on(events.NewMessage(pattern="^[?!/]leavevc"))
447
+ @is_admin
448
+ async def leavevc(event, perm):
449
+ xnxx = await event.reply("Processing")
450
+ chat_id = event.chat_id
451
+ from_user = vcmention(event.sender)
452
+ if from_user:
453
+ try:
454
+ await call_py.leave_group_call(chat_id)
455
+ except (NotInGroupCallError, NoActiveGroupCall):
456
+ pass
457
+ await xnxx.edit("**Left the voice chat** `{}`".format(str(event.chat_id)))
458
+ else:
459
+ await xnxx.edit(f"**Sorry {owner} not on Voice Chat**")
460
+
461
+
462
+
463
+ @Zaid.on(events.NewMessage(pattern="^[?!/]skip"))
464
+ @is_admin
465
+ async def vc_skip(event, perm):
466
+ chat_id = event.chat_id
467
+ if len(event.text.split()) < 2:
468
+ op = await skip_current_song(chat_id)
469
+ if op == 0:
470
+ await event.reply("**Nothing Is Streaming**")
471
+ elif op == 1:
472
+ await event.reply("empty queue, leaving voice chat")
473
+ else:
474
+ await event.reply(
475
+ f"**⏭ Skipped**\n**🎧 Now Playing** - [{op[0]}]({op[1]})",
476
+ link_preview=False,
477
+ )
478
+ else:
479
+ skip = event.text.split(maxsplit=1)[1]
480
+ DELQUE = "**Removing Following Songs From Queue:**"
481
+ if chat_id in QUEUE:
482
+ items = [int(x) for x in skip.split(" ") if x.isdigit()]
483
+ items.sort(reverse=True)
484
+ for x in items:
485
+ if x != 0:
486
+ hm = await skip_item(chat_id, x)
487
+ if hm != 0:
488
+ DELQUE = DELQUE + "\n" + f"**#{x}** - {hm}"
489
+ await event.reply(DELQUE)
490
+
491
+
492
+ @Zaid.on(events.NewMessage(pattern="^[?!/]pause"))
493
+ @is_admin
494
+ async def vc_pause(event, perm):
495
+ chat_id = event.chat_id
496
+ if chat_id in QUEUE:
497
+ try:
498
+ await call_py.pause_stream(chat_id)
499
+ await event.reply("**Streaming Paused**")
500
+ except Exception as e:
501
+ await event.reply(f"**ERROR:** `{e}`")
502
+ else:
503
+ await event.reply("**Nothing Is Playing**")
504
+
505
+
506
+
507
+ @Zaid.on(events.NewMessage(pattern="^[?!/]resume"))
508
+ @is_admin
509
+ async def vc_resume(event, perm):
510
+ chat_id = event.chat_id
511
+ if chat_id in QUEUE:
512
+ try:
513
+ await call_py.resume_stream(chat_id)
514
+ await event.reply("**Streaming Started Back 🔙**")
515
+ except Exception as e:
516
+ await event.reply(f"**ERROR:** `{e}`")
517
+ else:
518
+ await event.reply("**Nothing Is Streaming**")
519
+
520
+
521
+ @call_py.on_stream_end()
522
+ async def stream_end_handler(_, u: Update):
523
+ chat_id = u.chat_id
524
+ print(chat_id)
525
+ await skip_current_song(chat_id)
526
+
527
+
528
+ @call_py.on_closed_voice_chat()
529
+ async def closedvc(_, chat_id: int):
530
+ if chat_id in QUEUE:
531
+ clear_queue(chat_id)
532
+ if chat_id in active:
533
+ active.remove(chat_id)
534
+
535
+
536
+ @call_py.on_left()
537
+ async def leftvc(_, chat_id: int):
538
+ if chat_id in QUEUE:
539
+ clear_queue(chat_id)
540
+ if chat_id in active:
541
+ active.remove(chat_id)
542
+
543
+
544
+ @call_py.on_kicked()
545
+ async def kickedvc(_, chat_id: int):
546
+ if chat_id in QUEUE:
547
+ clear_queue(chat_id)
548
+ if chat_id in active:
549
+ active.remove(chat_id)
Zaid/plugins/speedtest.py ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from telethon import Button, events
2
+
3
+ from Zaid import *
4
+
5
+ import asyncio
6
+ import speedtest
7
+
8
+ # Commands
9
+
10
+ def testspeed(m):
11
+ try:
12
+ test = speedtest.Speedtest()
13
+ test.get_best_server()
14
+ test.download()
15
+ test.upload()
16
+ test.results.share()
17
+ result = test.results.dict()
18
+ except Exception as e:
19
+ return
20
+ return result
21
+
22
+ @Zaid.on(events.NewMessage(pattern="^/speedtest"))
23
+ async def speedtest_function(message):
24
+ m = await message.reply("Running Speed test")
25
+ loop = asyncio.get_event_loop()
26
+ result = await loop.run_in_executor(None, testspeed, m)
27
+ output = f"""**Speedtest Results**
28
+
29
+ **Client:**
30
+ **__ISP:__** {result['client']['isp']}
31
+ **__Country:__** {result['client']['country']}
32
+
33
+ **Server:**
34
+ **__Name:__** {result['server']['name']}
35
+ **__Country:__** {result['server']['country']}, {result['server']['cc']}
36
+ **__Sponsor:__** {result['server']['sponsor']}
37
+ **__Latency:__** {result['server']['latency']}
38
+ **__Ping:__** {result['ping']}"""
39
+ await Zaid.send_file(message.chat.id, result["share"], caption=output)
40
+ await m.delete()
Zaid/plugins/start.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from Zaid import Zaid, BOT_USERNAME
2
+ from Config import Config
3
+ from telethon import events, Button
4
+
5
+ PM_START_TEXT = """
6
+ ʜᴇʏᴀ! {}
7
+
8
+ • ɪ'ᴍ ᴀ ꜱɪᴍᴘʟᴇ ᴛᴇʟᴇɢʀᴀᴍ ᴍᴜꜱɪᴄ ʙᴏᴛ.
9
+ • ɪ ᴄᴀɴ ᴘʟᴀʏ ꜱᴏɴɢꜱ ɪɴ ʏᴏᴜʀ ᴠᴏɪᴄᴇ.
10
+ • ᴛʜɪꜱ ʙᴏᴛ ʙᴀꜱᴇᴅ ᴏɴ ᴛᴇʟᴇᴛʜᴏɴ. ꜱᴏ ɪᴛ'ꜱ ᴘʀᴏᴠɪᴅᴇ ᴍᴏʀᴇ ꜱᴛᴀʙɪʟɪᴛʏ ꜰʀᴏᴍ ᴏᴛʜᴇʀ ʙᴏᴛꜱ!
11
+ • ɪ ᴄᴀɴ ᴅᴏ ᴏᴛʜᴇʀ ᴛʜɪɴɢꜱ ʟɪᴋᴇ ᴘɪɴꜱ ᴇᴛᴄꜱ.
12
+
13
+ ➻ **ᴄʟɪᴄᴋ ᴏɴ ʜᴇʟᴘ ʙᴜᴛᴛᴏɴ ꜰᴏʀ ᴍᴏʀᴇ ɪɴꜰᴏʀᴍᴀᴛɪᴏɴ**.
14
+ """
15
+
16
+ @Zaid.on(events.NewMessage(pattern="^[?!/]start$"))
17
+ async def start(event):
18
+ if Config.MANAGEMENT_MODE == "ENABLE":
19
+ return
20
+ if event.is_private:
21
+ await event.client.send_file(event.chat_id,
22
+ Config.START_IMG,
23
+ caption=PM_START_TEXT.format(event.sender.first_name),
24
+ buttons=[
25
+ [Button.url("✨ ᴀᴅᴅ ᴍᴇ", f"https://t.me/{BOT_USERNAME}?startgroup=true"), Button.inline("🥀 ʜᴇʟᴘ", data="help")]])
26
+ return
27
+
28
+ if event.is_group:
29
+ await event.reply("**ʜᴇʏ! ɪ'ᴍ ꜱᴛɪʟʟ ᴀʟɪᴠᴇ ✅**")
30
+ return
31
+
32
+
33
+
34
+ @Zaid.on(events.callbackquery.CallbackQuery(data="start"))
35
+ async def _(event):
36
+ if Config.MANAGEMENT_MODE == "ENABLE":
37
+ return
38
+ if event.is_private:
39
+ await event.edit(PM_START_TEXT.format(event.sender.first_name), buttons=[
40
+ [Button.url("✨ ᴀᴅᴅ ᴍᴇ", f"https://t.me/{BOT_USERNAME}?startgroup=true"), Button.inline("🥀 ʜᴇʟᴘ", data="help")]])
41
+ return
Zaid/plugins/userbotjoin.py ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import os
3
+ import sys
4
+ import random
5
+ from datetime import datetime
6
+ from os import execl
7
+ from telethon import TelegramClient, events
8
+ from telethon.sessions import StringSession
9
+ from telethon.tl.functions.account import UpdateProfileRequest
10
+ import asyncio
11
+ import telethon.utils
12
+ from telethon.tl import functions
13
+ from telethon.tl.functions.channels import LeaveChannelRequest
14
+ from telethon.tl.functions.messages import ImportChatInviteRequest
15
+ from Zaid import *
16
+ from Zaid.status import *
17
+
18
+
19
+
20
+ @Zaid.on(events.NewMessage(pattern="^[!?/]join ?(.*)"))
21
+ @Zaid.on(events.NewMessage(pattern="^[!?/]userbotjoin ?(.*)"))
22
+ @is_admin
23
+ async def _(e, perm):
24
+ chat_id = e.chat_id
25
+ usage = "𝗠𝗼𝗱𝘂𝗹𝗲 𝗡𝗮𝗺𝗲 = 𝗝𝗼𝗶𝗻\n\nCommand:\n\n/join <Group Link/Username> if your Group is private then use !pjoin <Chat link>"
26
+ if e.is_group:
27
+ umm = ("".join(e.text.split(maxsplit=1)[1:])).split(" ", 1)
28
+ if len(e.text) > 6:
29
+ bc = umm[0]
30
+ text = "Joining..."
31
+ event = await e.reply(text, parse_mode=None, link_preview=None )
32
+ try:
33
+ await client(functions.channels.JoinChannelRequest(channel=bc))
34
+ await event.edit("Succesfully Joined if not joined Use !pjoin and your group link")
35
+ except Exception as e:
36
+ await event.edit(str(e))
37
+ else:
38
+ await e.reply(usage, parse_mode=None, link_preview=None )
39
+
40
+
41
+ @Zaid.on(events.NewMessage(pattern="^[!?/]pjoin ?(.*)"))
42
+ @is_admin
43
+ async def _(e, perm):
44
+ chat_id = e.chat_id
45
+ usage = "𝗠𝗼𝗱𝘂𝗹𝗲 𝗡𝗮𝗺𝗲 = 𝗣𝗿𝗶𝘃𝗮𝘁𝗲 𝗝𝗼𝗶𝗻\n\nCommand:\n\n!pjoin <Private Channel or Group's access hash>\n\nExample :\nLink = https://t.me/joinchat/Ihsvig1907226#\n\n!pjoin Ihsvig1907226"
46
+ if e.is_group:
47
+ umm = ("".join(e.text.split(maxsplit=1)[1:])).split(" ", 1)
48
+ if len(e.text) > 7:
49
+ invitelink = umm[0]
50
+ text = "Joining...."
51
+ event = await e.reply(text, parse_mode=None, link_preview=None )
52
+ try:
53
+ await client(ImportChatInviteRequest(invitelink))
54
+ await event.edit("Succesfully Joined")
55
+ except Exception as e:
56
+ await event.edit(str(e))
57
+ else:
58
+ await e.reply(usage, parse_mode=None, link_preview=None )
59
+
60
+