Repository: nonebot/nonebot2

Issue:
Update: cqhttp(OneBot) v11
## update adapter cqhttp to v11

- [x] 适配CQ Code
- [x] 适配API

See [cqhttp](//cqhttp.cc/), [onebot](//github.com/howmanybots/onebot)


Discussion:

Resolving patch:
diff --git a/nonebot/adapters/cqhttp.py b/nonebot/adapters/cqhttp.py
--- a/nonebot/adapters/cqhttp.py
+++ b/nonebot/adapters/cqhttp.py
@@ -195,9 +195,10 @@ async def handle_message(self, message: dict):
     @overrides(BaseBot)
     async def call_api(self, api: str, **data) -> Union[Any, NoReturn]:
         if "self_id" in data:
-            self_id = str(data.pop("self_id"))
-            bot = self.driver.bots[self_id]
-            return await bot.call_api(api, **data)
+            self_id = data.pop("self_id")
+            if self_id:
+                bot = self.driver.bots[str(self_id)]
+                return await bot.call_api(api, **data)
 
         if self.type == "websocket":
             seq = ResultStore.get_seq()
diff --git a/nonebot/message.py b/nonebot/message.py
--- a/nonebot/message.py
+++ b/nonebot/message.py
@@ -34,6 +34,9 @@ async def _run_matcher(Matcher: Type[Matcher], bot: Bot, event: Event,
         logger.exception(e)
         return
 
+    # TODO: log matcher
+    logger.info(f"Event will be handled by {Matcher}")
+
     matcher = Matcher()
     # TODO: BeforeMatcherRun
     try:
@@ -102,7 +105,7 @@ async def handle_event(bot: Bot, event: Event):
                 e_list = result.exceptions
                 if StopPropagation in e_list:
                     break_flag = True
-                    logger.debug("Stop event propafation")
+                    logger.debug("Stop event propagation")
                 if ExpiredException in e_list:
                     del matchers[priority][index - i]
                     i += 1


Test patch:
diff --git a/tests/test_plugins/test_message.py b/tests/test_plugins/test_message.py
--- a/tests/test_plugins/test_message.py
+++ b/tests/test_plugins/test_message.py
@@ -12,7 +12,7 @@
 async def test_handler(bot: Bot, event: Event, state: dict):
     print("[*] Test Matcher Received:", event)
     state["event"] = event
-    await bot.send_private_msg(message="Received", user_id=event.user_id)
+    await bot.send(message="Received", event=event)
 
 
 @test_message.receive()
diff --git a/tests/test_plugins/test_package/test_command.py b/tests/test_plugins/test_package/test_command.py
--- a/tests/test_plugins/test_package/test_command.py
+++ b/tests/test_plugins/test_package/test_command.py
@@ -16,8 +16,7 @@ async def test_handler(bot: Bot, event: Event, state: dict):
     if args:
         state["help"] = args
     else:
-        await bot.send_private_msg(message="命令:\n1. test1\n2. test2",
-                                   user_id=event.user_id)
+        await bot.send(message="命令:\n1. test1\n2. test2", event=event)
 
 
 @test_command.got("help", prompt="你要帮助的命令是？")
@@ -25,4 +24,4 @@ async def test_handler(bot: Bot, event: Event, state: dict):
     print("[!] Command 帮助:", state["help"])
     if state["help"] not in ["test1", "test2"]:
         await test_command.reject(f"{state['help']} 不支持，请重新输入！")
-    await bot.send_private_msg(message=f"{state['help']} 帮助:\n...")
+    await bot.send(message=f"{state['help']} 帮助:\n...", event=event)