From a5c9d4e07784476fd1df8278d5c4264c4364c1b9 Mon Sep 17 00:00:00 2001 From: iwumingz Date: Fri, 8 Apr 2022 21:58:47 +0800 Subject: [PATCH] Add source cmd to regex --- core/custom.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/core/custom.py b/core/custom.py index 80b348a..ea7e00e 100644 --- a/core/custom.py +++ b/core/custom.py @@ -15,18 +15,19 @@ from typing import Any, Dict import yaml from pyrogram import filters from pyrogram.types import Message -from tools.constants import STORE_TRACE_DATA +from tools.constants import STORE_TRACE_DATA, COMMAND_YML from tools.storage import SimpleStore -command_data: Dict[str, Any] = yaml.full_load(open("./data/command.yml", 'rb')) +command_data: Dict[str, Any] = yaml.full_load(open(COMMAND_YML, 'rb')) def command(key: str): """匹配UserBot指令""" - # 指令前缀 - # 例一:prefixes = "-" - # 例二:prefixes = ["-", "/", "+"] prefixes = command_data.get('help').get('all_prefixes') + if type(command_data.get(key).get('cmd')) == str: + cmd = [command_data.get(key).get('cmd'), key] + return filters.me & filters.text & filters.command(cmd, prefixes) + cmd = command_data.get(key).get('cmd') return filters.me & filters.text & filters.command(cmd, prefixes)