Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b9de2aef60 | |||
| 7a47598538 |
@@ -6,7 +6,7 @@ import os
|
|||||||
|
|
||||||
from astrbot.core.utils.astrbot_path import get_astrbot_data_path
|
from astrbot.core.utils.astrbot_path import get_astrbot_data_path
|
||||||
|
|
||||||
VERSION = "4.2.0"
|
VERSION = "4.2.1"
|
||||||
DB_PATH = os.path.join(get_astrbot_data_path(), "data_v4.db")
|
DB_PATH = os.path.join(get_astrbot_data_path(), "data_v4.db")
|
||||||
|
|
||||||
# 默认配置
|
# 默认配置
|
||||||
|
|||||||
@@ -149,12 +149,6 @@ class CommandFilter(HandlerFilter):
|
|||||||
]
|
]
|
||||||
return self._cmpl_cmd_names
|
return self._cmpl_cmd_names
|
||||||
|
|
||||||
def startswith(self, message_str: str) -> bool:
|
|
||||||
for full_cmd in self.get_complete_command_names():
|
|
||||||
if message_str.startswith(f"{full_cmd} ") or message_str == full_cmd:
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
def equals(self, message_str: str) -> bool:
|
def equals(self, message_str: str) -> bool:
|
||||||
for full_cmd in self.get_complete_command_names():
|
for full_cmd in self.get_complete_command_names():
|
||||||
if message_str == full_cmd:
|
if message_str == full_cmd:
|
||||||
@@ -170,7 +164,12 @@ class CommandFilter(HandlerFilter):
|
|||||||
|
|
||||||
# 检查是否以指令开头
|
# 检查是否以指令开头
|
||||||
message_str = re.sub(r"\s+", " ", event.get_message_str().strip())
|
message_str = re.sub(r"\s+", " ", event.get_message_str().strip())
|
||||||
if not self.startswith(message_str):
|
ok = False
|
||||||
|
for full_cmd in self.get_complete_command_names():
|
||||||
|
if message_str.startswith(f"{full_cmd} ") or message_str == full_cmd:
|
||||||
|
ok = True
|
||||||
|
message_str = message_str[len(full_cmd) :].strip()
|
||||||
|
if not ok:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# 分割为列表
|
# 分割为列表
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
# What's Changed
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "AstrBot"
|
name = "AstrBot"
|
||||||
version = "4.2.0"
|
version = "4.2.1"
|
||||||
description = "易上手的多平台 LLM 聊天机器人及开发框架"
|
description = "易上手的多平台 LLM 聊天机器人及开发框架"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.10"
|
requires-python = ">=3.10"
|
||||||
|
|||||||
Reference in New Issue
Block a user