bot
commited on
Commit
·
c1cbc3e
1
Parent(s):
875052e
fix
Browse files
main.py
CHANGED
@@ -234,9 +234,7 @@ async def handle_message(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
|
234 |
|
235 |
|
236 |
async def tg_show_files(update: Update, context: CallbackContext):
|
237 |
-
|
238 |
-
context.user_data["file_id"] = ""
|
239 |
-
files = await THUNDERX_CLIENT.file_list(100, context.user_data["file_id"], "", {})
|
240 |
keyboard = []
|
241 |
|
242 |
if files["files"] is None:
|
@@ -331,13 +329,45 @@ async def handle_file_operation(update: Update, context: CallbackContext):
|
|
331 |
async def perform_file_action(
|
332 |
update: Update, context: CallbackContext, action: str, file_id: str
|
333 |
):
|
334 |
-
query = update.callback_query
|
335 |
-
await query.answer()
|
336 |
-
|
337 |
if action == "list_file":
|
338 |
-
|
339 |
-
|
340 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
341 |
|
342 |
|
343 |
#################### 离线任务处理 ##########################
|
|
|
234 |
|
235 |
|
236 |
async def tg_show_files(update: Update, context: CallbackContext):
|
237 |
+
files = await THUNDERX_CLIENT.file_list(100, "", "", {})
|
|
|
|
|
238 |
keyboard = []
|
239 |
|
240 |
if files["files"] is None:
|
|
|
329 |
async def perform_file_action(
|
330 |
update: Update, context: CallbackContext, action: str, file_id: str
|
331 |
):
|
|
|
|
|
|
|
332 |
if action == "list_file":
|
333 |
+
files = await THUNDERX_CLIENT.file_list(100, file_id, "", {})
|
334 |
+
keyboard = []
|
335 |
+
|
336 |
+
if files["files"] is None:
|
337 |
+
await update.message.reply_text("❌未找到文件!!")
|
338 |
+
else:
|
339 |
+
# 为每个文件创建按钮和操作选项
|
340 |
+
for file in files["files"]:
|
341 |
+
if file["kind"].lower() == "drive#folder":
|
342 |
+
keyboard.append(
|
343 |
+
[
|
344 |
+
InlineKeyboardButton(
|
345 |
+
f"查看📁: {file['name']}",
|
346 |
+
callback_data=f"list_file:{file['id']}",
|
347 |
+
),
|
348 |
+
InlineKeyboardButton(
|
349 |
+
f"删除",
|
350 |
+
callback_data=f"delete_file:{file['id']}",
|
351 |
+
),
|
352 |
+
]
|
353 |
+
)
|
354 |
+
else:
|
355 |
+
keyboard.append(
|
356 |
+
[
|
357 |
+
InlineKeyboardButton(
|
358 |
+
f"下载📄: {file['name']}",
|
359 |
+
callback_data=f"download_file:{file['id']}",
|
360 |
+
),
|
361 |
+
InlineKeyboardButton(
|
362 |
+
f"删除",
|
363 |
+
callback_data=f"delete_file:{file['id']}",
|
364 |
+
),
|
365 |
+
]
|
366 |
+
)
|
367 |
+
|
368 |
+
reply_markup = InlineKeyboardMarkup(keyboard)
|
369 |
+
await update.message.reply_text(f"📋文件列表:", reply_markup=reply_markup)
|
370 |
+
# await update.callback_query.edit_message_text(f"你选择了取消任务:{file_id}")
|
371 |
|
372 |
|
373 |
#################### 离线任务处理 ##########################
|