ruhscps commited on
Commit
a0deffb
·
verified ·
1 Parent(s): 19ebdb5

Upload 3 files

Browse files
Systumm/bot/plugins/admin.py ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import time
3
+ import string
4
+ import random
5
+ import asyncio
6
+ import aiofiles
7
+ import datetime
8
+ from pyrogram import filters, Client
9
+ from pyrogram.types import Message
10
+ from pyrogram.enums.parse_mode import ParseMode
11
+
12
+ # --- SYSTUMM IMPORTS ---
13
+ from Systumm.utils.broadcast_helper import send_msg
14
+ from Systumm.utils.database import Database
15
+ from Systumm.bot import SystummBot
16
+ from Systumm.server.exceptions import FIleNotFound
17
+ from Systumm.config import Telegram, Server
18
+
19
+ db = Database(Telegram.DATABASE_URL, Telegram.SESSION_NAME)
20
+ broadcast_ids = {}
21
+
22
+
23
+ @SystummBot.on_message(filters.command("status") & filters.private & filters.user(Telegram.OWNER_ID))
24
+ async def sts(c: Client, m: Message):
25
+ await m.reply_text(text=f"""**Systumm Bot Status:**
26
+ **Total Users in DB:** `{await db.total_users_count()}`
27
+ **Banned Users in DB:** `{await db.total_banned_users_count()}`
28
+ **Total Links Generated: ** `{await db.total_files()}`"""
29
+ , parse_mode=ParseMode.MARKDOWN, quote=True)
30
+
31
+
32
+ @SystummBot.on_message(filters.command("ban") & filters.private & filters.user(Telegram.OWNER_ID))
33
+ async def sts_ban(b: Client, m: Message):
34
+ id = m.text.split("/ban ")[-1]
35
+ if not await db.is_user_banned(int(id)):
36
+ try:
37
+ await db.ban_user(int(id))
38
+ await db.delete_user(int(id))
39
+ await m.reply_text(text=f"`{id}`** is Banned** ", parse_mode=ParseMode.MARKDOWN, quote=True)
40
+ if not str(id).startswith('-100'):
41
+ await b.send_message(
42
+ chat_id=id,
43
+ text="**You are Banned from using Systumm Bot**",
44
+ parse_mode=ParseMode.MARKDOWN,
45
+ disable_web_page_preview=True
46
+ )
47
+ except Exception as e:
48
+ await m.reply_text(text=f"**something went wrong: {e}** ", parse_mode=ParseMode.MARKDOWN, quote=True)
49
+ else:
50
+ await m.reply_text(text=f"`{id}`** is Already Banned** ", parse_mode=ParseMode.MARKDOWN, quote=True)
51
+
52
+
53
+ @SystummBot.on_message(filters.command("unban") & filters.private & filters.user(Telegram.OWNER_ID))
54
+ async def sts_unban(b: Client, m: Message):
55
+ id = m.text.split("/unban ")[-1]
56
+ if await db.is_user_banned(int(id)):
57
+ try:
58
+ await db.unban_user(int(id))
59
+ await m.reply_text(text=f"`{id}`** is Unbanned** ", parse_mode=ParseMode.MARKDOWN, quote=True)
60
+ if not str(id).startswith('-100'):
61
+ await b.send_message(
62
+ chat_id=id,
63
+ text="**You are Unbanned. You can now use Systumm Bot.**",
64
+ parse_mode=ParseMode.MARKDOWN,
65
+ disable_web_page_preview=True
66
+ )
67
+ except Exception as e:
68
+ await m.reply_text(text=f"** something went wrong: {e}**", parse_mode=ParseMode.MARKDOWN, quote=True)
69
+ else:
70
+ await m.reply_text(text=f"`{id}`** is not Banned** ", parse_mode=ParseMode.MARKDOWN, quote=True)
71
+
72
+
73
+ @SystummBot.on_message(filters.command("broadcast") & filters.private & filters.user(Telegram.OWNER_ID) & filters.reply)
74
+ async def broadcast_(c: Client, m: Message):
75
+ all_users = await db.get_all_users()
76
+ broadcast_msg = m.reply_to_message
77
+ while True:
78
+ broadcast_id = ''.join([random.choice(string.ascii_letters) for i in range(3)])
79
+ if not broadcast_ids.get(broadcast_id):
80
+ break
81
+ out = await m.reply_text(
82
+ text=f"Broadcast initiated! You will be notified with a log file when all the users are notified."
83
+ )
84
+ start_time = time.time()
85
+ total_users = await db.total_users_count()
86
+ done = 0
87
+ failed = 0
88
+ success = 0
89
+ broadcast_ids[broadcast_id] = dict(
90
+ total=total_users,
91
+ current=done,
92
+ failed=failed,
93
+ success=success
94
+ )
95
+ async with aiofiles.open('broadcast.txt', 'w') as broadcast_log_file:
96
+ async for user in all_users:
97
+ sts, msg = await send_msg(
98
+ user_id=int(user['id']),
99
+ message=broadcast_msg
100
+ )
101
+ if msg is not None:
102
+ await broadcast_log_file.write(msg)
103
+ if sts == 200:
104
+ success += 1
105
+ else:
106
+ failed += 1
107
+ if sts == 400:
108
+ await db.delete_user(user['id'])
109
+ done += 1
110
+ if broadcast_ids.get(broadcast_id) is None:
111
+ break
112
+ else:
113
+ broadcast_ids[broadcast_id].update(
114
+ dict(
115
+ current=done,
116
+ failed=failed,
117
+ success=success
118
+ )
119
+ )
120
+ try:
121
+ await out.edit_text(f"Broadcast Status\n\ncurrent: {done}\nfailed:{failed}\nsuccess: {success}")
122
+ except:
123
+ pass
124
+ if broadcast_ids.get(broadcast_id):
125
+ broadcast_ids.pop(broadcast_id)
126
+ completed_in = datetime.timedelta(seconds=int(time.time() - start_time))
127
+ await asyncio.sleep(3)
128
+ await out.delete()
129
+ if failed == 0:
130
+ await m.reply_text(
131
+ text=f"Broadcast completed in `{completed_in}`\n\nTotal users: {total_users}.\nTotal done: {done}, {success} success and {failed} failed.",
132
+ quote=True
133
+ )
134
+ else:
135
+ await m.reply_document(
136
+ document='broadcast.txt',
137
+ caption=f"Broadcast completed in `{completed_in}`\n\nTotal users: {total_users}.\nTotal done: {done}, {success} success and {failed} failed.",
138
+ quote=True
139
+ )
140
+ os.remove('broadcast.txt')
141
+
142
+
143
+ @SystummBot.on_message(filters.command("del") & filters.private & filters.user(Telegram.OWNER_ID))
144
+ async def sts_del(c: Client, m: Message):
145
+ file_id = m.text.split(" ")[-1]
146
+ try:
147
+ file_info = await db.get_file(file_id)
148
+ except FIleNotFound:
149
+ await m.reply_text(
150
+ text=f"**ꜰɪʟᴇ ᴀʟʀᴇᴀᴅʏ ᴅᴇʟᴇᴛᴇᴅ**",
151
+ quote=True
152
+ )
153
+ return
154
+ await db.delete_one_file(file_info['_id'])
155
+ await db.count_links(file_info['user_id'], "-")
156
+ await m.reply_text(
157
+ text=f"**Fɪʟᴇ Dᴇʟᴇᴛᴇᴅ Sᴜᴄᴄᴇssғᴜʟʟʏ !** ",
158
+ quote=True
159
+ )
Systumm/bot/plugins/callback.py ADDED
@@ -0,0 +1,199 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import datetime
2
+ import math
3
+ from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, CallbackQuery
4
+ from pyrogram.file_id import FileId, FileType, PHOTO_TYPES
5
+ from pyrogram.enums.parse_mode import ParseMode
6
+
7
+ # --- SYSTUMM IMPORTS ---
8
+ from Systumm import __version__
9
+ from Systumm.bot import SystummBot
10
+ from Systumm.config import Telegram, Server
11
+ from Systumm.utils.translation import LANG, BUTTON
12
+ from Systumm.utils.bot_utils import gen_link
13
+ from Systumm.utils.database import Database
14
+ from Systumm.utils.human_readable import humanbytes
15
+ from Systumm.server.exceptions import FIleNotFound
16
+
17
+ db = Database(Telegram.DATABASE_URL, Telegram.SESSION_NAME)
18
+
19
+ #---------------------[ START CMD ]---------------------#
20
+ @SystummBot.on_callback_query()
21
+ async def cb_data(bot, update: CallbackQuery):
22
+ usr_cmd = update.data.split("_")
23
+ if usr_cmd[0] == "home":
24
+ await update.message.edit_text(
25
+ text=LANG.START_TEXT.format(update.from_user.mention, SystummBot.username),
26
+ disable_web_page_preview=True,
27
+ reply_markup=BUTTON.START_BUTTONS
28
+ )
29
+ elif usr_cmd[0] == "help":
30
+ await update.message.edit_text(
31
+ text=LANG.HELP_TEXT.format(Telegram.OWNER_ID),
32
+ disable_web_page_preview=True,
33
+ reply_markup=BUTTON.HELP_BUTTONS
34
+ )
35
+ elif usr_cmd[0] == "about":
36
+ await update.message.edit_text(
37
+ text=LANG.ABOUT_TEXT.format(SystummBot.fname, __version__),
38
+ disable_web_page_preview=True,
39
+ reply_markup=BUTTON.ABOUT_BUTTONS
40
+ )
41
+
42
+ #---------------------[ MY FILES CMD ]---------------------#
43
+
44
+ elif usr_cmd[0] == "N/A":
45
+ await update.answer("N/A", True)
46
+ elif usr_cmd[0] == "close":
47
+ await update.message.delete()
48
+ elif usr_cmd[0] == "msgdelete":
49
+ await update.message.edit_caption(
50
+ caption= "**Cᴏɴғɪʀᴍ ʏᴏᴜ ᴡᴀɴᴛ ᴛᴏ ᴅᴇʟᴇᴛᴇ ᴛʜᴇ Fɪʟᴇ**\n\n_Made with ♥️ by Ajay Yadav_",
51
+ reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton("ʏᴇs", callback_data=f"msgdelyes_{usr_cmd[1]}_{usr_cmd[2]}"), InlineKeyboardButton("ɴᴏ", callback_data=f"myfile_{usr_cmd[1]}_{usr_cmd[2]}")]])
52
+ )
53
+ elif usr_cmd[0] == "msgdelyes":
54
+ await delete_user_file(usr_cmd[1], int(usr_cmd[2]), update)
55
+ return
56
+ elif usr_cmd[0] == "msgdelpvt":
57
+ await update.message.edit_caption(
58
+ caption= "**Cᴏɴғɪʀᴍ ʏᴏᴜ ᴡᴀɴᴛ ᴛᴏ ᴅᴇʟᴇᴛᴇ ᴛʜᴇ Fɪʟᴇ**\n\n",
59
+ reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton("ʏᴇs", callback_data=f"msgdelpvtyes_{usr_cmd[1]}"), InlineKeyboardButton("ɴᴏ", callback_data=f"mainstream_{usr_cmd[1]}")]])
60
+ )
61
+ elif usr_cmd[0] == "msgdelpvtyes":
62
+ await delete_user_filex(usr_cmd[1], update)
63
+ return
64
+
65
+ elif usr_cmd[0] == "mainstream":
66
+ _id = usr_cmd[1]
67
+ reply_markup, stream_text = await gen_link(_id=_id)
68
+ await update.message.edit_text(
69
+ text=stream_text,
70
+ parse_mode=ParseMode.HTML,
71
+ disable_web_page_preview=True,
72
+ reply_markup=reply_markup,
73
+ )
74
+
75
+ elif usr_cmd[0] == "userfiles":
76
+ file_list, total_files = await gen_file_list_button(int(usr_cmd[1]), update.from_user.id)
77
+ await update.message.edit_caption(
78
+ caption="Total files: {}\n\n_Made with ♥️ by Ajay Yadav_".format(total_files),
79
+ reply_markup=InlineKeyboardMarkup(file_list)
80
+ )
81
+ elif usr_cmd[0] == "myfile":
82
+ await gen_file_menu(usr_cmd[1], usr_cmd[2], update)
83
+ return
84
+ elif usr_cmd[0] == "sendfile":
85
+ myfile = await db.get_file(usr_cmd[1])
86
+ file_name = myfile['file_name']
87
+ await update.answer(f"Sending File {file_name}")
88
+ await update.message.reply_cached_media(myfile['file_id'], caption=f'**{file_name}**\n\n_Made with ♥️ by Ajay Yadav_')
89
+ else:
90
+ await update.message.delete()
91
+
92
+
93
+ #---------------------[ MY FILES FUNC ]---------------------#
94
+
95
+ async def gen_file_list_button(file_list_no: int, user_id: int):
96
+
97
+ file_range=[file_list_no*10-10+1, file_list_no*10]
98
+ user_files, total_files=await db.find_files(user_id, file_range)
99
+
100
+ file_list=[]
101
+ async for x in user_files:
102
+ file_list.append([InlineKeyboardButton(x["file_name"], callback_data=f"myfile_{x['_id']}_{file_list_no}")])
103
+ if total_files > 10:
104
+ file_list.append(
105
+ [InlineKeyboardButton("◄", callback_data="{}".format("userfiles_"+str(file_list_no-1) if file_list_no > 1 else 'N/A')),
106
+ InlineKeyboardButton(f"{file_list_no}/{math.ceil(total_files/10)}", callback_data="N/A"),
107
+ InlineKeyboardButton("►", callback_data="{}".format("userfiles_"+str(file_list_no+1) if total_files > file_list_no*10 else 'N/A'))]
108
+ )
109
+ if not file_list:
110
+ file_list.append(
111
+ [InlineKeyboardButton("ᴇᴍᴘᴛʏ", callback_data="N/A")])
112
+ file_list.append([InlineKeyboardButton("ᴄʟᴏsᴇ", callback_data="close")])
113
+ return file_list, total_files
114
+
115
+ async def gen_file_menu(_id, file_list_no, update: CallbackQuery):
116
+ try:
117
+ myfile_info=await db.get_file(_id)
118
+ except FIleNotFound:
119
+ await update.answer("File Not Found")
120
+ return
121
+
122
+ file_id=FileId.decode(myfile_info['file_id'])
123
+
124
+ if file_id.file_type in PHOTO_TYPES:
125
+ file_type = "Image"
126
+ elif file_id.file_type == FileType.VOICE:
127
+ file_type = "Voice"
128
+ elif file_id.file_type in (FileType.VIDEO, FileType.ANIMATION, FileType.VIDEO_NOTE):
129
+ file_type = "Video"
130
+ elif file_id.file_type == FileType.DOCUMENT:
131
+ file_type = "Document"
132
+ elif file_id.file_type == FileType.STICKER:
133
+ file_type = "Sticker"
134
+ elif file_id.file_type == FileType.AUDIO:
135
+ file_type = "Audio"
136
+ else:
137
+ file_type = "Unknown"
138
+
139
+ page_link = f"{Server.URL}watch/{myfile_info['_id']}"
140
+ stream_link = f"{Server.URL}dl/{myfile_info['_id']}"
141
+ if "video" in file_type.lower():
142
+ MYFILES_BUTTONS = InlineKeyboardMarkup(
143
+ [
144
+ [InlineKeyboardButton("sᴛʀᴇᴀᴍ", url=page_link), InlineKeyboardButton("ᴅᴏᴡɴʟᴏᴀᴅ", url=stream_link)],
145
+ [InlineKeyboardButton("ɢᴇᴛ ғɪʟᴇ", callback_data=f"sendfile_{myfile_info['_id']}"),
146
+ InlineKeyboardButton("ʀᴇᴠᴏᴋᴇ ғɪʟᴇ", callback_data=f"msgdelete_{myfile_info['_id']}_{file_list_no}")],
147
+ [InlineKeyboardButton("ʙᴀᴄᴋ", callback_data="userfiles_{}".format(file_list_no))]
148
+ ]
149
+ )
150
+ else:
151
+ MYFILES_BUTTONS = InlineKeyboardMarkup(
152
+ [
153
+ [InlineKeyboardButton("ᴅᴏᴡɴʟᴏᴀᴅ", url=stream_link)],
154
+ [InlineKeyboardButton("ɢᴇᴛ ғɪʟᴇ", callback_data=f"sendfile_{myfile_info['_id']}"),
155
+ InlineKeyboardButton("ʀᴇᴠᴏᴋᴇ ғɪʟᴇ", callback_data=f"msgdelete_{myfile_info['_id']}_{file_list_no}")],
156
+ [InlineKeyboardButton("ʙᴀᴄᴋ", callback_data="userfiles_{}".format(file_list_no))]
157
+ ]
158
+ )
159
+
160
+ TiMe = myfile_info['time']
161
+ if type(TiMe) == float:
162
+ date = datetime.datetime.fromtimestamp(TiMe)
163
+ await update.edit_message_caption(
164
+ caption="**File Name :** `{}`\n**File Size :** `{}`\n**File Type :** `{}`\n**Created On :** `{}`\n\n_Made with ♥️ by Ajay Yadav_".format(myfile_info['file_name'],
165
+ humanbytes(int(myfile_info['file_size'])),
166
+ file_type,
167
+ TiMe if isinstance(TiMe,str) else date.date()),
168
+ reply_markup=MYFILES_BUTTONS )
169
+
170
+
171
+ async def delete_user_file(_id, file_list_no: int, update:CallbackQuery):
172
+
173
+ try:
174
+ myfile_info=await db.get_file(_id)
175
+ except FIleNotFound:
176
+ await update.answer("File Already Deleted")
177
+ return
178
+
179
+ await db.delete_one_file(myfile_info['_id'])
180
+ await db.count_links(update.from_user.id, "-")
181
+ await update.message.edit_caption(
182
+ caption= "**Fɪʟᴇ Dᴇʟᴇᴛᴇᴅ Sᴜᴄᴄᴇssғᴜʟʟʏ !**",
183
+ reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton("ʙᴀᴄᴋ", callback_data=f"userfiles_1")]])
184
+ )
185
+
186
+ async def delete_user_filex(_id, update:CallbackQuery):
187
+
188
+ try:
189
+ myfile_info=await db.get_file(_id)
190
+ except FIleNotFound:
191
+ await update.answer("File Already Deleted")
192
+ return
193
+
194
+ await db.delete_one_file(myfile_info['_id'])
195
+ await db.count_links(update.from_user.id, "-")
196
+ await update.message.edit_caption(
197
+ caption= "**Fɪʟᴇ Dᴇʟᴇᴛᴇᴅ Sᴜᴄᴄᴇssғᴜʟʟʏ !**\n\n",
198
+ reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton("ᴄʟᴏsᴇ", callback_data=f"close")]])
199
+ )
Systumm/bot/plugins/start.py ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import logging
2
+ import math
3
+ import asyncio
4
+ from pyrogram import filters, Client
5
+ from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton, Message
6
+ from pyrogram.enums.parse_mode import ParseMode
7
+
8
+ # --- SYSTUMM BRANDING IMPORTS ---
9
+ from Systumm import __version__
10
+ from Systumm.bot import SystummBot
11
+ from Systumm.server.exceptions import FIleNotFound
12
+ from Systumm.utils.bot_utils import gen_linkx, verify_user
13
+ from Systumm.config import Telegram
14
+ from Systumm.utils.database import Database
15
+ from Systumm.utils.translation import LANG, BUTTON
16
+
17
+ db = Database(Telegram.DATABASE_URL, Telegram.SESSION_NAME)
18
+
19
+ @SystummBot.on_message(filters.command('start') & filters.private)
20
+ async def start(bot: Client, message: Message):
21
+ if not await verify_user(bot, message):
22
+ return
23
+ usr_cmd = message.text.split("_")[-1]
24
+
25
+ if usr_cmd == "/start":
26
+ if Telegram.START_PIC:
27
+ await message.reply_photo(
28
+ photo=Telegram.START_PIC,
29
+ caption=LANG.START_TEXT.format(message.from_user.mention, SystummBot.username),
30
+ parse_mode=ParseMode.HTML,
31
+ reply_markup=BUTTON.START_BUTTONS
32
+ )
33
+ else:
34
+ await message.reply_text(
35
+ text=LANG.START_TEXT.format(message.from_user.mention, SystummBot.username),
36
+ parse_mode=ParseMode.HTML,
37
+ disable_web_page_preview=True,
38
+ reply_markup=BUTTON.START_BUTTONS
39
+ )
40
+ else:
41
+ if "stream_" in message.text:
42
+ try:
43
+ file_check = await db.get_file(usr_cmd)
44
+ file_id = str(file_check['_id'])
45
+ if file_id == usr_cmd:
46
+ reply_markup, stream_text = await gen_linkx(m=message, _id=file_id,
47
+ name=[SystummBot.username, SystummBot.fname])
48
+ await message.reply_text(
49
+ text=stream_text,
50
+ parse_mode=ParseMode.HTML,
51
+ disable_web_page_preview=True,
52
+ reply_markup=reply_markup,
53
+ quote=True
54
+ )
55
+
56
+ except FIleNotFound as e:
57
+ await message.reply_text("**File Not Found!** ❌")
58
+ except Exception as e:
59
+ await message.reply_text("**Something Went Wrong!** ⚠️")
60
+ logging.error(e)
61
+
62
+ elif "file_" in message.text:
63
+ try:
64
+ file_check = await db.get_file(usr_cmd)
65
+ db_id = str(file_check['_id'])
66
+ file_id = file_check['file_id']
67
+ file_name = file_check['file_name']
68
+ if db_id == usr_cmd:
69
+ # Injecting Ajay Yadav branding into the downloaded file caption
70
+ filex = await message.reply_cached_media(
71
+ file_id=file_id,
72
+ caption=f"**{file_name}**\n\n_Made with ♥️ by Ajay Yadav_"
73
+ )
74
+ await asyncio.sleep(3600)
75
+ try:
76
+ await filex.delete()
77
+ await message.delete()
78
+ except Exception:
79
+ pass
80
+
81
+ except FIleNotFound as e:
82
+ await message.reply_text("**File Not Found!** ❌")
83
+ except Exception as e:
84
+ await message.reply_text("**Something Went Wrong!** ⚠️")
85
+ logging.error(e)
86
+
87
+ else:
88
+ await message.reply_text("**Invalid Command!** ❌")
89
+
90
+ @SystummBot.on_message(filters.private & filters.command(["about"]))
91
+ async def about_handler(bot: Client, message: Message):
92
+ if not await verify_user(bot, message):
93
+ return
94
+ if Telegram.START_PIC:
95
+ await message.reply_photo(
96
+ photo=Telegram.START_PIC,
97
+ caption=LANG.ABOUT_TEXT.format(SystummBot.fname, __version__),
98
+ parse_mode=ParseMode.HTML,
99
+ reply_markup=BUTTON.ABOUT_BUTTONS
100
+ )
101
+ else:
102
+ await message.reply_text(
103
+ text=LANG.ABOUT_TEXT.format(SystummBot.fname, __version__),
104
+ disable_web_page_preview=True,
105
+ reply_markup=BUTTON.ABOUT_BUTTONS
106
+ )
107
+
108
+ @SystummBot.on_message((filters.command('help')) & filters.private)
109
+ async def help_handler(bot: Client, message: Message):
110
+ if not await verify_user(bot, message):
111
+ return
112
+ if Telegram.START_PIC:
113
+ await message.reply_photo(
114
+ photo=Telegram.START_PIC,
115
+ caption=LANG.HELP_TEXT.format(Telegram.OWNER_ID),
116
+ parse_mode=ParseMode.HTML,
117
+ reply_markup=BUTTON.HELP_BUTTONS
118
+ )
119
+ else:
120
+ await message.reply_text(
121
+ text=LANG.HELP_TEXT.format(Telegram.OWNER_ID),
122
+ parse_mode=ParseMode.HTML,
123
+ disable_web_page_preview=True,
124
+ reply_markup=BUTTON.HELP_BUTTONS
125
+ )
126
+
127
+ # ---------------------------------------------------------------------------------------------------
128
+
129
+ @SystummBot.on_message(filters.command('files') & filters.private)
130
+ async def my_files(bot: Client, message: Message):
131
+ if not await verify_user(bot, message):
132
+ return
133
+ user_files, total_files = await db.find_files(message.from_user.id, [1, 10])
134
+
135
+ file_list = []
136
+ async for x in user_files:
137
+ file_list.append([InlineKeyboardButton(x["file_name"], callback_data=f"myfile_{x['_id']}_{1}")])
138
+ if total_files > 10:
139
+ file_list.append(
140
+ [
141
+ InlineKeyboardButton("◄", callback_data="N/A"),
142
+ InlineKeyboardButton(f"1/{math.ceil(total_files / 10)}", callback_data="N/A"),
143
+ InlineKeyboardButton("►", callback_data="userfiles_2")
144
+ ],
145
+ )
146
+ if not file_list:
147
+ file_list.append(
148
+ [InlineKeyboardButton("ᴇᴍᴘᴛʏ", callback_data="N/A")],
149
+ )
150
+ file_list.append([InlineKeyboardButton("ᴄʟᴏsᴇ", callback_data="close")])
151
+
152
+ # Adding the signature to the user's file list panel
153
+ custom_caption = f"**Your Uploaded Files**\nTotal files: {total_files}\n\n_Made with ♥️ by Ajay Yadav_"
154
+
155
+ if Telegram.FILE_PIC:
156
+ await message.reply_photo(photo=Telegram.FILE_PIC,
157
+ caption=custom_caption,
158
+ reply_markup=InlineKeyboardMarkup(file_list))
159
+ else:
160
+ await message.reply_text(text=custom_caption,
161
+ reply_markup=InlineKeyboardMarkup(file_list))