bot commited on
Commit
0c8f612
·
1 Parent(s): 1e582c5

添加清空操作

Browse files
Files changed (1) hide show
  1. main.py +16 -4
main.py CHANGED
@@ -145,7 +145,7 @@ TG_BASE_URL = "https://tg.alist.dpdns.org/bot"
145
  async def start(update: Update, context):
146
  commands = (
147
  "🚀欢迎使用我的机器人!\n\n"
148
- "📋可用命令:\n"
149
  "•直接发送magent:开的关磁力将直接离线下载\n"
150
  "•/tasks - 查看下载任务\n"
151
  "•/files - 查看文件列表\n"
@@ -159,7 +159,7 @@ async def start(update: Update, context):
159
  async def help(update: Update, context):
160
  commands = (
161
  "🚀欢迎使用我的机器人!\n\n"
162
- "📋可用命令:\n"
163
  "•直接发送magent:开的关磁力将直接离线下载\n"
164
  "•/tasks - 查看下载任务\n"
165
  "•/files - 查看文件列表\n"
@@ -190,13 +190,24 @@ async def quota(update: Update, context):
190
  """
191
  quota_info = await THUNDERX_CLIENT.get_quota_info()
192
  if quota_info["quota"]["usage"] is None:
193
- await update.message.reply_text("未找到使用信息,请稍后再试!")
194
  else:
195
  await update.message.reply_text(
196
- f"使用信息:\n{format_bytes(int(quota_info['quota']['limit']))}/{format_bytes(int(quota_info['quota']['usage']))}\n到期时间:\n{quota_info['expires_at']}"
197
  )
198
 
199
 
 
 
 
 
 
 
 
 
 
 
 
200
  @app.on_event("startup")
201
  async def init_client():
202
  global THUNDERX_CLIENT
@@ -240,6 +251,7 @@ async def init_client():
240
  TG_BOT_APPLICATION.add_handler(CommandHandler("start", start))
241
  TG_BOT_APPLICATION.add_handler(CommandHandler("help", help))
242
  TG_BOT_APPLICATION.add_handler(CommandHandler("quota", quota))
 
243
 
244
 
245
  # FastAPI 路由:接收来自 Telegram 的 Webhook 回调
 
145
  async def start(update: Update, context):
146
  commands = (
147
  "🚀欢迎使用我的机器人!\n\n"
148
+ "📋可用命令:\n"
149
  "•直接发送magent:开的关磁力将直接离线下载\n"
150
  "•/tasks - 查看下载任务\n"
151
  "•/files - 查看文件列表\n"
 
159
  async def help(update: Update, context):
160
  commands = (
161
  "🚀欢迎使用我的机器人!\n\n"
162
+ "📋可用命令:\n"
163
  "•直接发送magent:开的关磁力将直接离线下载\n"
164
  "•/tasks - 查看下载任务\n"
165
  "•/files - 查看文件列表\n"
 
190
  """
191
  quota_info = await THUNDERX_CLIENT.get_quota_info()
192
  if quota_info["quota"]["usage"] is None:
193
+ await update.message.reply_text("❌未找到使用信息,请稍后再试!")
194
  else:
195
  await update.message.reply_text(
196
+ f"✅使用信息:\n{format_bytes(int(quota_info['quota']['usage']))}/{format_bytes(int(quota_info['quota']['limit']))}\n⏰到期时间:\n{quota_info['expires_at']}"
197
  )
198
 
199
 
200
+ async def tg_emptytrash(update: Update, context):
201
+ """
202
+ 返回信息
203
+ """
204
+ result = await THUNDERX_CLIENT.emptytrash()
205
+ if result["task_id"] is None:
206
+ await update.message.reply_text("❌未成功创建任务,请稍后重试!!")
207
+ else:
208
+ await update.message.reply_text(f"✅操作成功")
209
+
210
+
211
  @app.on_event("startup")
212
  async def init_client():
213
  global THUNDERX_CLIENT
 
251
  TG_BOT_APPLICATION.add_handler(CommandHandler("start", start))
252
  TG_BOT_APPLICATION.add_handler(CommandHandler("help", help))
253
  TG_BOT_APPLICATION.add_handler(CommandHandler("quota", quota))
254
+ TG_BOT_APPLICATION.add_handler(CommandHandler("emptytrash", tg_emptytrash))
255
 
256
 
257
  # FastAPI 路由:接收来自 Telegram 的 Webhook 回调