From 2e1c115678562e59d3020d55d1a33ed665bdca5c Mon Sep 17 00:00:00 2001 From: AirportR <airportroster@gmail.com> Date: Wed, 21 Jun 2023 22:35:16 +0800 Subject: [PATCH] :bug: 3.5.10: Fix backend mode nospeed configuration not working. --- botmodule/command/test.py | 7 +++++++ botmodule/init_bot.py | 2 +- utils/bot.py | 2 +- utils/check.py | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/botmodule/command/test.py b/botmodule/command/test.py index ccc7dcc..abc592d 100644 --- a/botmodule/command/test.py +++ b/botmodule/command/test.py @@ -36,6 +36,11 @@ def select_core_slave(coreindex: str, botmsg: Message, putinfo: dict): masterid = putinfo.get('master', {}).get('id', 1) slavename = putinfo.get('slave', {}).get('comment', '未知') if coreindex == 1: + if config.nospeed: + msgtext = f"/relay {masterid} edit {edit_chat_id} {edit_msg_id} ❌此后端禁止测速服务" + botmsg.edit_text(msgtext) + logger.info("由于此后端禁止测速服务,已取消任务") + return None return SpeedCore(botmsg.chat.id, botmsg.id, SPEEDTESTIKM, (sp, (botmsg, 1, masterid, edit_chat_id, edit_msg_id, slavename))) elif coreindex == 2: @@ -276,6 +281,8 @@ async def process_slave(app: Client, message: Message, putinfo: dict, **kwargs): proxyinfo = putinfo.pop('proxies', []) kwargs.update(putinfo) core = select_core_slave(coreindex, message, putinfo) + if core is None: + return info = await core.core(proxyinfo, **kwargs) print("后端结果:", info) diff --git a/botmodule/init_bot.py b/botmodule/init_bot.py index 2ccba6c..f683d36 100644 --- a/botmodule/init_bot.py +++ b/botmodule/init_bot.py @@ -76,7 +76,7 @@ api_hash = botconfig.get('api_hash', None) bot_token = botconfig.get('bot_token', None) clash_path = config.get_clash_path() # 为clash核心运行路径, Windows系统需要加后缀名.exe clash_work_path = config.get_clash_work_path() # clash工作路径 -corenum = min(config.config.get('clash', {}).get('core', 1), 64) +corenum = min(config.config.get('clash', {}).get('core', 1), 127) admin = config.getAdmin() # 管理员 config.add_user(admin) config.reload() diff --git a/utils/bot.py b/utils/bot.py index b8039b7..fff3499 100644 --- a/utils/bot.py +++ b/utils/bot.py @@ -294,7 +294,7 @@ def callback_loader(app: Client): # logger.info(str(test_items)) if message: sort_str = botmodule.get_sort_str(message) - slaveid = botmodule.get_slave_id(message.chat.id, message.id) + slaveid = botmodule.get_slave_id(message) await asyncio.sleep(2) await message.delete() await bot_put(client, origin_message, test_type, test_items, sort=sort_str, coreindex=3, slaveid=slaveid) diff --git a/utils/check.py b/utils/check.py index f08191c..493f4c8 100644 --- a/utils/check.py +++ b/utils/check.py @@ -136,7 +136,7 @@ async def check_subowner(message, back_message, subinfo: dict, admin: list, pass except AttributeError: ID = message.sender_chat.id if not subinfo: - await back_message.edit_text("❌找不到该任务名称,请检查参数是否正确 (TEST DELETE MESSAGE)") + await back_message.edit_text("❌找不到该任务名称,请检查参数是否正确。") message_delete_queue.put_nowait([back_message.chat.id, back_message.id, 10]) # await back_message.delete() return False -- GitLab