Update chatbot/plugins/chat.py
Browse files- chatbot/plugins/chat.py +8 -6
chatbot/plugins/chat.py
CHANGED
@@ -115,7 +115,7 @@ class TaskManager:
|
|
115 |
|
116 |
task_manager = TaskManager()
|
117 |
|
118 |
-
async def progress(current, total, message, start, type_of_ps, file_name=None):
|
119 |
"""Progress Bar For Showing Progress While Uploading / Downloading File - Normal"""
|
120 |
now = time.time()
|
121 |
diff = now - start
|
@@ -145,9 +145,11 @@ async def progress(current, total, message, start, type_of_ps, file_name=None):
|
|
145 |
pass
|
146 |
else:
|
147 |
try:
|
148 |
-
await message.
|
149 |
-
f"{type_of_ps}\n{tmp}",
|
150 |
-
|
|
|
|
|
151 |
except FloodWait as e:
|
152 |
await asyncio.sleep(e.x)
|
153 |
except MessageNotModified:
|
@@ -210,7 +212,7 @@ async def handle_photo(client, message):
|
|
210 |
)
|
211 |
seconds_time = time.time()
|
212 |
file_path = await message.download(
|
213 |
-
progress=progress,
|
214 |
progress_args=(ai_reply, seconds_time, "Uploading...")
|
215 |
)
|
216 |
caption = message.caption or "What's this?"
|
@@ -266,7 +268,7 @@ async def handle_video(client, message, model_):
|
|
266 |
seconds_time = time.time()
|
267 |
video_file_name = await message.download(
|
268 |
file_name="newvideo.mp4",
|
269 |
-
progress=progress,
|
270 |
progress_args=(ai_reply, seconds_time, "Uploading...")
|
271 |
)
|
272 |
caption = message.caption or "What's this?"
|
|
|
115 |
|
116 |
task_manager = TaskManager()
|
117 |
|
118 |
+
async def progress(current, total, message, start, type_of_ps, file_name=None, reply_markup=None):
|
119 |
"""Progress Bar For Showing Progress While Uploading / Downloading File - Normal"""
|
120 |
now = time.time()
|
121 |
diff = now - start
|
|
|
145 |
pass
|
146 |
else:
|
147 |
try:
|
148 |
+
await message.edit_text(
|
149 |
+
f"{type_of_ps}\n{tmp}",
|
150 |
+
parse_mode=enums.ParseMode.MARKDOWN,
|
151 |
+
reply_markup=reply_markup
|
152 |
+
)
|
153 |
except FloodWait as e:
|
154 |
await asyncio.sleep(e.x)
|
155 |
except MessageNotModified:
|
|
|
212 |
)
|
213 |
seconds_time = time.time()
|
214 |
file_path = await message.download(
|
215 |
+
progress=progress(reply_markup=InlineKeyboardMarkup(buttons),
|
216 |
progress_args=(ai_reply, seconds_time, "Uploading...")
|
217 |
)
|
218 |
caption = message.caption or "What's this?"
|
|
|
268 |
seconds_time = time.time()
|
269 |
video_file_name = await message.download(
|
270 |
file_name="newvideo.mp4",
|
271 |
+
progress=progress(reply_markup=InlineKeyboardMarkup(buttons),
|
272 |
progress_args=(ai_reply, seconds_time, "Uploading...")
|
273 |
)
|
274 |
caption = message.caption or "What's this?"
|