bot
commited on
Commit
·
7e09f49
1
Parent(s):
f64a77f
Debug
Browse files
main.py
CHANGED
@@ -6,6 +6,7 @@ from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup
|
|
6 |
from telegram.ext import (
|
7 |
Application,
|
8 |
CommandHandler,
|
|
|
9 |
MessageHandler,
|
10 |
CallbackQueryHandler,
|
11 |
CallbackContext,
|
@@ -233,7 +234,7 @@ async def handle_task_cancel(update: Update, context: CallbackContext):
|
|
233 |
# 获取取消操作的类型和文件 ID
|
234 |
action, file_id = query.data.split(":")[0], query.data.split(":")[1]
|
235 |
# 返回文件夹列表
|
236 |
-
await query.edit_message_text(f"
|
237 |
|
238 |
|
239 |
async def tg_show_task(update: Update, context: CallbackContext):
|
@@ -307,7 +308,7 @@ async def tg_show_task(update: Update, context: CallbackContext):
|
|
307 |
keyboard.append(
|
308 |
[
|
309 |
InlineKeyboardButton(
|
310 |
-
f"
|
311 |
callback_data=f"delete_task:{task['id']}",
|
312 |
),
|
313 |
]
|
@@ -319,11 +320,10 @@ async def tg_show_task(update: Update, context: CallbackContext):
|
|
319 |
|
320 |
# 处理任务操作的回调
|
321 |
async def handle_tasks_operation(update: Update, context: CallbackContext):
|
|
|
322 |
query = update.callback_query
|
323 |
await query.answer()
|
324 |
|
325 |
-
print("#################test############")
|
326 |
-
|
327 |
# 获取操作类型和文件 ID
|
328 |
action, task_id = query.data.split(":")
|
329 |
|
@@ -404,7 +404,7 @@ async def init_client():
|
|
404 |
TG_BOT_APPLICATION.add_handler(CommandHandler("emptytrash", tg_emptytrash))
|
405 |
TG_BOT_APPLICATION.add_handler(CommandHandler("tasks", tg_show_task))
|
406 |
TG_BOT_APPLICATION.add_handler(
|
407 |
-
CallbackQueryHandler(handle_tasks_operation, pattern="^delete_task")
|
408 |
)
|
409 |
# 处理取消任务操作
|
410 |
TG_BOT_APPLICATION.add_handler(
|
|
|
6 |
from telegram.ext import (
|
7 |
Application,
|
8 |
CommandHandler,
|
9 |
+
ConversationHandler,
|
10 |
MessageHandler,
|
11 |
CallbackQueryHandler,
|
12 |
CallbackContext,
|
|
|
234 |
# 获取取消操作的类型和文件 ID
|
235 |
action, file_id = query.data.split(":")[0], query.data.split(":")[1]
|
236 |
# 返回文件夹列表
|
237 |
+
await query.edit_message_text(f"操作已取消")
|
238 |
|
239 |
|
240 |
async def tg_show_task(update: Update, context: CallbackContext):
|
|
|
308 |
keyboard.append(
|
309 |
[
|
310 |
InlineKeyboardButton(
|
311 |
+
f"取消任务: {task['name']}",
|
312 |
callback_data=f"delete_task:{task['id']}",
|
313 |
),
|
314 |
]
|
|
|
320 |
|
321 |
# 处理任务操作的回调
|
322 |
async def handle_tasks_operation(update: Update, context: CallbackContext):
|
323 |
+
logging.debug(f"Received callback: {update.callback_query.data}") # 打印回调数据
|
324 |
query = update.callback_query
|
325 |
await query.answer()
|
326 |
|
|
|
|
|
327 |
# 获取操作类型和文件 ID
|
328 |
action, task_id = query.data.split(":")
|
329 |
|
|
|
404 |
TG_BOT_APPLICATION.add_handler(CommandHandler("emptytrash", tg_emptytrash))
|
405 |
TG_BOT_APPLICATION.add_handler(CommandHandler("tasks", tg_show_task))
|
406 |
TG_BOT_APPLICATION.add_handler(
|
407 |
+
CallbackQueryHandler(handle_tasks_operation, pattern="^delete_task:")
|
408 |
)
|
409 |
# 处理取消任务操作
|
410 |
TG_BOT_APPLICATION.add_handler(
|