forked from yashoswalyo/MERGE-BOT
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbot.py
605 lines (564 loc) Β· 20.3 KB
/
bot.py
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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
import asyncio
import os
import shutil
import string
import time
import shutil, psutil
import pyrogram
from hachoir import metadata
from hachoir.metadata import extractMetadata
from hachoir.parser import createParser
from PIL import Image
from pyrogram import Client, filters
from pyrogram.errors import MessageNotModified
from pyrogram.errors.exceptions.flood_420 import FloodWait
from pyrogram.types import (CallbackQuery, InlineKeyboardButton,InlineKeyboardMarkup, Message)
from pyromod import listen
from config import Config
from helpers import database
from helpers.display_progress import progress_for_pyrogram
from helpers.ffmpeg import MergeVideo
from helpers.uploader import uploadVideo
from helpers.utils import get_readable_time, get_readable_file_size
from helpers.rclone_upload import rclone_driver, rclone_upload
botStartTime = time.time()
mergeApp = Client(
session_name="merge-bot",
api_hash=Config.API_HASH,
api_id=Config.API_ID,
bot_token=Config.BOT_TOKEN,
workers=300
)
if os.path.exists('./downloads') == False:
os.makedirs('./downloads')
queueDB={}
formatDB={}
replyDB={}
@mergeApp.on_message( filters.command(['login']) & filters.private & ~filters.edited )
async def allowUser(c:Client, m: Message):
passwd = m.text.split()[-1]
if passwd == Config.PASSWORD:
await database.allowUser(uid=m.from_user.id)
await m.reply_text(
text=f"**Login passed β
,**\n β‘ Now you can you me!!",
quote=True
)
else:
await m.reply_text(
text=f"**Login failed β,**\n π‘οΈ Unfortunately you can't use me\n\nContact: π² @{Config.OWNER_USERNAME}",
quote=True
)
return
@mergeApp.on_message(filters.command(['stats']) & filters.private & filters.user(Config.OWNER))
async def stats_handler(c:Client, m:Message):
currentTime = get_readable_time(time.time() - botStartTime)
total, used, free = shutil.disk_usage('.')
total = get_readable_file_size(total)
used = get_readable_file_size(used)
free = get_readable_file_size(free)
sent = get_readable_file_size(psutil.net_io_counters().bytes_sent)
recv = get_readable_file_size(psutil.net_io_counters().bytes_recv)
cpuUsage = psutil.cpu_percent(interval=0.5)
memory = psutil.virtual_memory().percent
disk = psutil.disk_usage('/').percent
stats = f'<b>γ π BOT STATISTICS γ</b>\n' \
f'<b></b>\n' \
f'<b>β³ Bot Uptime : {currentTime}</b>\n' \
f'<b>πΎ Total Disk Space : {total}</b>\n' \
f'<b>π Total Used Space : {used}</b>\n' \
f'<b>πΏ Total Free Space : {free}</b>\n' \
f'<b>πΊ Total Upload : {sent}</b>\n' \
f'<b>π» Total Download : {recv}</b>\n' \
f'<b>π₯ CPU : {cpuUsage}%</b>\n' \
f'<b>βοΈ RAM : {memory}%</b>\n' \
f'<b>πΏ DISK : {disk}%</b>'
await m.reply_text(stats,quote=True)
@mergeApp.on_message(filters.command(['broadcast']) & filters.private & filters.user(Config.OWNER))
async def broadcast_handler(c:Client, m:Message):
msg = m.reply_to_message
userList = await database.broadcast()
len = userList.collection.count_documents({})
for i in range(len):
try:
await msg.copy(chat_id=userList[i]['_id'])
except FloodWait as e:
await asyncio.sleep(e.x)
await msg.copy(chat_id=userList[i]['_id'])
except Exception:
await database.deleteUser(userList[i]['_id'])
pass
print(f"Message sent to {userList[i]['name']} ")
await asyncio.sleep(2)
await m.reply_text(
text="π€ __Broadcast completed sucessfully__",
quote=True
)
@mergeApp.on_message(filters.command(['start']) & filters.private & ~filters.edited)
async def start_handler(c: Client, m: Message):
await database.addUser(uid=m.from_user.id,fname=m.from_user.first_name, lname=m.from_user.last_name)
if await database.allowedUser(uid=m.from_user.id) is False:
res = await m.reply_text(
text=f"Hi **{m.from_user.first_name}**\n\n π‘οΈ Unfortunately you can't use me\n\n**Contact: π² @{Config.OWNER_USERNAME}** ",
quote=True
)
return
res = await m.reply_text(
text=f"Hi **{m.from_user.first_name}**\n\n β‘ I am a file/video merger bot\n\nπ I can merge Telegram files!, And upload it to telegram\n\n**Owner: π² @{Config.OWNER_USERNAME}** ",
quote=True
)
@mergeApp.on_message((filters.document | filters.video) & filters.private & ~filters.edited)
async def video_handler(c: Client, m: Message):
if await database.allowedUser(uid=m.from_user.id) is False:
res = await m.reply_text(
text=f"Hi **{m.from_user.first_name}**\n\n π‘οΈ Unfortunately you can't use me\n\n**Contact: π² @{Config.OWNER_USERNAME}** ",
quote=True
)
return
media = m.video or m.document
if media.file_name is None:
await m.reply_text('File Not Found')
return
if media.file_name.rsplit(sep='.')[-1].lower() in 'conf':
await m.reply_text(
text="**Config file found, Do you want to save it?**",
reply_markup = InlineKeyboardMarkup(
[
[
InlineKeyboardButton("β
Yes", callback_data=f"rclone_save"),
InlineKeyboardButton("β No", callback_data='rclone_discard')
]
]
),
quote=True
)
return
if media.file_name.split(sep='.')[-1].lower() not in ['mkv','mp4','webm']:
await m.reply_text("This Video Format not Allowed!\nOnly send MP4 or MKV or WEBM.", quote=True)
return
if queueDB.get(m.from_user.id, None) is None:
formatDB.update({m.from_user.id: media.file_name.rsplit(".", 1)[-1].lower()})
editable = await m.reply_text("Please Wait ...", quote=True)
MessageText = "Okay,\nNow Send Me Next Video or Press **Merge Now** Button!"
if queueDB.get(m.from_user.id, None) is None:
queueDB.update({m.from_user.id: []})
if (len(queueDB.get(m.from_user.id)) >= 0) and (len(queueDB.get(m.from_user.id))<10 ):
queueDB.get(m.from_user.id).append(m.message_id)
if len(queueDB.get(m.from_user.id)) == 1:
await editable.edit(
'**Send me some more videos to merge them into single file**',parse_mode='markdown'
)
return
if queueDB.get(m.from_user.id, None) is None:
formatDB.update({m.from_user.id: media.file_name.split(sep='.')[-1].lower()})
if replyDB.get(m.from_user.id, None) is not None:
await c.delete_messages(chat_id=m.chat.id, message_ids=replyDB.get(m.from_user.id))
if len(queueDB.get(m.from_user.id)) == 10:
MessageText = "Okay Unkil, Now Just Press **Merge Now** Button Plox!"
markup = await MakeButtons(c, m, queueDB)
reply_ = await m.reply_text(
text=MessageText,
reply_markup=InlineKeyboardMarkup(markup),
quote=True
)
replyDB.update({m.from_user.id: reply_.message_id})
elif len(queueDB.get(m.from_user.id)) > 10:
markup = await MakeButtons(c,m,queueDB)
await editable.text(
"Max 10 videos allowed",
reply_markup=InlineKeyboardMarkup(markup)
)
@mergeApp.on_message(filters.photo & filters.private & ~filters.edited)
async def photo_handler(c: Client,m: Message):
if await database.allowedUser(uid=m.from_user.id) is False:
res = await m.reply_text(
text=f"Hi **{m.from_user.first_name}**\n\n π‘οΈ Unfortunately you can't use me\n\n**Contact: π² @{Config.OWNER_USERNAME}** ",
quote=True
)
return
thumbnail = m.photo.file_id
msg = await m.reply_text('Saving Thumbnail. . . .',quote=True)
await database.saveThumb(m.from_user.id,thumbnail)
LOCATION = f'./downloads/{m.from_user.id}_thumb.jpg'
await c.download_media(
message=m,
file_name=LOCATION
)
await msg.edit_text(
text="β
Custom Thumbnail Saved!"
)
@mergeApp.on_message(filters.command(['help']) & filters.private & ~filters.edited)
async def help_msg(c: Client, m: Message):
await m.reply_text(
text='''**Follow These Steps:
1) Send me the custom thumbnail (optional).
2) Send two or more Your Videos Which you want to merge
3) After sending all files select merge options
4) Select the upload mode.
5) Select rename if you want to give custom file name else press default**''',
quote=True,
reply_markup=InlineKeyboardMarkup(
[
[
InlineKeyboardButton("Close π", callback_data="close")
]
]
)
)
@mergeApp.on_message( filters.command(['about']) & filters.private & ~filters.edited )
async def about_handler(c:Client,m:Message):
await m.reply_text(
text='''
- **WHAT'S NEW:**
+ Upload to drive using your own rclone config
+ Merged video preserves all streams of the first video you send (i.e. all audiotracks/subtitles)
- **FEATURES:**
+ Merge Upto 10 videos in one
+ Upload as document/video
+ Custom thumbnail support
+ Users can login to bot using password
+ Owner can broadcast message to all users
''',
quote=True,
reply_markup=InlineKeyboardMarkup(
[
[
InlineKeyboardButton("Developer", url="https://t.me/yashoswalyo")
],
[
InlineKeyboardButton("Source Code", url="https://github.com/yashoswalyo/MERGE-BOT"),
InlineKeyboardButton("Deployed By", url=f"https://t.me/{Config.OWNER_USERNAME}")
]
]
)
)
@mergeApp.on_message(filters.command(['showthumbnail']) & filters.private & ~filters.edited)
async def show_thumbnail(c:Client ,m: Message):
try:
thumb_id = await database.getThumb(m.from_user.id)
LOCATION = f'./downloads/{m.from_user.id}_thumb.jpg'
await c.download_media(message=str(thumb_id),file_name=LOCATION)
if os.path.exists(LOCATION) is False:
await m.reply_text(text='β Custom thumbnail not found',quote=True)
else:
await m.reply_photo(photo=LOCATION, caption='πΌοΈ Your custom thumbnail', quote=True)
except Exception as err:
await m.reply_text(text='β Custom thumbnail not found',quote=True)
@mergeApp.on_message(filters.command(['deletethumbnail']) & filters.private & ~filters.edited)
async def delete_thumbnail(c: Client,m: Message):
try:
thumb_id = await database.getThumb(m.from_user.id)
LOCATION = f'./downloads/{m.from_user.id}_thumb.jpg'
await c.download_media(message=str(thumb_id),file_name=LOCATION)
if os.path.exists(LOCATION) is False:
await m.reply_text(text='β Custom thumbnail not found',quote=True)
else:
await database.delThumb(m.from_user.id)
os.remove(LOCATION)
await m.reply_text('β
Deleted Sucessfully',quote=True)
except Exception as err:
await m.reply_text(text='β Custom thumbnail not found',quote=True)
@mergeApp.on_callback_query()
async def callback(c: Client, cb: CallbackQuery):
if cb.data == 'merge':
await cb.message.edit(
text='Where do you want to upload?',
reply_markup=InlineKeyboardMarkup(
[
[
InlineKeyboardButton('π€ To Telegram', callback_data = 'to_telegram'),
InlineKeyboardButton('π«οΈ To Drive', callback_data = 'to_drive')
]
]
)
)
elif cb.data == 'to_drive':
try:
urc = await database.getUserRcloneConfig(cb.from_user.id)
await c.download_media(message=urc,file_name=f"userdata/{cb.from_user.id}/rclone.conf")
except Exception as err:
await cb.message.reply_text("Rclone not Found, Unable to upload to drive")
if os.path.exists(f"userdata/{cb.from_user.id}/rclone.conf") is False:
await cb.message.delete()
await delete_all(root=f"downloads/{cb.from_user.id}/")
queueDB.update({cb.from_user.id: []})
formatDB.update({cb.from_user.id: None})
return
Config.upload_to_drive.update({f'{cb.from_user.id}':True})
await cb.message.edit(
text="Okay I'll upload to drive\nDo you want to rename? Default file name is **[@yashoswalyo]_merged.mkv**",
reply_markup=InlineKeyboardMarkup(
[
[
InlineKeyboardButton('π Default', callback_data='rename_NO'),
InlineKeyboardButton('βοΈ Rename', callback_data='rename_YES')
]
]
)
)
elif cb.data == 'to_telegram':
Config.upload_to_drive.update({f'{cb.from_user.id}':False})
await cb.message.edit(
text='How do yo want to upload file',
reply_markup=InlineKeyboardMarkup(
[
[
InlineKeyboardButton('ποΈ Video', callback_data='video'),
InlineKeyboardButton('π File', callback_data='document')
]
]
)
)
elif cb.data == 'document':
Config.upload_as_doc.update({f'{cb.from_user.id}':True})
await cb.message.edit(
text='Do you want to rename? Default file name is **[@yashoswalyo]_merged.mkv**',
reply_markup=InlineKeyboardMarkup(
[
[
InlineKeyboardButton('π Default', callback_data='rename_NO'),
InlineKeyboardButton('βοΈ Rename', callback_data='rename_YES')
]
]
)
)
elif cb.data == 'video':
Config.upload_as_doc.update({f'{cb.from_user.id}':False})
await cb.message.edit(
text='Do you want to rename? Default file name is **[@yashoswalyo]_merged.mkv**',
reply_markup=InlineKeyboardMarkup(
[
[
InlineKeyboardButton('π Default', callback_data='rename_NO'),
InlineKeyboardButton('βοΈ Rename', callback_data='rename_YES')
]
]
)
)
elif cb.data.startswith('rclone_'):
if 'save' in cb.data:
fileId = cb.message.reply_to_message.document.file_id
print(fileId)
await c.download_media(
message=cb.message.reply_to_message,
file_name=f"./userdata/{cb.from_user.id}/rclone.conf"
)
await database.addUserRcloneConfig(cb, fileId)
else:
await cb.message.delete()
elif cb.data.startswith('rename_'):
if 'YES' in cb.data:
await cb.message.edit(
'Current filename: **[@yashoswalyo]_merged.mkv**\n\nSend me new file name without extension: ',
parse_mode='markdown'
)
res: Message = await c.listen( cb.message.chat.id, timeout=300 )
if res.text :
ascii_ = e = ''.join([i if (i in string.digits or i in string.ascii_letters or i == " ") else " " for i in res.text])
new_file_name = f"./downloads/{str(cb.from_user.id)}/{ascii_.replace(' ', '_')}.mkv"
await mergeNow(c,cb,new_file_name)
if 'NO' in cb.data:
await mergeNow(c,cb,new_file_name = f"./downloads/{str(cb.from_user.id)}/[@yashoswalyo]_merged.mkv")
elif cb.data == 'cancel':
await delete_all(root=f"downloads/{cb.from_user.id}/")
queueDB.update({cb.from_user.id: []})
formatDB.update({cb.from_user.id: None})
await cb.message.edit("Sucessfully Cancelled")
await asyncio.sleep(5)
await cb.message.delete(True)
return
elif cb.data == 'close':
await cb.message.delete(True)
elif cb.data.startswith('showFileName_'):
m = await c.get_messages(chat_id=cb.message.chat.id,message_ids=int(cb.data.rsplit("_",1)[-1]))
try:
await cb.message.edit(
text=f"File Name: {m.video.file_name}",
reply_markup=InlineKeyboardMarkup(
[
[
InlineKeyboardButton("Remove",callback_data=f"removeFile_{str(m.message_id)}"),
InlineKeyboardButton("Back", callback_data="back")
]
]
)
)
except:
await cb.message.edit(
text=f"File Name: {m.document.file_name}",
reply_markup=InlineKeyboardMarkup(
[
[
InlineKeyboardButton("Remove",callback_data=f"removeFile_{str(m.message_id)}"),
InlineKeyboardButton("Back", callback_data="back")
]
]
)
)
elif cb.data == 'back':
await showQueue(c,cb)
elif cb.data.startswith('removeFile_'):
queueDB.get(cb.from_user.id).remove(int(cb.data.split("_", 1)[-1]))
await showQueue(c,cb)
async def showQueue(c:Client, cb: CallbackQuery):
try:
markup = await MakeButtons(c,cb.message,queueDB)
await cb.message.edit(
text="Okay,\nNow Send Me Next Video or Press **Merge Now** Button!",
reply_markup=InlineKeyboardMarkup(markup)
)
except ValueError:
await cb.message.edit('Send Some more videos')
async def mergeNow(c:Client, cb:CallbackQuery,new_file_name: str):
omess = cb.message.reply_to_message
# print(omess.message_id)
vid_list = list()
await cb.message.edit('β Processing...')
duration = 0
list_message_ids = queueDB.get(cb.from_user.id,None)
list_message_ids.sort()
input_ = f"./downloads/{cb.from_user.id}/input.txt"
if list_message_ids is None:
await cb.answer("Queue Empty",show_alert=True)
await cb.message.delete(True)
return
if not os.path.exists(f'./downloads/{cb.from_user.id}/'):
os.makedirs(f'./downloads/{cb.from_user.id}/')
for i in (await c.get_messages(chat_id=cb.from_user.id,message_ids=list_message_ids)):
media = i.video or i.document
try:
await cb.message.edit(f'π₯ Downloading...{media.file_name}')
await asyncio.sleep(2)
except MessageNotModified :
queueDB.get(cb.from_user.id).remove(i.message_id)
await cb.message.edit("β File Skipped!")
await asyncio.sleep(3)
continue
file_dl_path = None
try:
c_time = time.time()
file_dl_path = await c.download_media(
message=i,
file_name=f"./downloads/{cb.from_user.id}/{i.message_id}/",
progress=progress_for_pyrogram,
progress_args=(
'π Downloading...',
cb.message,
c_time
)
)
except Exception as downloadErr:
print(f"Failed to download Error: {downloadErr}")
queueDB.get(cb.from_user.id).remove(i.message_id)
await cb.message.edit("βFile Skipped!")
await asyncio.sleep(3)
continue
metadata = extractMetadata(createParser(file_dl_path))
try:
if metadata.has("duration"):
duration += metadata.get('duration').seconds
vid_list.append(f"file '{file_dl_path}'")
except:
await delete_all(root=f'./downloads/{cb.from_user.id}')
queueDB.update({cb.from_user.id: []})
formatDB.update({cb.from_user.id: None})
await cb.message.edit('β οΈ Video is corrupted')
return
_cache = list()
for i in range(len(vid_list)):
if vid_list[i] not in _cache:
_cache.append(vid_list[i])
vid_list = _cache
await cb.message.edit(f"π Trying to merge videos ...")
with open(input_,'w') as _list:
_list.write("\n".join(vid_list))
merged_video_path = await MergeVideo(
input_file=input_,
user_id=cb.from_user.id,
message=cb.message,
format_='mkv'
)
if merged_video_path is None:
await cb.message.edit("β Failed to merge video !")
await delete_all(root=f'./downloads/{cb.from_user.id}')
queueDB.update({cb.from_user.id: []})
formatDB.update({cb.from_user.id: None})
return
await cb.message.edit("β
Sucessfully Merged Video !")
print(f"Video merged for: {cb.from_user.first_name} ")
await asyncio.sleep(3)
file_size = os.path.getsize(merged_video_path)
os.rename(merged_video_path,new_file_name)
await cb.message.edit(f"π Renamed Merged Video to\n **{new_file_name.rsplit('/',1)[-1]}**")
await asyncio.sleep(1)
merged_video_path = new_file_name
if Config.upload_to_drive[f'{cb.from_user.id}']:
await rclone_driver(omess,cb,merged_video_path)
await delete_all(root=f'./downloads/{cb.from_user.id}')
queueDB.update({cb.from_user.id: []})
formatDB.update({cb.from_user.id: None})
return
if file_size > 2044723200:
await cb.message.edit("Video is Larger than 2GB Can't Upload")
await delete_all(root=f'./downloads/{cb.from_user.id}')
queueDB.update({cb.from_user.id: []})
formatDB.update({cb.from_user.id: None})
return
await cb.message.edit("π₯ Extracting Video Data ...")
duration = 1
width = 100
height = 100
try:
metadata = extractMetadata(createParser(merged_video_path))
if metadata.has("duration"):
duration = metadata.get("duration").seconds
if metadata.has("width"):
width = metadata.get("width")
if metadata.has("height"):
height = metadata.get("height")
except:
await delete_all(root=f'./downloads/{cb.from_user.id}')
queueDB.update({cb.from_user.id: []})
formatDB.update({cb.from_user.id: None})
await cb.message.edit("β Merged Video is corrupted")
return
video_thumbnail = f'./downloads/{cb.from_user.id}_thumb.jpg'
if os.path.exists(video_thumbnail) is False:
video_thumbnail=f"./assets/default_thumb.jpg"
else:
Image.open(video_thumbnail).convert("RGB").save(video_thumbnail)
img = Image.open(video_thumbnail)
# img.resize(width,height)
img.save(video_thumbnail,"JPEG")
await uploadVideo(
c=c,
cb=cb,
merged_video_path=merged_video_path,
width=width,
height=height,
duration=duration,
video_thumbnail=video_thumbnail,
file_size=os.path.getsize(merged_video_path),
upload_mode=Config.upload_as_doc[f'{cb.from_user.id}']
)
await cb.message.delete(True)
await delete_all(root=f'./downloads/{cb.from_user.id}')
queueDB.update({cb.from_user.id: []})
formatDB.update({cb.from_user.id: None})
return
async def delete_all(root):
try:
shutil.rmtree(root)
except Exception as e:
print(e)
async def MakeButtons(bot: Client, m: Message, db: dict):
markup = []
for i in (await bot.get_messages(chat_id=m.chat.id, message_ids=db.get(m.chat.id))):
media = i.video or i.document or None
if media is None:
continue
else:
markup.append([InlineKeyboardButton(f"{media.file_name}", callback_data=f"showFileName_{str(i.message_id)}")])
markup.append([InlineKeyboardButton("π Merge Now", callback_data="merge")])
markup.append([InlineKeyboardButton("π₯ Clear Files", callback_data="cancel")])
return markup
mergeApp.run()