We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
在 nonebot-test 前端调试时无法让 Bot 说出 <test>
nonebot.load_builtin_plugins() 后，在 nonebot-test 前端向 Bot 发送 /say <test> 

Bot 未发送任何消息，且 nonebot2 控制台返回：

```
[ERROR] nonebot_test | Tag "<test>" does not corespond to any known ansi directive, make sure you did not misspelled it (or prepend '\' to escape it)
```

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `nonebot/utils.py`
Content:
```
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 import json
5 import asyncio
6 import dataclasses
7 from functools import wraps, partial
8 
9 from nonebot.typing import Any, Callable, Awaitable, overrides
10 
11 
12 def run_sync(func: Callable[..., Any]) -> Callable[..., Awaitable[Any]]:
13     """
14     :说明:
15       一个用于包装 sync function 为 async function 的装饰器
16     :参数:
17       * ``func: Callable[..., Any]``: 被装饰的同步函数
18     :返回:
19       - ``Callable[..., Awaitable[Any]]``
20     """
21 
22     @wraps(func)
23     async def _wrapper(*args: Any, **kwargs: Any) -> Any:
24         loop = asyncio.get_running_loop()
25         pfunc = partial(func, *args, **kwargs)
26         result = await loop.run_in_executor(None, pfunc)
27         return result
28 
29     return _wrapper
30 
31 
32 class DataclassEncoder(json.JSONEncoder):
33     """
34     :说明:
35       在JSON序列化 ``Message`` (List[Dataclass]) 时使用的 ``JSONEncoder``
36     """
37 
38     @overrides(json.JSONEncoder)
39     def default(self, o):
40         if dataclasses.is_dataclass(o):
41             return dataclasses.asdict(o)
42         return super().default(o)
43
```

Path: `nonebot/__init__.py`
Content:
```
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 import importlib
5 from nonebot.typing import Bot, Dict, Type, Union, Driver, Optional, NoReturn
6 
7 _driver: Optional[Driver] = None
8 
9 
10 def get_driver() -> Union[NoReturn, Driver]:
11     """
12     :说明:
13 
14       获取全局 Driver 对象。可用于在计划任务的回调中获取当前 Driver 对象。
15 
16     :返回:
17 
18       * ``Driver``: 全局 Driver 对象
19 
20     :异常:
21 
22       * ``ValueError``: 全局 Driver 对象尚未初始化 (nonebot.init 尚未调用)
23 
24     :用法:
25 
26     .. code-block:: python
27 
28         driver = nonebot.get_driver()
29 
30     """
31     if _driver is None:
32         raise ValueError("NoneBot has not been initialized.")
33     return _driver
34 
35 
36 def get_app():
37     """
38     :说明:
39 
40       获取全局 Driver 对应 Server App 对象。
41 
42     :返回:
43 
44       * ``Any``: Server App 对象
45 
46     :异常:
47 
48       * ``ValueError``: 全局 Driver 对象尚未初始化 (nonebot.init 尚未调用)
49 
50     :用法:
51 
52     .. code-block:: python
53 
54         app = nonebot.get_app()
55 
56     """
57     driver = get_driver()
58     return driver.server_app
59 
60 
61 def get_asgi():
62     """
63     :说明:
64 
65       获取全局 Driver 对应 Asgi 对象。
66 
67     :返回:
68 
69       * ``Any``: Asgi 对象
70 
71     :异常:
72 
73       * ``ValueError``: 全局 Driver 对象尚未初始化 (nonebot.init 尚未调用)
74 
75     :用法:
76 
77     .. code-block:: python
78 
79         asgi = nonebot.get_asgi()
80 
81     """
82     driver = get_driver()
83     return driver.asgi
84 
85 
86 def get_bots() -> Union[NoReturn, Dict[str, Bot]]:
87     """
88     :说明:
89 
90       获取所有通过 ws 连接 NoneBot 的 Bot 对象。
91 
92     :返回:
93 
94       * ``Dict[str, Bot]``: 一个以字符串 ID 为键，Bot 对象为值的字典
95 
96     :异常:
97 
98       * ``ValueError``: 全局 Driver 对象尚未初始化 (nonebot.init 尚未调用)
99 
100     :用法:
101 
102     .. code-block:: python
103 
104         bots = nonebot.get_bots()
105 
106     """
107     driver = get_driver()
108     return driver.bots
109 
110 
111 from nonebot.sched import scheduler
112 from nonebot.config import Env, Config
113 from nonebot.log import logger, default_filter
114 from nonebot.adapters.cqhttp import Bot as CQBot
115 
116 try:
117     import nonebot_test
118 except ImportError:
119     nonebot_test = None
120 
121 
122 def init(*, _env_file: Optional[str] = None, **kwargs):
123     """
124     :说明:
125 
126       初始化 NoneBot 以及 全局 Driver 对象。
127 
128       NoneBot 将会从 .env 文件中读取环境信息，并使用相应的 env 文件配置。
129 
130       你也可以传入自定义的 _env_file 来指定 NoneBot 从该文件读取配置。
131 
132     :参数:
133 
134       * ``_env_file: Optional[str]``: 配置文件名，默认从 .env.{env_name} 中读取配置
135       * ``**kwargs``: 任意变量，将会存储到 Config 对象里
136 
137     :返回:
138 
139       - ``None``
140 
141     :用法:
142 
143     .. code-block:: python
144 
145         nonebot.init(database=Database(...))
146 
147     """
148     global _driver
149     if not _driver:
150         logger.info("NoneBot is initializing...")
151         env = Env()
152         logger.opt(
153             colors=True).info(f"Current <y><b>Env: {env.environment}</b></y>")
154         config = Config(**kwargs,
155                         _env_file=_env_file or f".env.{env.environment}")
156 
157         default_filter.level = "DEBUG" if config.debug else "INFO"
158         logger.opt(
159             colors=True).debug(f"Loaded <y><b>Config</b></y>: {config.dict()}")
160 
161         DriverClass: Type[Driver] = getattr(
162             importlib.import_module(config.driver), "Driver")
163         _driver = DriverClass(env, config)
164 
165         # register build-in adapters
166         _driver.register_adapter("cqhttp", CQBot)
167 
168         # load nonebot test frontend if debug
169         if config.debug and nonebot_test:
170             logger.debug("Loading nonebot test frontend...")
171             nonebot_test.init()
172 
173     if scheduler:
174         _driver.on_startup(_start_scheduler)
175 
176 
177 def run(host: Optional[str] = None,
178         port: Optional[int] = None,
179         *args,
180         **kwargs):
181     """
182     :说明:
183 
184       启动 NoneBot，即运行全局 Driver 对象。
185 
186     :参数:
187 
188       * ``host: Optional[str]``: 主机名／IP，若不传入则使用配置文件中指定的值
189       * ``port: Optional[int]``: 端口，若不传入则使用配置文件中指定的值
190       * ``*args``: 传入 Driver.run 的位置参数
191       * ``**kwargs``: 传入 Driver.run 的命名参数
192 
193     :返回:
194 
195       - ``None``
196 
197     :用法:
198 
199     .. code-block:: python
200 
201         nonebot.run(host="127.0.0.1", port=8080)
202 
203     """
204     logger.info("Running NoneBot...")
205     get_driver().run(host, port, *args, **kwargs)
206 
207 
208 async def _start_scheduler():
209     if scheduler and not scheduler.running:
210         scheduler.configure(_driver.config.apscheduler_config)
211         scheduler.start()
212         logger.opt(colors=True).info("<y>Scheduler Started</y>")
213 
214 
215 from nonebot.plugin import on_message, on_notice, on_request, on_metaevent
216 from nonebot.plugin import on_startswith, on_endswith, on_command, on_regex, CommandGroup
217 from nonebot.plugin import load_plugin, load_plugins, load_builtin_plugins, get_loaded_plugins
218
```

Path: `nonebot/message.py`
Content:
```
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 
4 import asyncio
5 from datetime import datetime
6 
7 from nonebot.log import logger
8 from nonebot.rule import TrieRule
9 from nonebot.matcher import matchers
10 from nonebot.typing import Set, Type, Union, NoReturn
11 from nonebot.typing import Bot, Event, Matcher, PreProcessor
12 from nonebot.exception import IgnoredException, ExpiredException
13 from nonebot.exception import StopPropagation, _ExceptionContainer
14 
15 _event_preprocessors: Set[PreProcessor] = set()
16 
17 
18 def event_preprocessor(func: PreProcessor) -> PreProcessor:
19     _event_preprocessors.add(func)
20     return func
21 
22 
23 async def _run_matcher(Matcher: Type[Matcher], bot: Bot, event: Event,
24                        state: dict) -> Union[None, NoReturn]:
25     if Matcher.expire_time and datetime.now() > Matcher.expire_time:
26         raise _ExceptionContainer([ExpiredException])
27 
28     try:
29         if not await Matcher.check_perm(
30                 bot, event) or not await Matcher.check_rule(bot, event, state):
31             return
32     except Exception as e:
33         logger.opt(colors=True, exception=e).error(
34             f"<r><bg #f8bbd0>Rule check failed for {Matcher}.</bg #f8bbd0></r>")
35         return
36 
37     logger.info(f"Event will be handled by {Matcher}")
38 
39     matcher = Matcher()
40     # TODO: BeforeMatcherRun
41     try:
42         logger.debug(f"Running matcher {matcher}")
43         await matcher.run(bot, event, state)
44     except Exception as e:
45         logger.opt(colors=True, exception=e).error(
46             f"<r><bg #f8bbd0>Running matcher {matcher} failed.</bg #f8bbd0></r>"
47         )
48 
49     exceptions = []
50     if Matcher.temp:
51         exceptions.append(ExpiredException)
52     if Matcher.block:
53         exceptions.append(StopPropagation)
54     if exceptions:
55         raise _ExceptionContainer(exceptions)
56 
57 
58 async def handle_event(bot: Bot, event: Event):
59     log_msg = f"<m>{bot.type.upper()} </m>| {event.self_id} [{event.name}]: "
60     if event.type == "message":
61         log_msg += f"Message {event.id} from "
62         log_msg += str(event.user_id)
63         if event.detail_type == "group":
64             log_msg += f"@[群:{event.group_id}]:"
65 
66         log_msg += ' "' + "".join(
67             map(lambda x: str(x) if x.type == "text" else f"<le>{x!s}</le>",
68                 event.message)) + '"'  # type: ignore
69     elif event.type == "notice":
70         log_msg += f"Notice {event.raw_event}"
71     elif event.type == "request":
72         log_msg += f"Request {event.raw_event}"
73     elif event.type == "meta_event":
74         log_msg += f"MetaEvent {event.raw_event}"
75     logger.opt(colors=True).info(log_msg)
76 
77     coros = []
78     state = {}
79     for preprocessor in _event_preprocessors:
80         coros.append(preprocessor(bot, event, state))
81     if coros:
82         try:
83             logger.debug("Running PreProcessors...")
84             await asyncio.gather(*coros)
85         except IgnoredException:
86             logger.opt(
87                 colors=True).info(f"Event {event.name} is <b>ignored</b>")
88             return
89 
90     # Trie Match
91     _, _ = TrieRule.get_value(bot, event, state)
92 
93     break_flag = False
94     for priority in sorted(matchers.keys()):
95         if break_flag:
96             break
97 
98         pending_tasks = [
99             _run_matcher(matcher, bot, event, state.copy())
100             for matcher in matchers[priority]
101         ]
102 
103         logger.debug(f"Checking for matchers in priority {priority}...")
104         results = await asyncio.gather(*pending_tasks, return_exceptions=True)
105 
106         i = 0
107         for index, result in enumerate(results):
108             if isinstance(result, _ExceptionContainer):
109                 e_list = result.exceptions
110                 if StopPropagation in e_list:
111                     if not break_flag:
112                         break_flag = True
113                         logger.debug("Stop event propagation")
114                 if ExpiredException in e_list:
115                     logger.debug(
116                         f"Matcher {matchers[priority][index - i]} will be removed."
117                     )
118                     del matchers[priority][index - i]
119                     i += 1
120
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/nonebot/__init__.py b/nonebot/__init__.py
--- a/nonebot/__init__.py
+++ b/nonebot/__init__.py
@@ -109,6 +109,7 @@
 
 
 from nonebot.sched import scheduler
+from nonebot.utils import escape_tag
 from nonebot.config import Env, Config
 from nonebot.log import logger, default_filter
 from nonebot.adapters.cqhttp import Bot as CQBot
@@ -155,8 +156,8 @@
                         _env_file=_env_file or f".env.{env.environment}")
 
         default_filter.level = "DEBUG" if config.debug else "INFO"
-        logger.opt(
-            colors=True).debug(f"Loaded <y><b>Config</b></y>: {config.dict()}")
+        logger.opt(colors=True).debug(
+            f"Loaded <y><b>Config</b></y>: {escape_tag(str(config.dict()))}")
 
         DriverClass: Type[Driver] = getattr(
             importlib.import_module(config.driver), "Driver")
diff --git a/nonebot/message.py b/nonebot/message.py
--- a/nonebot/message.py
+++ b/nonebot/message.py
@@ -6,6 +6,7 @@
 
 from nonebot.log import logger
 from nonebot.rule import TrieRule
+from nonebot.utils import escape_tag
 from nonebot.matcher import matchers
 from nonebot.typing import Set, Type, Union, NoReturn
 from nonebot.typing import Bot, Event, Matcher, PreProcessor
@@ -64,7 +65,9 @@
             log_msg += f"@[群:{event.group_id}]:"
 
         log_msg += ' "' + "".join(
-            map(lambda x: str(x) if x.type == "text" else f"<le>{x!s}</le>",
+            map(
+                lambda x: escape_tag(str(x))
+                if x.type == "text" else f"<le>{escape_tag(str(x))}</le>",
                 event.message)) + '"'  # type: ignore
     elif event.type == "notice":
         log_msg += f"Notice {event.raw_event}"
diff --git a/nonebot/utils.py b/nonebot/utils.py
--- a/nonebot/utils.py
+++ b/nonebot/utils.py
@@ -1,6 +1,7 @@
 #!/usr/bin/env python3
 # -*- coding: utf-8 -*-
 
+import re
 import json
 import asyncio
 import dataclasses
@@ -9,6 +10,10 @@
 from nonebot.typing import Any, Callable, Awaitable, overrides
 
 
+def escape_tag(s: str) -> str:
+    return re.sub(r"</?((?:[fb]g\s)?[^<>\s]*)>", r"\\\g<0>", s)
+
+
 def run_sync(func: Callable[..., Any]) -> Callable[..., Awaitable[Any]]:
     """
     :说明:

{"golden_diff": "diff --git a/nonebot/__init__.py b/nonebot/__init__.py\n--- a/nonebot/__init__.py\n+++ b/nonebot/__init__.py\n@@ -109,6 +109,7 @@\n \n \n from nonebot.sched import scheduler\n+from nonebot.utils import escape_tag\n from nonebot.config import Env, Config\n from nonebot.log import logger, default_filter\n from nonebot.adapters.cqhttp import Bot as CQBot\n@@ -155,8 +156,8 @@\n                         _env_file=_env_file or f\".env.{env.environment}\")\n \n         default_filter.level = \"DEBUG\" if config.debug else \"INFO\"\n-        logger.opt(\n-            colors=True).debug(f\"Loaded <y><b>Config</b></y>: {config.dict()}\")\n+        logger.opt(colors=True).debug(\n+            f\"Loaded <y><b>Config</b></y>: {escape_tag(str(config.dict()))}\")\n \n         DriverClass: Type[Driver] = getattr(\n             importlib.import_module(config.driver), \"Driver\")\ndiff --git a/nonebot/message.py b/nonebot/message.py\n--- a/nonebot/message.py\n+++ b/nonebot/message.py\n@@ -6,6 +6,7 @@\n \n from nonebot.log import logger\n from nonebot.rule import TrieRule\n+from nonebot.utils import escape_tag\n from nonebot.matcher import matchers\n from nonebot.typing import Set, Type, Union, NoReturn\n from nonebot.typing import Bot, Event, Matcher, PreProcessor\n@@ -64,7 +65,9 @@\n             log_msg += f\"@[\u7fa4:{event.group_id}]:\"\n \n         log_msg += ' \"' + \"\".join(\n-            map(lambda x: str(x) if x.type == \"text\" else f\"<le>{x!s}</le>\",\n+            map(\n+                lambda x: escape_tag(str(x))\n+                if x.type == \"text\" else f\"<le>{escape_tag(str(x))}</le>\",\n                 event.message)) + '\"'  # type: ignore\n     elif event.type == \"notice\":\n         log_msg += f\"Notice {event.raw_event}\"\ndiff --git a/nonebot/utils.py b/nonebot/utils.py\n--- a/nonebot/utils.py\n+++ b/nonebot/utils.py\n@@ -1,6 +1,7 @@\n #!/usr/bin/env python3\n # -*- coding: utf-8 -*-\n \n+import re\n import json\n import asyncio\n import dataclasses\n@@ -9,6 +10,10 @@\n from nonebot.typing import Any, Callable, Awaitable, overrides\n \n \n+def escape_tag(s: str) -> str:\n+    return re.sub(r\"</?((?:[fb]g\\s)?[^<>\\s]*)>\", r\"\\\\\\g<0>\", s)\n+\n+\n def run_sync(func: Callable[..., Any]) -> Callable[..., Awaitable[Any]]:\n     \"\"\"\n     :\u8bf4\u660e:\n", "issue": "\u5728 nonebot-test \u524d\u7aef\u8c03\u8bd5\u65f6\u65e0\u6cd5\u8ba9 Bot \u8bf4\u51fa <test>\nnonebot.load_builtin_plugins() \u540e\uff0c\u5728 nonebot-test \u524d\u7aef\u5411 Bot \u53d1\u9001 /say <test> \r\n\r\nBot \u672a\u53d1\u9001\u4efb\u4f55\u6d88\u606f\uff0c\u4e14 nonebot2 \u63a7\u5236\u53f0\u8fd4\u56de\uff1a\r\n\r\n```\r\n[ERROR] nonebot_test | Tag \"<test>\" does not corespond to any known ansi directive, make sure you did not misspelled it (or prepend '\\' to escape it)\r\n```\n", "before_files": [{"content": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\nimport json\nimport asyncio\nimport dataclasses\nfrom functools import wraps, partial\n\nfrom nonebot.typing import Any, Callable, Awaitable, overrides\n\n\ndef run_sync(func: Callable[..., Any]) -> Callable[..., Awaitable[Any]]:\n    \"\"\"\n    :\u8bf4\u660e:\n      \u4e00\u4e2a\u7528\u4e8e\u5305\u88c5 sync function \u4e3a async function \u7684\u88c5\u9970\u5668\n    :\u53c2\u6570:\n      * ``func: Callable[..., Any]``: \u88ab\u88c5\u9970\u7684\u540c\u6b65\u51fd\u6570\n    :\u8fd4\u56de:\n      - ``Callable[..., Awaitable[Any]]``\n    \"\"\"\n\n    @wraps(func)\n    async def _wrapper(*args: Any, **kwargs: Any) -> Any:\n        loop = asyncio.get_running_loop()\n        pfunc = partial(func, *args, **kwargs)\n        result = await loop.run_in_executor(None, pfunc)\n        return result\n\n    return _wrapper\n\n\nclass DataclassEncoder(json.JSONEncoder):\n    \"\"\"\n    :\u8bf4\u660e:\n      \u5728JSON\u5e8f\u5217\u5316 ``Message`` (List[Dataclass]) \u65f6\u4f7f\u7528\u7684 ``JSONEncoder``\n    \"\"\"\n\n    @overrides(json.JSONEncoder)\n    def default(self, o):\n        if dataclasses.is_dataclass(o):\n            return dataclasses.asdict(o)\n        return super().default(o)\n", "path": "nonebot/utils.py"}, {"content": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\nimport importlib\nfrom nonebot.typing import Bot, Dict, Type, Union, Driver, Optional, NoReturn\n\n_driver: Optional[Driver] = None\n\n\ndef get_driver() -> Union[NoReturn, Driver]:\n    \"\"\"\n    :\u8bf4\u660e:\n\n      \u83b7\u53d6\u5168\u5c40 Driver \u5bf9\u8c61\u3002\u53ef\u7528\u4e8e\u5728\u8ba1\u5212\u4efb\u52a1\u7684\u56de\u8c03\u4e2d\u83b7\u53d6\u5f53\u524d Driver \u5bf9\u8c61\u3002\n\n    :\u8fd4\u56de:\n\n      * ``Driver``: \u5168\u5c40 Driver \u5bf9\u8c61\n\n    :\u5f02\u5e38:\n\n      * ``ValueError``: \u5168\u5c40 Driver \u5bf9\u8c61\u5c1a\u672a\u521d\u59cb\u5316 (nonebot.init \u5c1a\u672a\u8c03\u7528)\n\n    :\u7528\u6cd5:\n\n    .. code-block:: python\n\n        driver = nonebot.get_driver()\n\n    \"\"\"\n    if _driver is None:\n        raise ValueError(\"NoneBot has not been initialized.\")\n    return _driver\n\n\ndef get_app():\n    \"\"\"\n    :\u8bf4\u660e:\n\n      \u83b7\u53d6\u5168\u5c40 Driver \u5bf9\u5e94 Server App \u5bf9\u8c61\u3002\n\n    :\u8fd4\u56de:\n\n      * ``Any``: Server App \u5bf9\u8c61\n\n    :\u5f02\u5e38:\n\n      * ``ValueError``: \u5168\u5c40 Driver \u5bf9\u8c61\u5c1a\u672a\u521d\u59cb\u5316 (nonebot.init \u5c1a\u672a\u8c03\u7528)\n\n    :\u7528\u6cd5:\n\n    .. code-block:: python\n\n        app = nonebot.get_app()\n\n    \"\"\"\n    driver = get_driver()\n    return driver.server_app\n\n\ndef get_asgi():\n    \"\"\"\n    :\u8bf4\u660e:\n\n      \u83b7\u53d6\u5168\u5c40 Driver \u5bf9\u5e94 Asgi \u5bf9\u8c61\u3002\n\n    :\u8fd4\u56de:\n\n      * ``Any``: Asgi \u5bf9\u8c61\n\n    :\u5f02\u5e38:\n\n      * ``ValueError``: \u5168\u5c40 Driver \u5bf9\u8c61\u5c1a\u672a\u521d\u59cb\u5316 (nonebot.init \u5c1a\u672a\u8c03\u7528)\n\n    :\u7528\u6cd5:\n\n    .. code-block:: python\n\n        asgi = nonebot.get_asgi()\n\n    \"\"\"\n    driver = get_driver()\n    return driver.asgi\n\n\ndef get_bots() -> Union[NoReturn, Dict[str, Bot]]:\n    \"\"\"\n    :\u8bf4\u660e:\n\n      \u83b7\u53d6\u6240\u6709\u901a\u8fc7 ws \u8fde\u63a5 NoneBot \u7684 Bot \u5bf9\u8c61\u3002\n\n    :\u8fd4\u56de:\n\n      * ``Dict[str, Bot]``: \u4e00\u4e2a\u4ee5\u5b57\u7b26\u4e32 ID \u4e3a\u952e\uff0cBot \u5bf9\u8c61\u4e3a\u503c\u7684\u5b57\u5178\n\n    :\u5f02\u5e38:\n\n      * ``ValueError``: \u5168\u5c40 Driver \u5bf9\u8c61\u5c1a\u672a\u521d\u59cb\u5316 (nonebot.init \u5c1a\u672a\u8c03\u7528)\n\n    :\u7528\u6cd5:\n\n    .. code-block:: python\n\n        bots = nonebot.get_bots()\n\n    \"\"\"\n    driver = get_driver()\n    return driver.bots\n\n\nfrom nonebot.sched import scheduler\nfrom nonebot.config import Env, Config\nfrom nonebot.log import logger, default_filter\nfrom nonebot.adapters.cqhttp import Bot as CQBot\n\ntry:\n    import nonebot_test\nexcept ImportError:\n    nonebot_test = None\n\n\ndef init(*, _env_file: Optional[str] = None, **kwargs):\n    \"\"\"\n    :\u8bf4\u660e:\n\n      \u521d\u59cb\u5316 NoneBot \u4ee5\u53ca \u5168\u5c40 Driver \u5bf9\u8c61\u3002\n\n      NoneBot \u5c06\u4f1a\u4ece .env \u6587\u4ef6\u4e2d\u8bfb\u53d6\u73af\u5883\u4fe1\u606f\uff0c\u5e76\u4f7f\u7528\u76f8\u5e94\u7684 env \u6587\u4ef6\u914d\u7f6e\u3002\n\n      \u4f60\u4e5f\u53ef\u4ee5\u4f20\u5165\u81ea\u5b9a\u4e49\u7684 _env_file \u6765\u6307\u5b9a NoneBot \u4ece\u8be5\u6587\u4ef6\u8bfb\u53d6\u914d\u7f6e\u3002\n\n    :\u53c2\u6570:\n\n      * ``_env_file: Optional[str]``: \u914d\u7f6e\u6587\u4ef6\u540d\uff0c\u9ed8\u8ba4\u4ece .env.{env_name} \u4e2d\u8bfb\u53d6\u914d\u7f6e\n      * ``**kwargs``: \u4efb\u610f\u53d8\u91cf\uff0c\u5c06\u4f1a\u5b58\u50a8\u5230 Config \u5bf9\u8c61\u91cc\n\n    :\u8fd4\u56de:\n\n      - ``None``\n\n    :\u7528\u6cd5:\n\n    .. code-block:: python\n\n        nonebot.init(database=Database(...))\n\n    \"\"\"\n    global _driver\n    if not _driver:\n        logger.info(\"NoneBot is initializing...\")\n        env = Env()\n        logger.opt(\n            colors=True).info(f\"Current <y><b>Env: {env.environment}</b></y>\")\n        config = Config(**kwargs,\n                        _env_file=_env_file or f\".env.{env.environment}\")\n\n        default_filter.level = \"DEBUG\" if config.debug else \"INFO\"\n        logger.opt(\n            colors=True).debug(f\"Loaded <y><b>Config</b></y>: {config.dict()}\")\n\n        DriverClass: Type[Driver] = getattr(\n            importlib.import_module(config.driver), \"Driver\")\n        _driver = DriverClass(env, config)\n\n        # register build-in adapters\n        _driver.register_adapter(\"cqhttp\", CQBot)\n\n        # load nonebot test frontend if debug\n        if config.debug and nonebot_test:\n            logger.debug(\"Loading nonebot test frontend...\")\n            nonebot_test.init()\n\n    if scheduler:\n        _driver.on_startup(_start_scheduler)\n\n\ndef run(host: Optional[str] = None,\n        port: Optional[int] = None,\n        *args,\n        **kwargs):\n    \"\"\"\n    :\u8bf4\u660e:\n\n      \u542f\u52a8 NoneBot\uff0c\u5373\u8fd0\u884c\u5168\u5c40 Driver \u5bf9\u8c61\u3002\n\n    :\u53c2\u6570:\n\n      * ``host: Optional[str]``: \u4e3b\u673a\u540d\uff0fIP\uff0c\u82e5\u4e0d\u4f20\u5165\u5219\u4f7f\u7528\u914d\u7f6e\u6587\u4ef6\u4e2d\u6307\u5b9a\u7684\u503c\n      * ``port: Optional[int]``: \u7aef\u53e3\uff0c\u82e5\u4e0d\u4f20\u5165\u5219\u4f7f\u7528\u914d\u7f6e\u6587\u4ef6\u4e2d\u6307\u5b9a\u7684\u503c\n      * ``*args``: \u4f20\u5165 Driver.run \u7684\u4f4d\u7f6e\u53c2\u6570\n      * ``**kwargs``: \u4f20\u5165 Driver.run \u7684\u547d\u540d\u53c2\u6570\n\n    :\u8fd4\u56de:\n\n      - ``None``\n\n    :\u7528\u6cd5:\n\n    .. code-block:: python\n\n        nonebot.run(host=\"127.0.0.1\", port=8080)\n\n    \"\"\"\n    logger.info(\"Running NoneBot...\")\n    get_driver().run(host, port, *args, **kwargs)\n\n\nasync def _start_scheduler():\n    if scheduler and not scheduler.running:\n        scheduler.configure(_driver.config.apscheduler_config)\n        scheduler.start()\n        logger.opt(colors=True).info(\"<y>Scheduler Started</y>\")\n\n\nfrom nonebot.plugin import on_message, on_notice, on_request, on_metaevent\nfrom nonebot.plugin import on_startswith, on_endswith, on_command, on_regex, CommandGroup\nfrom nonebot.plugin import load_plugin, load_plugins, load_builtin_plugins, get_loaded_plugins\n", "path": "nonebot/__init__.py"}, {"content": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\nimport asyncio\nfrom datetime import datetime\n\nfrom nonebot.log import logger\nfrom nonebot.rule import TrieRule\nfrom nonebot.matcher import matchers\nfrom nonebot.typing import Set, Type, Union, NoReturn\nfrom nonebot.typing import Bot, Event, Matcher, PreProcessor\nfrom nonebot.exception import IgnoredException, ExpiredException\nfrom nonebot.exception import StopPropagation, _ExceptionContainer\n\n_event_preprocessors: Set[PreProcessor] = set()\n\n\ndef event_preprocessor(func: PreProcessor) -> PreProcessor:\n    _event_preprocessors.add(func)\n    return func\n\n\nasync def _run_matcher(Matcher: Type[Matcher], bot: Bot, event: Event,\n                       state: dict) -> Union[None, NoReturn]:\n    if Matcher.expire_time and datetime.now() > Matcher.expire_time:\n        raise _ExceptionContainer([ExpiredException])\n\n    try:\n        if not await Matcher.check_perm(\n                bot, event) or not await Matcher.check_rule(bot, event, state):\n            return\n    except Exception as e:\n        logger.opt(colors=True, exception=e).error(\n            f\"<r><bg #f8bbd0>Rule check failed for {Matcher}.</bg #f8bbd0></r>\")\n        return\n\n    logger.info(f\"Event will be handled by {Matcher}\")\n\n    matcher = Matcher()\n    # TODO: BeforeMatcherRun\n    try:\n        logger.debug(f\"Running matcher {matcher}\")\n        await matcher.run(bot, event, state)\n    except Exception as e:\n        logger.opt(colors=True, exception=e).error(\n            f\"<r><bg #f8bbd0>Running matcher {matcher} failed.</bg #f8bbd0></r>\"\n        )\n\n    exceptions = []\n    if Matcher.temp:\n        exceptions.append(ExpiredException)\n    if Matcher.block:\n        exceptions.append(StopPropagation)\n    if exceptions:\n        raise _ExceptionContainer(exceptions)\n\n\nasync def handle_event(bot: Bot, event: Event):\n    log_msg = f\"<m>{bot.type.upper()} </m>| {event.self_id} [{event.name}]: \"\n    if event.type == \"message\":\n        log_msg += f\"Message {event.id} from \"\n        log_msg += str(event.user_id)\n        if event.detail_type == \"group\":\n            log_msg += f\"@[\u7fa4:{event.group_id}]:\"\n\n        log_msg += ' \"' + \"\".join(\n            map(lambda x: str(x) if x.type == \"text\" else f\"<le>{x!s}</le>\",\n                event.message)) + '\"'  # type: ignore\n    elif event.type == \"notice\":\n        log_msg += f\"Notice {event.raw_event}\"\n    elif event.type == \"request\":\n        log_msg += f\"Request {event.raw_event}\"\n    elif event.type == \"meta_event\":\n        log_msg += f\"MetaEvent {event.raw_event}\"\n    logger.opt(colors=True).info(log_msg)\n\n    coros = []\n    state = {}\n    for preprocessor in _event_preprocessors:\n        coros.append(preprocessor(bot, event, state))\n    if coros:\n        try:\n            logger.debug(\"Running PreProcessors...\")\n            await asyncio.gather(*coros)\n        except IgnoredException:\n            logger.opt(\n                colors=True).info(f\"Event {event.name} is <b>ignored</b>\")\n            return\n\n    # Trie Match\n    _, _ = TrieRule.get_value(bot, event, state)\n\n    break_flag = False\n    for priority in sorted(matchers.keys()):\n        if break_flag:\n            break\n\n        pending_tasks = [\n            _run_matcher(matcher, bot, event, state.copy())\n            for matcher in matchers[priority]\n        ]\n\n        logger.debug(f\"Checking for matchers in priority {priority}...\")\n        results = await asyncio.gather(*pending_tasks, return_exceptions=True)\n\n        i = 0\n        for index, result in enumerate(results):\n            if isinstance(result, _ExceptionContainer):\n                e_list = result.exceptions\n                if StopPropagation in e_list:\n                    if not break_flag:\n                        break_flag = True\n                        logger.debug(\"Stop event propagation\")\n                if ExpiredException in e_list:\n                    logger.debug(\n                        f\"Matcher {matchers[priority][index - i]} will be removed.\"\n                    )\n                    del matchers[priority][index - i]\n                    i += 1\n", "path": "nonebot/message.py"}], "after_files": [{"content": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\nimport re\nimport json\nimport asyncio\nimport dataclasses\nfrom functools import wraps, partial\n\nfrom nonebot.typing import Any, Callable, Awaitable, overrides\n\n\ndef escape_tag(s: str) -> str:\n    return re.sub(r\"</?((?:[fb]g\\s)?[^<>\\s]*)>\", r\"\\\\\\g<0>\", s)\n\n\ndef run_sync(func: Callable[..., Any]) -> Callable[..., Awaitable[Any]]:\n    \"\"\"\n    :\u8bf4\u660e:\n      \u4e00\u4e2a\u7528\u4e8e\u5305\u88c5 sync function \u4e3a async function \u7684\u88c5\u9970\u5668\n    :\u53c2\u6570:\n      * ``func: Callable[..., Any]``: \u88ab\u88c5\u9970\u7684\u540c\u6b65\u51fd\u6570\n    :\u8fd4\u56de:\n      - ``Callable[..., Awaitable[Any]]``\n    \"\"\"\n\n    @wraps(func)\n    async def _wrapper(*args: Any, **kwargs: Any) -> Any:\n        loop = asyncio.get_running_loop()\n        pfunc = partial(func, *args, **kwargs)\n        result = await loop.run_in_executor(None, pfunc)\n        return result\n\n    return _wrapper\n\n\nclass DataclassEncoder(json.JSONEncoder):\n    \"\"\"\n    :\u8bf4\u660e:\n      \u5728JSON\u5e8f\u5217\u5316 ``Message`` (List[Dataclass]) \u65f6\u4f7f\u7528\u7684 ``JSONEncoder``\n    \"\"\"\n\n    @overrides(json.JSONEncoder)\n    def default(self, o):\n        if dataclasses.is_dataclass(o):\n            return dataclasses.asdict(o)\n        return super().default(o)\n", "path": "nonebot/utils.py"}, {"content": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\nimport importlib\nfrom nonebot.typing import Bot, Dict, Type, Union, Driver, Optional, NoReturn\n\n_driver: Optional[Driver] = None\n\n\ndef get_driver() -> Union[NoReturn, Driver]:\n    \"\"\"\n    :\u8bf4\u660e:\n\n      \u83b7\u53d6\u5168\u5c40 Driver \u5bf9\u8c61\u3002\u53ef\u7528\u4e8e\u5728\u8ba1\u5212\u4efb\u52a1\u7684\u56de\u8c03\u4e2d\u83b7\u53d6\u5f53\u524d Driver \u5bf9\u8c61\u3002\n\n    :\u8fd4\u56de:\n\n      * ``Driver``: \u5168\u5c40 Driver \u5bf9\u8c61\n\n    :\u5f02\u5e38:\n\n      * ``ValueError``: \u5168\u5c40 Driver \u5bf9\u8c61\u5c1a\u672a\u521d\u59cb\u5316 (nonebot.init \u5c1a\u672a\u8c03\u7528)\n\n    :\u7528\u6cd5:\n\n    .. code-block:: python\n\n        driver = nonebot.get_driver()\n\n    \"\"\"\n    if _driver is None:\n        raise ValueError(\"NoneBot has not been initialized.\")\n    return _driver\n\n\ndef get_app():\n    \"\"\"\n    :\u8bf4\u660e:\n\n      \u83b7\u53d6\u5168\u5c40 Driver \u5bf9\u5e94 Server App \u5bf9\u8c61\u3002\n\n    :\u8fd4\u56de:\n\n      * ``Any``: Server App \u5bf9\u8c61\n\n    :\u5f02\u5e38:\n\n      * ``ValueError``: \u5168\u5c40 Driver \u5bf9\u8c61\u5c1a\u672a\u521d\u59cb\u5316 (nonebot.init \u5c1a\u672a\u8c03\u7528)\n\n    :\u7528\u6cd5:\n\n    .. code-block:: python\n\n        app = nonebot.get_app()\n\n    \"\"\"\n    driver = get_driver()\n    return driver.server_app\n\n\ndef get_asgi():\n    \"\"\"\n    :\u8bf4\u660e:\n\n      \u83b7\u53d6\u5168\u5c40 Driver \u5bf9\u5e94 Asgi \u5bf9\u8c61\u3002\n\n    :\u8fd4\u56de:\n\n      * ``Any``: Asgi \u5bf9\u8c61\n\n    :\u5f02\u5e38:\n\n      * ``ValueError``: \u5168\u5c40 Driver \u5bf9\u8c61\u5c1a\u672a\u521d\u59cb\u5316 (nonebot.init \u5c1a\u672a\u8c03\u7528)\n\n    :\u7528\u6cd5:\n\n    .. code-block:: python\n\n        asgi = nonebot.get_asgi()\n\n    \"\"\"\n    driver = get_driver()\n    return driver.asgi\n\n\ndef get_bots() -> Union[NoReturn, Dict[str, Bot]]:\n    \"\"\"\n    :\u8bf4\u660e:\n\n      \u83b7\u53d6\u6240\u6709\u901a\u8fc7 ws \u8fde\u63a5 NoneBot \u7684 Bot \u5bf9\u8c61\u3002\n\n    :\u8fd4\u56de:\n\n      * ``Dict[str, Bot]``: \u4e00\u4e2a\u4ee5\u5b57\u7b26\u4e32 ID \u4e3a\u952e\uff0cBot \u5bf9\u8c61\u4e3a\u503c\u7684\u5b57\u5178\n\n    :\u5f02\u5e38:\n\n      * ``ValueError``: \u5168\u5c40 Driver \u5bf9\u8c61\u5c1a\u672a\u521d\u59cb\u5316 (nonebot.init \u5c1a\u672a\u8c03\u7528)\n\n    :\u7528\u6cd5:\n\n    .. code-block:: python\n\n        bots = nonebot.get_bots()\n\n    \"\"\"\n    driver = get_driver()\n    return driver.bots\n\n\nfrom nonebot.sched import scheduler\nfrom nonebot.utils import escape_tag\nfrom nonebot.config import Env, Config\nfrom nonebot.log import logger, default_filter\nfrom nonebot.adapters.cqhttp import Bot as CQBot\n\ntry:\n    import nonebot_test\nexcept ImportError:\n    nonebot_test = None\n\n\ndef init(*, _env_file: Optional[str] = None, **kwargs):\n    \"\"\"\n    :\u8bf4\u660e:\n\n      \u521d\u59cb\u5316 NoneBot \u4ee5\u53ca \u5168\u5c40 Driver \u5bf9\u8c61\u3002\n\n      NoneBot \u5c06\u4f1a\u4ece .env \u6587\u4ef6\u4e2d\u8bfb\u53d6\u73af\u5883\u4fe1\u606f\uff0c\u5e76\u4f7f\u7528\u76f8\u5e94\u7684 env \u6587\u4ef6\u914d\u7f6e\u3002\n\n      \u4f60\u4e5f\u53ef\u4ee5\u4f20\u5165\u81ea\u5b9a\u4e49\u7684 _env_file \u6765\u6307\u5b9a NoneBot \u4ece\u8be5\u6587\u4ef6\u8bfb\u53d6\u914d\u7f6e\u3002\n\n    :\u53c2\u6570:\n\n      * ``_env_file: Optional[str]``: \u914d\u7f6e\u6587\u4ef6\u540d\uff0c\u9ed8\u8ba4\u4ece .env.{env_name} \u4e2d\u8bfb\u53d6\u914d\u7f6e\n      * ``**kwargs``: \u4efb\u610f\u53d8\u91cf\uff0c\u5c06\u4f1a\u5b58\u50a8\u5230 Config \u5bf9\u8c61\u91cc\n\n    :\u8fd4\u56de:\n\n      - ``None``\n\n    :\u7528\u6cd5:\n\n    .. code-block:: python\n\n        nonebot.init(database=Database(...))\n\n    \"\"\"\n    global _driver\n    if not _driver:\n        logger.info(\"NoneBot is initializing...\")\n        env = Env()\n        logger.opt(\n            colors=True).info(f\"Current <y><b>Env: {env.environment}</b></y>\")\n        config = Config(**kwargs,\n                        _env_file=_env_file or f\".env.{env.environment}\")\n\n        default_filter.level = \"DEBUG\" if config.debug else \"INFO\"\n        logger.opt(colors=True).debug(\n            f\"Loaded <y><b>Config</b></y>: {escape_tag(str(config.dict()))}\")\n\n        DriverClass: Type[Driver] = getattr(\n            importlib.import_module(config.driver), \"Driver\")\n        _driver = DriverClass(env, config)\n\n        # register build-in adapters\n        _driver.register_adapter(\"cqhttp\", CQBot)\n\n        # load nonebot test frontend if debug\n        if config.debug and nonebot_test:\n            logger.debug(\"Loading nonebot test frontend...\")\n            nonebot_test.init()\n\n    if scheduler:\n        _driver.on_startup(_start_scheduler)\n\n\ndef run(host: Optional[str] = None,\n        port: Optional[int] = None,\n        *args,\n        **kwargs):\n    \"\"\"\n    :\u8bf4\u660e:\n\n      \u542f\u52a8 NoneBot\uff0c\u5373\u8fd0\u884c\u5168\u5c40 Driver \u5bf9\u8c61\u3002\n\n    :\u53c2\u6570:\n\n      * ``host: Optional[str]``: \u4e3b\u673a\u540d\uff0fIP\uff0c\u82e5\u4e0d\u4f20\u5165\u5219\u4f7f\u7528\u914d\u7f6e\u6587\u4ef6\u4e2d\u6307\u5b9a\u7684\u503c\n      * ``port: Optional[int]``: \u7aef\u53e3\uff0c\u82e5\u4e0d\u4f20\u5165\u5219\u4f7f\u7528\u914d\u7f6e\u6587\u4ef6\u4e2d\u6307\u5b9a\u7684\u503c\n      * ``*args``: \u4f20\u5165 Driver.run \u7684\u4f4d\u7f6e\u53c2\u6570\n      * ``**kwargs``: \u4f20\u5165 Driver.run \u7684\u547d\u540d\u53c2\u6570\n\n    :\u8fd4\u56de:\n\n      - ``None``\n\n    :\u7528\u6cd5:\n\n    .. code-block:: python\n\n        nonebot.run(host=\"127.0.0.1\", port=8080)\n\n    \"\"\"\n    logger.info(\"Running NoneBot...\")\n    get_driver().run(host, port, *args, **kwargs)\n\n\nasync def _start_scheduler():\n    if scheduler and not scheduler.running:\n        scheduler.configure(_driver.config.apscheduler_config)\n        scheduler.start()\n        logger.opt(colors=True).info(\"<y>Scheduler Started</y>\")\n\n\nfrom nonebot.plugin import on_message, on_notice, on_request, on_metaevent\nfrom nonebot.plugin import on_startswith, on_endswith, on_command, on_regex, CommandGroup\nfrom nonebot.plugin import load_plugin, load_plugins, load_builtin_plugins, get_loaded_plugins\n", "path": "nonebot/__init__.py"}, {"content": "#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\nimport asyncio\nfrom datetime import datetime\n\nfrom nonebot.log import logger\nfrom nonebot.rule import TrieRule\nfrom nonebot.utils import escape_tag\nfrom nonebot.matcher import matchers\nfrom nonebot.typing import Set, Type, Union, NoReturn\nfrom nonebot.typing import Bot, Event, Matcher, PreProcessor\nfrom nonebot.exception import IgnoredException, ExpiredException\nfrom nonebot.exception import StopPropagation, _ExceptionContainer\n\n_event_preprocessors: Set[PreProcessor] = set()\n\n\ndef event_preprocessor(func: PreProcessor) -> PreProcessor:\n    _event_preprocessors.add(func)\n    return func\n\n\nasync def _run_matcher(Matcher: Type[Matcher], bot: Bot, event: Event,\n                       state: dict) -> Union[None, NoReturn]:\n    if Matcher.expire_time and datetime.now() > Matcher.expire_time:\n        raise _ExceptionContainer([ExpiredException])\n\n    try:\n        if not await Matcher.check_perm(\n                bot, event) or not await Matcher.check_rule(bot, event, state):\n            return\n    except Exception as e:\n        logger.opt(colors=True, exception=e).error(\n            f\"<r><bg #f8bbd0>Rule check failed for {Matcher}.</bg #f8bbd0></r>\")\n        return\n\n    logger.info(f\"Event will be handled by {Matcher}\")\n\n    matcher = Matcher()\n    # TODO: BeforeMatcherRun\n    try:\n        logger.debug(f\"Running matcher {matcher}\")\n        await matcher.run(bot, event, state)\n    except Exception as e:\n        logger.opt(colors=True, exception=e).error(\n            f\"<r><bg #f8bbd0>Running matcher {matcher} failed.</bg #f8bbd0></r>\"\n        )\n\n    exceptions = []\n    if Matcher.temp:\n        exceptions.append(ExpiredException)\n    if Matcher.block:\n        exceptions.append(StopPropagation)\n    if exceptions:\n        raise _ExceptionContainer(exceptions)\n\n\nasync def handle_event(bot: Bot, event: Event):\n    log_msg = f\"<m>{bot.type.upper()} </m>| {event.self_id} [{event.name}]: \"\n    if event.type == \"message\":\n        log_msg += f\"Message {event.id} from \"\n        log_msg += str(event.user_id)\n        if event.detail_type == \"group\":\n            log_msg += f\"@[\u7fa4:{event.group_id}]:\"\n\n        log_msg += ' \"' + \"\".join(\n            map(\n                lambda x: escape_tag(str(x))\n                if x.type == \"text\" else f\"<le>{escape_tag(str(x))}</le>\",\n                event.message)) + '\"'  # type: ignore\n    elif event.type == \"notice\":\n        log_msg += f\"Notice {event.raw_event}\"\n    elif event.type == \"request\":\n        log_msg += f\"Request {event.raw_event}\"\n    elif event.type == \"meta_event\":\n        log_msg += f\"MetaEvent {event.raw_event}\"\n    logger.opt(colors=True).info(log_msg)\n\n    coros = []\n    state = {}\n    for preprocessor in _event_preprocessors:\n        coros.append(preprocessor(bot, event, state))\n    if coros:\n        try:\n            logger.debug(\"Running PreProcessors...\")\n            await asyncio.gather(*coros)\n        except IgnoredException:\n            logger.opt(\n                colors=True).info(f\"Event {event.name} is <b>ignored</b>\")\n            return\n\n    # Trie Match\n    _, _ = TrieRule.get_value(bot, event, state)\n\n    break_flag = False\n    for priority in sorted(matchers.keys()):\n        if break_flag:\n            break\n\n        pending_tasks = [\n            _run_matcher(matcher, bot, event, state.copy())\n            for matcher in matchers[priority]\n        ]\n\n        logger.debug(f\"Checking for matchers in priority {priority}...\")\n        results = await asyncio.gather(*pending_tasks, return_exceptions=True)\n\n        i = 0\n        for index, result in enumerate(results):\n            if isinstance(result, _ExceptionContainer):\n                e_list = result.exceptions\n                if StopPropagation in e_list:\n                    if not break_flag:\n                        break_flag = True\n                        logger.debug(\"Stop event propagation\")\n                if ExpiredException in e_list:\n                    logger.debug(\n                        f\"Matcher {matchers[priority][index - i]} will be removed.\"\n                    )\n                    del matchers[priority][index - i]\n                    i += 1\n", "path": "nonebot/message.py"}]}