mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2025-12-15 14:22:55 +08:00
优化代码
This commit is contained in:
parent
9b33894a30
commit
dc8eb69962
@ -226,21 +226,21 @@ async def _(event: MessageEvent, arg: Message = CommandArg(), cmd: str = OneComm
|
||||
type_ = "罕见皮肤"
|
||||
await update_case.send(f"即将更新所有{type_}, 请稍等")
|
||||
for i, case_name in enumerate(case_list):
|
||||
# try:
|
||||
info = await update_skin_data(case_name)
|
||||
if "请先登录" in info:
|
||||
await update_case.finish(f"未登录, 已停止更新...")
|
||||
rand = random.randint(300, 500)
|
||||
result = f"更新全部{type_}完成"
|
||||
if i < len(case_list):
|
||||
next_case = case_list[i + 1]
|
||||
result = f"将在 {rand} 秒后更新下一{type_}: {next_case}"
|
||||
await update_case.send(f"{info}, {result}")
|
||||
logger.info(f"info, {result}", "更新武器箱")
|
||||
await asyncio.sleep(rand)
|
||||
# except Exception as e:
|
||||
# logger.error(f"更新{type_}: {case_name}", e=e)
|
||||
# await update_case.send(f"更新{type_}: {case_name} 发生错误: {type(e)}: {e}")
|
||||
try:
|
||||
info = await update_skin_data(case_name)
|
||||
if "请先登录" in info:
|
||||
await update_case.finish(f"未登录, 已停止更新...")
|
||||
rand = random.randint(300, 500)
|
||||
result = f"更新全部{type_}完成"
|
||||
if i < len(case_list):
|
||||
next_case = case_list[i + 1]
|
||||
result = f"将在 {rand} 秒后更新下一{type_}: {next_case}"
|
||||
await update_case.send(f"{info}, {result}")
|
||||
logger.info(f"info, {result}", "更新武器箱")
|
||||
await asyncio.sleep(rand)
|
||||
except Exception as e:
|
||||
logger.error(f"更新{type_}: {case_name}", e=e)
|
||||
await update_case.send(f"更新{type_}: {case_name} 发生错误: {type(e)}: {e}")
|
||||
await update_case.send(f"更新全部{type_}完成")
|
||||
else:
|
||||
await update_case.send(f"开始{cmd}: {msg}, 请稍等")
|
||||
|
||||
Loading…
Reference in New Issue
Block a user