BinaryONe
commited on
Commit
·
0714d01
1
Parent(s):
65f6ce3
Copilot Modifications
Browse files
FileStream/Exceptions/__init__.py
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
from .exceptions import
|
|
|
|
| 1 |
+
from .exceptions import FileNotFound, InvalidHash
|
FileStream/Exceptions/exceptions.py
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
class InvalidHash(Exception):
|
| 2 |
message = "Invalid hash"
|
| 3 |
|
| 4 |
-
class
|
| 5 |
message = "File not found"
|
|
|
|
| 1 |
class InvalidHash(Exception):
|
| 2 |
message = "Invalid hash"
|
| 3 |
|
| 4 |
+
class FileNotFound(Exception):
|
| 5 |
message = "File not found"
|
FileStream/bot/plugins/FileHandlers/callback.py
CHANGED
|
@@ -14,7 +14,7 @@ from FileStream.Database import Database
|
|
| 14 |
from FileStream.config import Telegram, Server
|
| 15 |
from FileStream.bot import FileStream
|
| 16 |
from FileStream.bot import MULTI_CLIENTS
|
| 17 |
-
from FileStream.Exceptions import
|
| 18 |
from FileStream.utils.FileProcessors.translation import LANG, BUTTON
|
| 19 |
from FileStream.utils.FileProcessors.human_readable import humanbytes
|
| 20 |
from FileStream.bot.plugins.FileHandlers.stream import private_receive_handler
|
|
@@ -246,7 +246,7 @@ async def gen_file_list_button(file_list_no: int, user_id: int):
|
|
| 246 |
async def gen_file_menu(_id, file_list_no, update: CallbackQuery):
|
| 247 |
try:
|
| 248 |
myfile_info = await db.get_file(_id)
|
| 249 |
-
except
|
| 250 |
await update.answer("File Not Found")
|
| 251 |
return
|
| 252 |
|
|
@@ -352,7 +352,7 @@ async def gen_privfile_list_button(file_list_no: int, user_id: int):
|
|
| 352 |
async def gen_privfile_menu(_id, file_list_no, update: CallbackQuery):
|
| 353 |
try:
|
| 354 |
myfile_info = await db.get_privfile(_id)
|
| 355 |
-
except
|
| 356 |
await update.answer("File Not Found")
|
| 357 |
return
|
| 358 |
|
|
@@ -460,7 +460,7 @@ async def gen_allfile_list_button(file_list_no: int, user_id: int):
|
|
| 460 |
async def gen_allfile_menu(_id, file_list_no, update: CallbackQuery):
|
| 461 |
try:
|
| 462 |
myfile_info = await db.get_file(_id)
|
| 463 |
-
except
|
| 464 |
await update.answer("File Not Found")
|
| 465 |
return
|
| 466 |
|
|
@@ -555,7 +555,7 @@ async def delete_user_file(_id, file_list_no: int, update: CallbackQuery):
|
|
| 555 |
reply_markup=InlineKeyboardMarkup(
|
| 556 |
[[InlineKeyboardButton("ʙᴀᴄᴋ", callback_data=f"userfiles_1")]]))
|
| 557 |
|
| 558 |
-
except
|
| 559 |
await update.answer("File Already Deleted")
|
| 560 |
return
|
| 561 |
|
|
@@ -580,6 +580,6 @@ async def delete_user_filex(_id, update: CallbackQuery):
|
|
| 580 |
reply_markup=InlineKeyboardMarkup(
|
| 581 |
[[InlineKeyboardButton("ᴄʟᴏsᴇ", callback_data=f"close")]]))
|
| 582 |
|
| 583 |
-
except
|
| 584 |
await update.answer("File Already Deleted")
|
| 585 |
return
|
|
|
|
| 14 |
from FileStream.config import Telegram, Server
|
| 15 |
from FileStream.bot import FileStream
|
| 16 |
from FileStream.bot import MULTI_CLIENTS
|
| 17 |
+
from FileStream.Exceptions import FileNotFound # Corrected the import statement
|
| 18 |
from FileStream.utils.FileProcessors.translation import LANG, BUTTON
|
| 19 |
from FileStream.utils.FileProcessors.human_readable import humanbytes
|
| 20 |
from FileStream.bot.plugins.FileHandlers.stream import private_receive_handler
|
|
|
|
| 246 |
async def gen_file_menu(_id, file_list_no, update: CallbackQuery):
|
| 247 |
try:
|
| 248 |
myfile_info = await db.get_file(_id)
|
| 249 |
+
except FileNotFound:
|
| 250 |
await update.answer("File Not Found")
|
| 251 |
return
|
| 252 |
|
|
|
|
| 352 |
async def gen_privfile_menu(_id, file_list_no, update: CallbackQuery):
|
| 353 |
try:
|
| 354 |
myfile_info = await db.get_privfile(_id)
|
| 355 |
+
except FileNotFound:
|
| 356 |
await update.answer("File Not Found")
|
| 357 |
return
|
| 358 |
|
|
|
|
| 460 |
async def gen_allfile_menu(_id, file_list_no, update: CallbackQuery):
|
| 461 |
try:
|
| 462 |
myfile_info = await db.get_file(_id)
|
| 463 |
+
except FileNotFound:
|
| 464 |
await update.answer("File Not Found")
|
| 465 |
return
|
| 466 |
|
|
|
|
| 555 |
reply_markup=InlineKeyboardMarkup(
|
| 556 |
[[InlineKeyboardButton("ʙᴀᴄᴋ", callback_data=f"userfiles_1")]]))
|
| 557 |
|
| 558 |
+
except FileNotFound:
|
| 559 |
await update.answer("File Already Deleted")
|
| 560 |
return
|
| 561 |
|
|
|
|
| 580 |
reply_markup=InlineKeyboardMarkup(
|
| 581 |
[[InlineKeyboardButton("ᴄʟᴏsᴇ", callback_data=f"close")]]))
|
| 582 |
|
| 583 |
+
except FileNotFound:
|
| 584 |
await update.answer("File Already Deleted")
|
| 585 |
return
|
FileStream/bot/plugins/FileHandlers/stream.py
CHANGED
|
@@ -128,9 +128,9 @@ async def reply_handler(
|
|
| 128 |
|
| 129 |
replied_message = message.reply_to_message
|
| 130 |
resp = ["n", "no", "not"]
|
| 131 |
-
if replied_message
|
| 132 |
return
|
| 133 |
-
if replied_message.media:
|
| 134 |
return
|
| 135 |
text = message.text
|
| 136 |
try:
|
|
|
|
| 128 |
|
| 129 |
replied_message = message.reply_to_message
|
| 130 |
resp = ["n", "no", "not"]
|
| 131 |
+
if not replied_message:
|
| 132 |
return
|
| 133 |
+
if not replied_message.media:
|
| 134 |
return
|
| 135 |
text = message.text
|
| 136 |
try:
|