bot commited on
Commit
ed33a7a
·
1 Parent(s): 941ea95
Files changed (1) hide show
  1. main.py +16 -16
main.py CHANGED
@@ -336,15 +336,16 @@ async def perform_file_action(
336
  if files["files"] is None:
337
  await update.message.reply_text("❌未找到文件!!")
338
  else:
339
- if files["files"][0]["parent_id"] is not None:
340
- keyboard.append(
341
- [
342
- InlineKeyboardButton(
343
- f"返回上级",
344
- callback_data=f"list_file:{files["files"][0]["parent_id"]}",
345
- ),
346
- ]
347
- )
 
348
  # 为每个文件创建按钮和操作选项
349
  for file in files["files"]:
350
  if file["kind"].lower() == "drive#folder":
@@ -381,19 +382,18 @@ async def perform_file_action(
381
  )
382
  elif action == "download_file":
383
  result = await THUNDERX_CLIENT.get_download_url(file_id)
384
- download_url = result['web_content_link']
385
  for media in result["medias"]:
386
- if media['link']['url'] is not None:
387
- download_url = media['link']['url']
388
  break
389
  if download_url is not None:
390
  await update.callback_query.edit_message_text(
391
- f"📋文件下载地址:{download_url}"
392
  )
393
  else:
394
- await update.callback_query.edit_message_text(
395
- f"❌未找到文件下载地址!!"
396
- )
397
 
398
  #################### 离线任务处理 ##########################
399
  # 确认操作的回调
 
336
  if files["files"] is None:
337
  await update.message.reply_text("❌未找到文件!!")
338
  else:
339
+ parent_id = files["files"][0]["parent_id"]
340
+ if parent_id is not None:
341
+ keyboard.append(
342
+ [
343
+ InlineKeyboardButton(
344
+ f"返回上级",
345
+ callback_data=f"list_file:{parent_id}",
346
+ ),
347
+ ]
348
+ )
349
  # 为每个文件创建按钮和操作选项
350
  for file in files["files"]:
351
  if file["kind"].lower() == "drive#folder":
 
382
  )
383
  elif action == "download_file":
384
  result = await THUNDERX_CLIENT.get_download_url(file_id)
385
+ download_url = result["web_content_link"]
386
  for media in result["medias"]:
387
+ if media["link"]["url"] is not None:
388
+ download_url = media["link"]["url"]
389
  break
390
  if download_url is not None:
391
  await update.callback_query.edit_message_text(
392
+ f"📋文件下载地址:{download_url}"
393
  )
394
  else:
395
+ await update.callback_query.edit_message_text(f"❌未找到文件下载地址!!")
396
+
 
397
 
398
  #################### 离线任务处理 ##########################
399
  # 确认操作的回调