diff --git a/lyrebird/checker/event.py b/lyrebird/checker/event.py index 4f9af54b3..39ddcdb11 100644 --- a/lyrebird/checker/event.py +++ b/lyrebird/checker/event.py @@ -1,3 +1,4 @@ +import inspect from lyrebird import application from .. import checker @@ -21,10 +22,21 @@ def issue(self, title, message): "title": title, "message": message } + self.check_notice(notice) application.server['event'].publish('notice', notice) def publish(self, channel, message, *args, **kwargs): + if channel == 'notice': + self.check_notice(message) application.server['event'].publish(channel, message, *args, **kwargs) + + def check_notice(self, notice): + stack = inspect.stack() + script_path = stack[2].filename + script_name = script_path[script_path.rfind('/') + 1:] + if script_name in application.config.get('event.notice.autoissue.checker', []): + notice['title'] = f"【Extension】{notice.get('title')}" + notice['alert'] = False @staticmethod def register(func_info): diff --git a/lyrebird/notice_center.py b/lyrebird/notice_center.py index e8e9f713e..7971fe086 100644 --- a/lyrebird/notice_center.py +++ b/lyrebird/notice_center.py @@ -78,6 +78,7 @@ def new_notice(self, msg): """ unique_key = msg.get('title') + alert = msg.get('alert', True) if self.notice_hashmap.get(unique_key): self.notice_hashmap[unique_key]['noticeList'].append(msg) if self.notice_hashmap[unique_key].get('alert'): @@ -86,7 +87,7 @@ def new_notice(self, msg): self.notice_hashmap.update( { unique_key: { - 'alert': True, + 'alert': alert, 'noticeList': [msg] } } diff --git a/lyrebird/version.py b/lyrebird/version.py index ae505a180..c8a54f5af 100644 --- a/lyrebird/version.py +++ b/lyrebird/version.py @@ -1,3 +1,3 @@ -IVERSION = (2, 19, 2) +IVERSION = (2, 20, 0) VERSION = ".".join(str(i) for i in IVERSION) LYREBIRD = "Lyrebird " + VERSION