Delete DragMusic/plugins/play/play.py
Browse files- DragMusic/plugins/play/play.py +0 -607
DragMusic/plugins/play/play.py
DELETED
@@ -1,607 +0,0 @@
|
|
1 |
-
import random
|
2 |
-
import string
|
3 |
-
import tempfile
|
4 |
-
import os
|
5 |
-
|
6 |
-
from pyrogram import filters
|
7 |
-
from pyrogram.types import InlineKeyboardMarkup, InputMediaPhoto, Message
|
8 |
-
from pytgcalls.exceptions import NoActiveGroupCall
|
9 |
-
|
10 |
-
import config
|
11 |
-
from DragMusic import Apple, Resso, SoundCloud, Spotify, Telegram, YouTube, app
|
12 |
-
from DragMusic.core.call import Drag
|
13 |
-
from DragMusic.utils import seconds_to_min, time_to_seconds
|
14 |
-
from DragMusic.utils.channelplay import get_channeplayCB
|
15 |
-
from DragMusic.utils.decorators.language import languageCB
|
16 |
-
from DragMusic.utils.decorators.play import PlayWrapper
|
17 |
-
from DragMusic.utils.formatters import formats
|
18 |
-
from DragMusic.utils.inline import (
|
19 |
-
botplaylist_markup,
|
20 |
-
livestream_markup,
|
21 |
-
playlist_markup,
|
22 |
-
slider_markup,
|
23 |
-
track_markup,
|
24 |
-
)
|
25 |
-
from DragMusic.utils.logger import play_logs
|
26 |
-
from DragMusic.utils.stream.stream import stream
|
27 |
-
from config import BANNED_USERS, lyrical, BITFLOW_API_KEY
|
28 |
-
|
29 |
-
|
30 |
-
@app.on_message(
|
31 |
-
filters.command(
|
32 |
-
[
|
33 |
-
"play",
|
34 |
-
"vplay",
|
35 |
-
"cplay",
|
36 |
-
"cvplay",
|
37 |
-
"playforce",
|
38 |
-
"vplayforce",
|
39 |
-
"cplayforce",
|
40 |
-
"cvplayforce",
|
41 |
-
]
|
42 |
-
)
|
43 |
-
& filters.group
|
44 |
-
& ~BANNED_USERS
|
45 |
-
)
|
46 |
-
@PlayWrapper
|
47 |
-
async def play_commnd(
|
48 |
-
client,
|
49 |
-
message: Message,
|
50 |
-
_,
|
51 |
-
chat_id,
|
52 |
-
video,
|
53 |
-
channel,
|
54 |
-
playmode,
|
55 |
-
url,
|
56 |
-
fplay,
|
57 |
-
):
|
58 |
-
mystic = await message.reply_text(
|
59 |
-
_["play_2"].format(channel) if channel else _["play_1"]
|
60 |
-
)
|
61 |
-
plist_id = None
|
62 |
-
slider = None
|
63 |
-
plist_type = None
|
64 |
-
spotify = None
|
65 |
-
user_id = message.from_user.id
|
66 |
-
user_name = message.from_user.first_name
|
67 |
-
audio_telegram = (
|
68 |
-
(message.reply_to_message.audio or message.reply_to_message.voice)
|
69 |
-
if message.reply_to_message
|
70 |
-
else None
|
71 |
-
)
|
72 |
-
video_telegram = (
|
73 |
-
(message.reply_to_message.video or message.reply_to_message.document)
|
74 |
-
if message.reply_to_message
|
75 |
-
else None
|
76 |
-
)
|
77 |
-
if audio_telegram:
|
78 |
-
if audio_telegram.file_size > 104857600:
|
79 |
-
return await mystic.edit_text(_["play_5"])
|
80 |
-
duration_min = seconds_to_min(audio_telegram.duration)
|
81 |
-
if (audio_telegram.duration) > config.DURATION_LIMIT:
|
82 |
-
return await mystic.edit_text(
|
83 |
-
_["play_6"].format(config.DURATION_LIMIT_MIN, app.mention)
|
84 |
-
)
|
85 |
-
file_path = await Telegram.get_filepath(audio=audio_telegram)
|
86 |
-
if await Telegram.download(_, message, mystic, file_path):
|
87 |
-
message_link = await Telegram.get_link(message)
|
88 |
-
file_name = await Telegram.get_filename(audio_telegram, audio=True)
|
89 |
-
dur = await Telegram.get_duration(audio_telegram, file_path)
|
90 |
-
details = {
|
91 |
-
"title": file_name,
|
92 |
-
"link": message_link,
|
93 |
-
"path": file_path,
|
94 |
-
"dur": dur,
|
95 |
-
}
|
96 |
-
|
97 |
-
try:
|
98 |
-
await stream(
|
99 |
-
_,
|
100 |
-
mystic,
|
101 |
-
user_id,
|
102 |
-
details,
|
103 |
-
chat_id,
|
104 |
-
user_name,
|
105 |
-
message.chat.id,
|
106 |
-
streamtype="telegram",
|
107 |
-
forceplay=fplay,
|
108 |
-
)
|
109 |
-
except Exception as e:
|
110 |
-
print(f"Error: {e}")
|
111 |
-
ex_type = type(e).__name__
|
112 |
-
err = e if ex_type == "AssistantErr" else _["general_2"].format(ex_type)
|
113 |
-
return await mystic.edit_text(err)
|
114 |
-
return await mystic.delete()
|
115 |
-
return
|
116 |
-
elif video_telegram:
|
117 |
-
if message.reply_to_message.document:
|
118 |
-
try:
|
119 |
-
ext = video_telegram.file_name.split(".")[-1]
|
120 |
-
if ext.lower() not in formats:
|
121 |
-
return await mystic.edit_text(
|
122 |
-
_["play_7"].format(f"{' | '.join(formats)}")
|
123 |
-
)
|
124 |
-
except:
|
125 |
-
return await mystic.edit_text(
|
126 |
-
_["play_7"].format(f"{' | '.join(formats)}")
|
127 |
-
)
|
128 |
-
if video_telegram.file_size > config.TG_VIDEO_FILESIZE_LIMIT:
|
129 |
-
return await mystic.edit_text(_["play_8"])
|
130 |
-
file_path = await Telegram.get_filepath(video=video_telegram)
|
131 |
-
if await Telegram.download(_, message, mystic, file_path):
|
132 |
-
message_link = await Telegram.get_link(message)
|
133 |
-
file_name = await Telegram.get_filename(video_telegram)
|
134 |
-
dur = await Telegram.get_duration(video_telegram, file_path)
|
135 |
-
details = {
|
136 |
-
"title": file_name,
|
137 |
-
"link": message_link,
|
138 |
-
"path": file_path,
|
139 |
-
"dur": dur,
|
140 |
-
}
|
141 |
-
try:
|
142 |
-
await stream(
|
143 |
-
_,
|
144 |
-
mystic,
|
145 |
-
user_id,
|
146 |
-
details,
|
147 |
-
chat_id,
|
148 |
-
user_name,
|
149 |
-
message.chat.id,
|
150 |
-
video=True,
|
151 |
-
streamtype="telegram",
|
152 |
-
forceplay=fplay,
|
153 |
-
)
|
154 |
-
except Exception as e:
|
155 |
-
print(f"Error: {e}")
|
156 |
-
ex_type = type(e).__name__
|
157 |
-
err = e if ex_type == "AssistantErr" else _["general_2"].format(ex_type)
|
158 |
-
return await mystic.edit_text(err)
|
159 |
-
return await mystic.delete()
|
160 |
-
return
|
161 |
-
elif url:
|
162 |
-
if await YouTube.exists(url):
|
163 |
-
if "playlist" in url:
|
164 |
-
try:
|
165 |
-
details = await YouTube.playlist(
|
166 |
-
url,
|
167 |
-
config.PLAYLIST_FETCH_LIMIT,
|
168 |
-
message.from_user.id,
|
169 |
-
)
|
170 |
-
except:
|
171 |
-
return await mystic.edit_text(_["play_3"])
|
172 |
-
streamtype = "playlist"
|
173 |
-
plist_type = "yt"
|
174 |
-
if "&" in url:
|
175 |
-
plist_id = (url.split("=")[1]).split("&")[0]
|
176 |
-
else:
|
177 |
-
plist_id = url.split("=")[1]
|
178 |
-
img = config.PLAYLIST_IMG_URL
|
179 |
-
cap = _["play_9"]
|
180 |
-
else:
|
181 |
-
try:
|
182 |
-
bitflow_result = await YouTube.bitflow_video(url, api_key=BITFLOW_API_KEY)
|
183 |
-
if bitflow_result and bitflow_result.get("status") == "success":
|
184 |
-
details = {
|
185 |
-
"title": bitflow_result.get("title"),
|
186 |
-
"duration_min": bitflow_result.get("duration"),
|
187 |
-
"thumb": bitflow_result.get("thumbnail"),
|
188 |
-
"link": bitflow_result.get("url"),
|
189 |
-
}
|
190 |
-
track_id = bitflow_result.get("id")
|
191 |
-
streamtype = "youtube"
|
192 |
-
img = details["thumb"]
|
193 |
-
cap = _["play_10"].format(details["title"], details["duration_min"])
|
194 |
-
else:
|
195 |
-
details, track_id = await YouTube.track(url)
|
196 |
-
streamtype = "youtube"
|
197 |
-
img = details["thumb"]
|
198 |
-
cap = _["play_10"].format(details["title"], details["duration_min"])
|
199 |
-
except Exception as e:
|
200 |
-
print(f"Bitflow API error: {e}")
|
201 |
-
try:
|
202 |
-
details, track_id = await YouTube.track(url)
|
203 |
-
streamtype = "youtube"
|
204 |
-
img = details["thumb"]
|
205 |
-
cap = _["play_10"].format(details["title"], details["duration_min"])
|
206 |
-
except:
|
207 |
-
return await mystic.edit_text(_["play_3"])
|
208 |
-
elif await Spotify.valid(url):
|
209 |
-
spotify = True
|
210 |
-
if not config.SPOTIFY_CLIENT_ID and not config.SPOTIFY_CLIENT_SECRET:
|
211 |
-
return await mystic.edit_text(
|
212 |
-
"» sᴘᴏᴛɪғʏ ɪs ɴᴏᴛ sᴜᴘᴘᴏʀᴛᴇᴅ ʏᴇᴛ.\n\nᴘʟᴇᴀsᴇ ᴛʀʏ ᴀɢᴀɪɴ ʟᴀᴛᴇʀ."
|
213 |
-
)
|
214 |
-
if "track" in url:
|
215 |
-
try:
|
216 |
-
details, track_id = await Spotify.track(url)
|
217 |
-
except:
|
218 |
-
return await mystic.edit_text(_["play_3"])
|
219 |
-
streamtype = "youtube"
|
220 |
-
img = details["thumb"]
|
221 |
-
cap = _["play_10"].format(details["title"], details["duration_min"])
|
222 |
-
elif "playlist" in url:
|
223 |
-
try:
|
224 |
-
details, plist_id = await Spotify.playlist(url)
|
225 |
-
except Exception:
|
226 |
-
return await mystic.edit_text(_["play_3"])
|
227 |
-
streamtype = "playlist"
|
228 |
-
plist_type = "spplay"
|
229 |
-
img = config.SPOTIFY_PLAYLIST_IMG_URL
|
230 |
-
cap = _["play_11"].format(app.mention, message.from_user.mention)
|
231 |
-
elif "album" in url:
|
232 |
-
try:
|
233 |
-
details, plist_id = await Spotify.album(url)
|
234 |
-
except:
|
235 |
-
return await mystic.edit_text(_["play_3"])
|
236 |
-
streamtype = "playlist"
|
237 |
-
plist_type = "spalbum"
|
238 |
-
img = config.SPOTIFY_ALBUM_IMG_URL
|
239 |
-
cap = _["play_11"].format(app.mention, message.from_user.mention)
|
240 |
-
elif "artist" in url:
|
241 |
-
try:
|
242 |
-
details, plist_id = await Spotify.artist(url)
|
243 |
-
except:
|
244 |
-
return await mystic.edit_text(_["play_3"])
|
245 |
-
streamtype = "playlist"
|
246 |
-
plist_type = "spartist"
|
247 |
-
img = config.SPOTIFY_ARTIST_IMG_URL
|
248 |
-
cap = _["play_11"].format(message.from_user.first_name)
|
249 |
-
else:
|
250 |
-
return await mystic.edit_text(_["play_15"])
|
251 |
-
elif await Apple.valid(url):
|
252 |
-
if "album" in url:
|
253 |
-
try:
|
254 |
-
details, track_id = await Apple.track(url)
|
255 |
-
except:
|
256 |
-
return await mystic.edit_text(_["play_3"])
|
257 |
-
streamtype = "youtube"
|
258 |
-
img = details["thumb"]
|
259 |
-
cap = _["play_10"].format(details["title"], details["duration_min"])
|
260 |
-
elif "playlist" in url:
|
261 |
-
spotify = True
|
262 |
-
try:
|
263 |
-
details, plist_id = await Apple.playlist(url)
|
264 |
-
except:
|
265 |
-
return await mystic.edit_text(_["play_3"])
|
266 |
-
streamtype = "playlist"
|
267 |
-
plist_type = "apple"
|
268 |
-
cap = _["play_12"].format(app.mention, message.from_user.mention)
|
269 |
-
img = url
|
270 |
-
else:
|
271 |
-
return await mystic.edit_text(_["play_3"])
|
272 |
-
elif await Resso.valid(url):
|
273 |
-
try:
|
274 |
-
details, track_id = await Resso.track(url)
|
275 |
-
except:
|
276 |
-
return await mystic.edit_text(_["play_3"])
|
277 |
-
streamtype = "youtube"
|
278 |
-
img = details["thumb"]
|
279 |
-
cap = _["play_10"].format(details["title"], details["duration_min"])
|
280 |
-
elif await SoundCloud.valid(url):
|
281 |
-
try:
|
282 |
-
details, track_path = await SoundCloud.download(url)
|
283 |
-
except:
|
284 |
-
return await mystic.edit_text(_["play_3"])
|
285 |
-
duration_sec = details["duration_sec"]
|
286 |
-
if duration_sec > config.DURATION_LIMIT:
|
287 |
-
return await mystic.edit_text(
|
288 |
-
_["play_6"].format(
|
289 |
-
config.DURATION_LIMIT_MIN,
|
290 |
-
app.mention,
|
291 |
-
)
|
292 |
-
)
|
293 |
-
try:
|
294 |
-
await stream(
|
295 |
-
_,
|
296 |
-
mystic,
|
297 |
-
user_id,
|
298 |
-
details,
|
299 |
-
chat_id,
|
300 |
-
user_name,
|
301 |
-
message.chat.id,
|
302 |
-
streamtype="soundcloud",
|
303 |
-
forceplay=fplay,
|
304 |
-
)
|
305 |
-
except Exception as e:
|
306 |
-
print(f"Error: {e}")
|
307 |
-
ex_type = type(e).__name__
|
308 |
-
err = e if ex_type == "AssistantErr" else _["general_2"].format(ex_type)
|
309 |
-
return await mystic.edit_text(err)
|
310 |
-
return await mystic.delete()
|
311 |
-
else:
|
312 |
-
try:
|
313 |
-
await Aviax.stream_call(url)
|
314 |
-
except NoActiveGroupCall:
|
315 |
-
await mystic.edit_text(_["black_9"])
|
316 |
-
return await app.send_message(
|
317 |
-
chat_id=config.LOG_GROUP_ID,
|
318 |
-
text=_["play_17"],
|
319 |
-
)
|
320 |
-
except Exception as e:
|
321 |
-
print(f"Error: {e}")
|
322 |
-
return await mystic.edit_text(_["general_2"].format(type(e).__name__))
|
323 |
-
await mystic.edit_text(_["str_2"])
|
324 |
-
try:
|
325 |
-
await stream(
|
326 |
-
_,
|
327 |
-
mystic,
|
328 |
-
message.from_user.id,
|
329 |
-
url,
|
330 |
-
chat_id,
|
331 |
-
message.from_user.first_name,
|
332 |
-
message.chat.id,
|
333 |
-
video=video,
|
334 |
-
streamtype="index",
|
335 |
-
forceplay=fplay,
|
336 |
-
)
|
337 |
-
except Exception as e:
|
338 |
-
print(f"Error: {e}")
|
339 |
-
ex_type = type(e).__name__
|
340 |
-
err = e if ex_type == "AssistantErr" else _["general_2"].format(ex_type)
|
341 |
-
return await mystic.edit_text(err)
|
342 |
-
return await play_logs(message, streamtype="M3u8 or Index Link")
|
343 |
-
else:
|
344 |
-
if len(message.command) < 2:
|
345 |
-
buttons = botplaylist_markup(_)
|
346 |
-
return await mystic.edit_text(
|
347 |
-
_["play_18"],
|
348 |
-
reply_markup=InlineKeyboardMarkup(buttons),
|
349 |
-
)
|
350 |
-
slider = True
|
351 |
-
query = message.text.split(None, 1)[1]
|
352 |
-
if "-v" in query:
|
353 |
-
query = query.replace("-v", "")
|
354 |
-
try:
|
355 |
-
bitflow_result = await YouTube.bitflow_video(query, api_key=BITFLOW_API_KEY)
|
356 |
-
if bitflow_result and bitflow_result.get("status") == "success":
|
357 |
-
details = {
|
358 |
-
"title": bitflow_result.get("title"),
|
359 |
-
"duration_min": bitflow_result.get("duration"),
|
360 |
-
"thumb": bitflow_result.get("thumbnail"),
|
361 |
-
"link": bitflow_result.get("url"),
|
362 |
-
}
|
363 |
-
track_id = bitflow_result.get("id")
|
364 |
-
else:
|
365 |
-
details, track_id = await YouTube.track(query)
|
366 |
-
except Exception as e:
|
367 |
-
print(f"Bitflow API error: {e}")
|
368 |
-
try:
|
369 |
-
details, track_id = await YouTube.track(query)
|
370 |
-
except:
|
371 |
-
return await mystic.edit_text(_["play_3"])
|
372 |
-
streamtype = "youtube"
|
373 |
-
if str(playmode) == "Direct":
|
374 |
-
if not plist_type:
|
375 |
-
if details["duration_min"]:
|
376 |
-
duration_sec = time_to_seconds(details["duration_min"])
|
377 |
-
if duration_sec > config.DURATION_LIMIT:
|
378 |
-
return await mystic.edit_text(
|
379 |
-
_["play_6"].format(config.DURATION_LIMIT_MIN, app.mention)
|
380 |
-
)
|
381 |
-
else:
|
382 |
-
buttons = livestream_markup(
|
383 |
-
_,
|
384 |
-
track_id,
|
385 |
-
user_id,
|
386 |
-
"v" if video else "a",
|
387 |
-
"c" if channel else "g",
|
388 |
-
"f" if fplay else "d",
|
389 |
-
)
|
390 |
-
return await mystic.edit_text(
|
391 |
-
_["play_13"],
|
392 |
-
reply_markup=InlineKeyboardMarkup(buttons),
|
393 |
-
)
|
394 |
-
try:
|
395 |
-
await stream(
|
396 |
-
_,
|
397 |
-
mystic,
|
398 |
-
user_id,
|
399 |
-
details,
|
400 |
-
chat_id,
|
401 |
-
user_name,
|
402 |
-
message.chat.id,
|
403 |
-
video=video,
|
404 |
-
streamtype=streamtype,
|
405 |
-
spotify=spotify,
|
406 |
-
forceplay=fplay,
|
407 |
-
)
|
408 |
-
except Exception as e:
|
409 |
-
print(f"Error: {e}")
|
410 |
-
ex_type = type(e).__name__
|
411 |
-
err = e if ex_type == "AssistantErr" else _["general_2"].format(ex_type)
|
412 |
-
return await mystic.edit_text(err)
|
413 |
-
await mystic.delete()
|
414 |
-
return await play_logs(message, streamtype=streamtype)
|
415 |
-
else:
|
416 |
-
if plist_type:
|
417 |
-
ran_hash = "".join(
|
418 |
-
random.choices(string.ascii_uppercase + string.digits, k=10)
|
419 |
-
)
|
420 |
-
lyrical[ran_hash] = plist_id
|
421 |
-
buttons = playlist_markup(
|
422 |
-
_,
|
423 |
-
ran_hash,
|
424 |
-
message.from_user.id,
|
425 |
-
plist_type,
|
426 |
-
"c" if channel else "g",
|
427 |
-
"f" if fplay else "d",
|
428 |
-
)
|
429 |
-
await mystic.delete()
|
430 |
-
await message.reply_photo(
|
431 |
-
photo=img,
|
432 |
-
caption=cap,
|
433 |
-
reply_markup=InlineKeyboardMarkup(buttons),
|
434 |
-
)
|
435 |
-
return await play_logs(message, streamtype=f"Playlist : {plist_type}")
|
436 |
-
else:
|
437 |
-
if slider:
|
438 |
-
buttons = slider_markup(
|
439 |
-
_,
|
440 |
-
track_id,
|
441 |
-
message.from_user.id,
|
442 |
-
query,
|
443 |
-
0,
|
444 |
-
"c" if channel else "g",
|
445 |
-
"f" if fplay else "d",
|
446 |
-
)
|
447 |
-
await mystic.delete()
|
448 |
-
await message.reply_photo(
|
449 |
-
photo=details["thumb"],
|
450 |
-
caption=_["play_10"].format(
|
451 |
-
details["title"].title(),
|
452 |
-
details["duration_min"],
|
453 |
-
),
|
454 |
-
reply_markup=InlineKeyboardMarkup(buttons),
|
455 |
-
)
|
456 |
-
return await play_logs(message, streamtype=f"Searched on Youtube")
|
457 |
-
else:
|
458 |
-
buttons = track_markup(
|
459 |
-
_,
|
460 |
-
track_id,
|
461 |
-
message.from_user.id,
|
462 |
-
"c" if channel else "g",
|
463 |
-
"f" if fplay else "d",
|
464 |
-
)
|
465 |
-
await mystic.delete()
|
466 |
-
await message.reply_photo(
|
467 |
-
photo=img,
|
468 |
-
caption=cap,
|
469 |
-
reply_markup=InlineKeyboardMarkup(buttons),
|
470 |
-
)
|
471 |
-
return await play_logs(message, streamtype=f"URL Searched Inline")
|
472 |
-
|
473 |
-
|
474 |
-
@app.on_callback_query(filters.regex("MusicStream") & ~BANNED_USERS)
|
475 |
-
@languageCB
|
476 |
-
async def play_music(client, CallbackQuery, _):
|
477 |
-
callback_data = CallbackQuery.data.strip()
|
478 |
-
callback_request = callback_data.split(None, 1)[1]
|
479 |
-
vidid, user_id, mode, cplay, fplay = callback_request.split("|")
|
480 |
-
if CallbackQuery.from_user.id != int(user_id):
|
481 |
-
try:
|
482 |
-
return await CallbackQuery.answer(_["playcb_1"], show_alert=True)
|
483 |
-
except:
|
484 |
-
return
|
485 |
-
try:
|
486 |
-
chat_id, channel = await get_channeplayCB(_, cplay, CallbackQuery)
|
487 |
-
except:
|
488 |
-
return
|
489 |
-
user_name = CallbackQuery.from_user.first_name
|
490 |
-
try:
|
491 |
-
await CallbackQuery.message.delete()
|
492 |
-
await CallbackQuery.answer()
|
493 |
-
except:
|
494 |
-
pass
|
495 |
-
mystic = await CallbackQuery.message.reply_text(
|
496 |
-
_["play_2"].format(channel) if channel else _["play_1"]
|
497 |
-
)
|
498 |
-
try:
|
499 |
-
details, track_id = await YouTube.track(vidid, True)
|
500 |
-
except:
|
501 |
-
return await mystic.edit_text(_["play_3"])
|
502 |
-
if details["duration_min"]:
|
503 |
-
duration_sec = time_to_seconds(details["duration_min"])
|
504 |
-
if duration_sec > config.DURATION_LIMIT:
|
505 |
-
return await mystic.edit_text(
|
506 |
-
_["play_6"].format(config.DURATION_LIMIT_MIN, app.mention)
|
507 |
-
)
|
508 |
-
else:
|
509 |
-
buttons = livestream_markup(
|
510 |
-
_,
|
511 |
-
track_id,
|
512 |
-
CallbackQuery.from_user.id,
|
513 |
-
mode,
|
514 |
-
"c" if cplay == "c" else "g",
|
515 |
-
"f" if fplay else "d",
|
516 |
-
)
|
517 |
-
return await mystic.edit_text(
|
518 |
-
_["play_13"],
|
519 |
-
reply_markup=InlineKeyboardMarkup(buttons),
|
520 |
-
)
|
521 |
-
video = True if mode == "v" else None
|
522 |
-
ffplay = True if fplay == "f" else None
|
523 |
-
try:
|
524 |
-
await stream(
|
525 |
-
_,
|
526 |
-
mystic,
|
527 |
-
CallbackQuery.from_user.id,
|
528 |
-
details,
|
529 |
-
chat_id,
|
530 |
-
user_name,
|
531 |
-
CallbackQuery.message.chat.id,
|
532 |
-
video,
|
533 |
-
streamtype="youtube",
|
534 |
-
forceplay=ffplay,
|
535 |
-
)
|
536 |
-
except Exception as e:
|
537 |
-
print(f"Error: {e}")
|
538 |
-
ex_type = type(e).__name__
|
539 |
-
err = e if ex_type == "AssistantErr" else _["general_2"].format(ex_type)
|
540 |
-
return await mystic.edit_text(err)
|
541 |
-
return await mystic.delete()
|
542 |
-
|
543 |
-
|
544 |
-
@app.on_callback_query(filters.regex("DragmousAdmin") & ~BANNED_USERS)
|
545 |
-
async def Dragmous_check(client, CallbackQuery):
|
546 |
-
try:
|
547 |
-
await CallbackQuery.answer(
|
548 |
-
"» ʀᴇᴠᴇʀᴛ ʙᴀᴄᴋ ᴛᴏ ᴜsᴇʀ ᴀᴄᴄᴏᴜɴᴛ :\n\nᴏᴘᴇɴ ʏᴏᴜʀ ɢʀᴏᴜᴘ sᴇᴛᴛɪɴɢs.\n-> ᴀᴅᴍɪɴɪsᴛʀᴀᴛᴏʀs\n-> ᴄʟɪᴄᴋ ᴏɴ ʏᴏᴜʀ ɴᴀᴍᴇ\n-> ᴜɴᴄʜᴇᴄᴋ ᴀɴᴏɴʏᴍᴏᴜs ᴀᴅᴍɪɴ ᴘᴇʀᴍɪssɪᴏɴs.",
|
549 |
-
show_alert=True,
|
550 |
-
)
|
551 |
-
except:
|
552 |
-
pass
|
553 |
-
|
554 |
-
|
555 |
-
@app.on_callback_query(filters.regex("AviaxPlaylists") & ~BANNED_USERS)
|
556 |
-
@languageCB
|
557 |
-
async def play_playlists_command(client, CallbackQuery, _):
|
558 |
-
callback_data = CallbackQuery.data.strip()
|
559 |
-
callback_request = callback_data.split(None, 1)[1]
|
560 |
-
(
|
561 |
-
videoid,
|
562 |
-
user_id,
|
563 |
-
ptype,
|
564 |
-
mode,
|
565 |
-
cplay,
|
566 |
-
fplay,
|
567 |
-
) = callback_request.split("|")
|
568 |
-
if CallbackQuery.from_user.id != int(user_id):
|
569 |
-
try:
|
570 |
-
return await CallbackQuery.answer(_["playcb_1"], show_alert=True)
|
571 |
-
except:
|
572 |
-
return
|
573 |
-
try:
|
574 |
-
chat_id, channel = await get_channeplayCB(_, cplay, CallbackQuery)
|
575 |
-
except:
|
576 |
-
return
|
577 |
-
user_name = CallbackQuery.from_user.first_name
|
578 |
-
await CallbackQuery.message.delete()
|
579 |
-
try:
|
580 |
-
await CallbackQuery.answer()
|
581 |
-
except:
|
582 |
-
pass
|
583 |
-
mystic = await CallbackQuery.message.reply_text(
|
584 |
-
_["play_2"].format(channel) if channel else _["play_1"]
|
585 |
-
)
|
586 |
-
videoid = lyrical.get(videoid)
|
587 |
-
video = True if mode == "v" else None
|
588 |
-
ffplay = True if fplay == "f" else None
|
589 |
-
try:
|
590 |
-
await stream(
|
591 |
-
_,
|
592 |
-
mystic,
|
593 |
-
CallbackQuery.from_user.id,
|
594 |
-
details,
|
595 |
-
chat_id,
|
596 |
-
user_name,
|
597 |
-
CallbackQuery.message.chat.id,
|
598 |
-
video,
|
599 |
-
streamtype="youtube",
|
600 |
-
forceplay=ffplay,
|
601 |
-
)
|
602 |
-
except Exception as e:
|
603 |
-
print(f"Error: {e}")
|
604 |
-
ex_type = type(e).__name__
|
605 |
-
err = e if ex_type == "AssistantErr" else _["general_2"].format(ex_type)
|
606 |
-
return await mystic.edit_text(err)
|
607 |
-
return await mystic.delete()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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