bot
commited on
Commit
·
7225d1a
1
Parent(s):
900f8d5
Fix
Browse files
main.py
CHANGED
@@ -159,6 +159,7 @@ async def start(update: Update, context):
|
|
159 |
"•直接发送magent:开的关磁力将直接离线下载\n"
|
160 |
"•/tasks - 查看下载任务\n"
|
161 |
"•/files - 查看文件列表\n"
|
|
|
162 |
"•/quota - 查看存储空间\n"
|
163 |
"•/emptytrash - 清空回收站\n"
|
164 |
"•/help - 获取帮助信息\n"
|
@@ -173,6 +174,7 @@ async def help(update: Update, context):
|
|
173 |
"•直接发送magent:开的关磁力将直接离线下载\n"
|
174 |
"•/tasks - 查看下载任务\n"
|
175 |
"•/files - 查看文件列表\n"
|
|
|
176 |
"•/quota - 查看存储空间\n"
|
177 |
"•/emptytrash - 清空回收站\n"
|
178 |
"•/help - 获取帮助信息\n"
|
@@ -231,6 +233,32 @@ async def handle_message(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
|
231 |
await update.message.reply_text(f"收到不支持的消息:{text}")
|
232 |
|
233 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
#################### 文件操作 #############################
|
235 |
|
236 |
|
@@ -411,8 +439,9 @@ async def perform_file_action(
|
|
411 |
await update.callback_query.edit_message_text(f"❌未找到文件下载地址!!")
|
412 |
elif action == "sh_f":
|
413 |
result = await THUNDERX_CLIENT.file_batch_share([file_id], False, -1)
|
414 |
-
|
415 |
-
|
|
|
416 |
else:
|
417 |
await update.callback_query.edit_message_text(f"❌分享失败!!")
|
418 |
|
@@ -634,6 +663,7 @@ async def init_client():
|
|
634 |
TG_BOT_APPLICATION.add_handler(CommandHandler("emptytrash", tg_emptytrash))
|
635 |
TG_BOT_APPLICATION.add_handler(CommandHandler("tasks", tg_show_task))
|
636 |
TG_BOT_APPLICATION.add_handler(CommandHandler("files", tg_show_files))
|
|
|
637 |
# Message 消息处理相关的命令!
|
638 |
TG_BOT_APPLICATION.add_handler(MessageHandler(filters.TEXT, handle_message))
|
639 |
|
|
|
159 |
"•直接发送magent:开的关磁力将直接离线下载\n"
|
160 |
"•/tasks - 查看下载任务\n"
|
161 |
"•/files - 查看文件列表\n"
|
162 |
+
"•/shares - 查看分享列表\n"
|
163 |
"•/quota - 查看存储空间\n"
|
164 |
"•/emptytrash - 清空回收站\n"
|
165 |
"•/help - 获取帮助信息\n"
|
|
|
174 |
"•直接发送magent:开的关磁力将直接离线下载\n"
|
175 |
"•/tasks - 查看下载任务\n"
|
176 |
"•/files - 查看文件列表\n"
|
177 |
+
"•/shares - 查看分享列表\n"
|
178 |
"•/quota - 查看存储空间\n"
|
179 |
"•/emptytrash - 清空回收站\n"
|
180 |
"•/help - 获取帮助信息\n"
|
|
|
233 |
await update.message.reply_text(f"收到不支持的消息:{text}")
|
234 |
|
235 |
|
236 |
+
#################### 分享操作 #############################
|
237 |
+
async def tg_show_shares(update: Update, context: CallbackContext):
|
238 |
+
shares = await THUNDERX_CLIENT.get_share_list("")
|
239 |
+
keyboard = []
|
240 |
+
|
241 |
+
if shares["shares"] is None:
|
242 |
+
await update.message.reply_text("❌未找到文件!!")
|
243 |
+
else:
|
244 |
+
# 为每个文件创建按钮和操作选项
|
245 |
+
for share in shares["shares"]:
|
246 |
+
keyboard.append(
|
247 |
+
[
|
248 |
+
InlineKeyboardButton(
|
249 |
+
f"查看📁: {share['name']}",
|
250 |
+
callback_data=f"ls_f:{share['id']}",
|
251 |
+
),
|
252 |
+
InlineKeyboardButton(
|
253 |
+
f"取消",
|
254 |
+
callback_data=f"del_s:{file['id']}",
|
255 |
+
),
|
256 |
+
]
|
257 |
+
)
|
258 |
+
reply_markup = InlineKeyboardMarkup(keyboard)
|
259 |
+
await update.message.reply_text(f"📋分享列表:", reply_markup=reply_markup)
|
260 |
+
|
261 |
+
|
262 |
#################### 文件操作 #############################
|
263 |
|
264 |
|
|
|
439 |
await update.callback_query.edit_message_text(f"❌未找到文件下载地址!!")
|
440 |
elif action == "sh_f":
|
441 |
result = await THUNDERX_CLIENT.file_batch_share([file_id], False, -1)
|
442 |
+
share_id = result["share_id"]
|
443 |
+
if share_id is not None:
|
444 |
+
await update.callback_query.edit_message_text(f"✅分享码:{share_id}")
|
445 |
else:
|
446 |
await update.callback_query.edit_message_text(f"❌分享失败!!")
|
447 |
|
|
|
663 |
TG_BOT_APPLICATION.add_handler(CommandHandler("emptytrash", tg_emptytrash))
|
664 |
TG_BOT_APPLICATION.add_handler(CommandHandler("tasks", tg_show_task))
|
665 |
TG_BOT_APPLICATION.add_handler(CommandHandler("files", tg_show_files))
|
666 |
+
TG_BOT_APPLICATION.add_handler(CommandHandler("shares", tg_show_shares))
|
667 |
# Message 消息处理相关的命令!
|
668 |
TG_BOT_APPLICATION.add_handler(MessageHandler(filters.TEXT, handle_message))
|
669 |
|