This commit is contained in:
Windpicker-owo
2025-08-30 19:59:54 +08:00
parent 03969b4a82
commit 7b765d5726
2 changed files with 7 additions and 2 deletions

1
.gitignore vendored
View File

@@ -335,3 +335,4 @@ interested_rates.txt
MaiBot.code-workspace MaiBot.code-workspace
/tests /tests
/tests /tests
.kilocode/rules/MoFox.md

View File

@@ -43,8 +43,8 @@ class EventManager:
def register_event( def register_event(
self, self,
event_name: Union[EventType, str], event_name: Union[EventType, str],
allowed_subscribers: List[str]=[], allowed_subscribers: List[str]=None,
allowed_triggers: List[str]=[] allowed_triggers: List[str]=None
) -> bool: ) -> bool:
"""注册一个新的事件 """注册一个新的事件
@@ -55,6 +55,10 @@ class EventManager:
Returns: Returns:
bool: 注册成功返回True已存在返回False bool: 注册成功返回True已存在返回False
""" """
if allowed_triggers is None:
allowed_triggers = []
if allowed_subscribers is None:
allowed_subscribers = []
if event_name in self._events: if event_name in self._events:
logger.warning(f"事件 {event_name} 已存在,跳过注册") logger.warning(f"事件 {event_name} 已存在,跳过注册")
return False return False