diff --git a/archive/2.0.0a14/README.md b/archive/2.0.0a15/README.md similarity index 100% rename from archive/2.0.0a14/README.md rename to archive/2.0.0a15/README.md diff --git a/archive/2.0.0a14/advanced/README.md b/archive/2.0.0a15/advanced/README.md similarity index 100% rename from archive/2.0.0a14/advanced/README.md rename to archive/2.0.0a15/advanced/README.md diff --git a/archive/2.0.0a14/advanced/export-and-require.md b/archive/2.0.0a15/advanced/export-and-require.md similarity index 100% rename from archive/2.0.0a14/advanced/export-and-require.md rename to archive/2.0.0a15/advanced/export-and-require.md diff --git a/archive/2.0.0a14/advanced/overloaded-handlers.md b/archive/2.0.0a15/advanced/overloaded-handlers.md similarity index 100% rename from archive/2.0.0a14/advanced/overloaded-handlers.md rename to archive/2.0.0a15/advanced/overloaded-handlers.md diff --git a/archive/2.0.0a14/advanced/permission.md b/archive/2.0.0a15/advanced/permission.md similarity index 100% rename from archive/2.0.0a14/advanced/permission.md rename to archive/2.0.0a15/advanced/permission.md diff --git a/archive/2.0.0a14/advanced/publish-plugin.md b/archive/2.0.0a15/advanced/publish-plugin.md similarity index 100% rename from archive/2.0.0a14/advanced/publish-plugin.md rename to archive/2.0.0a15/advanced/publish-plugin.md diff --git a/archive/2.0.0a14/advanced/runtime-hook.md b/archive/2.0.0a15/advanced/runtime-hook.md similarity index 100% rename from archive/2.0.0a14/advanced/runtime-hook.md rename to archive/2.0.0a15/advanced/runtime-hook.md diff --git a/archive/2.0.0a14/advanced/scheduler.md b/archive/2.0.0a15/advanced/scheduler.md similarity index 100% rename from archive/2.0.0a14/advanced/scheduler.md rename to archive/2.0.0a15/advanced/scheduler.md diff --git a/archive/2.0.0a14/api/README.md b/archive/2.0.0a15/api/README.md similarity index 100% rename from archive/2.0.0a14/api/README.md rename to archive/2.0.0a15/api/README.md diff --git a/archive/2.0.0a14/api/adapters/README.md b/archive/2.0.0a15/api/adapters/README.md similarity index 100% rename from archive/2.0.0a14/api/adapters/README.md rename to archive/2.0.0a15/api/adapters/README.md diff --git a/archive/2.0.0a14/api/adapters/cqhttp.md b/archive/2.0.0a15/api/adapters/cqhttp.md similarity index 100% rename from archive/2.0.0a14/api/adapters/cqhttp.md rename to archive/2.0.0a15/api/adapters/cqhttp.md diff --git a/archive/2.0.0a14/api/adapters/ding.md b/archive/2.0.0a15/api/adapters/ding.md similarity index 100% rename from archive/2.0.0a14/api/adapters/ding.md rename to archive/2.0.0a15/api/adapters/ding.md diff --git a/archive/2.0.0a14/api/adapters/feishu.md b/archive/2.0.0a15/api/adapters/feishu.md similarity index 100% rename from archive/2.0.0a14/api/adapters/feishu.md rename to archive/2.0.0a15/api/adapters/feishu.md diff --git a/archive/2.0.0a14/api/adapters/mirai.md b/archive/2.0.0a15/api/adapters/mirai.md similarity index 100% rename from archive/2.0.0a14/api/adapters/mirai.md rename to archive/2.0.0a15/api/adapters/mirai.md diff --git a/archive/2.0.0a14/api/config.md b/archive/2.0.0a15/api/config.md similarity index 100% rename from archive/2.0.0a14/api/config.md rename to archive/2.0.0a15/api/config.md diff --git a/archive/2.0.0a14/api/drivers/README.md b/archive/2.0.0a15/api/drivers/README.md similarity index 100% rename from archive/2.0.0a14/api/drivers/README.md rename to archive/2.0.0a15/api/drivers/README.md diff --git a/archive/2.0.0a14/api/drivers/aiohttp.md b/archive/2.0.0a15/api/drivers/aiohttp.md similarity index 100% rename from archive/2.0.0a14/api/drivers/aiohttp.md rename to archive/2.0.0a15/api/drivers/aiohttp.md diff --git a/archive/2.0.0a14/api/drivers/fastapi.md b/archive/2.0.0a15/api/drivers/fastapi.md similarity index 100% rename from archive/2.0.0a14/api/drivers/fastapi.md rename to archive/2.0.0a15/api/drivers/fastapi.md diff --git a/archive/2.0.0a14/api/drivers/quart.md b/archive/2.0.0a15/api/drivers/quart.md similarity index 100% rename from archive/2.0.0a14/api/drivers/quart.md rename to archive/2.0.0a15/api/drivers/quart.md diff --git a/archive/2.0.0a14/api/exception.md b/archive/2.0.0a15/api/exception.md similarity index 100% rename from archive/2.0.0a14/api/exception.md rename to archive/2.0.0a15/api/exception.md diff --git a/archive/2.0.0a14/api/handler.md b/archive/2.0.0a15/api/handler.md similarity index 100% rename from archive/2.0.0a14/api/handler.md rename to archive/2.0.0a15/api/handler.md diff --git a/archive/2.0.0a14/api/log.md b/archive/2.0.0a15/api/log.md similarity index 100% rename from archive/2.0.0a14/api/log.md rename to archive/2.0.0a15/api/log.md diff --git a/archive/2.0.0a14/api/matcher.md b/archive/2.0.0a15/api/matcher.md similarity index 100% rename from archive/2.0.0a14/api/matcher.md rename to archive/2.0.0a15/api/matcher.md diff --git a/archive/2.0.0a14/api/message.md b/archive/2.0.0a15/api/message.md similarity index 100% rename from archive/2.0.0a14/api/message.md rename to archive/2.0.0a15/api/message.md diff --git a/archive/2.0.0a14/api/nonebot.md b/archive/2.0.0a15/api/nonebot.md similarity index 100% rename from archive/2.0.0a14/api/nonebot.md rename to archive/2.0.0a15/api/nonebot.md diff --git a/archive/2.0.0a14/api/permission.md b/archive/2.0.0a15/api/permission.md similarity index 100% rename from archive/2.0.0a14/api/permission.md rename to archive/2.0.0a15/api/permission.md diff --git a/archive/2.0.0a14/api/plugin.md b/archive/2.0.0a15/api/plugin.md similarity index 100% rename from archive/2.0.0a14/api/plugin.md rename to archive/2.0.0a15/api/plugin.md diff --git a/archive/2.0.0a14/api/rule.md b/archive/2.0.0a15/api/rule.md similarity index 100% rename from archive/2.0.0a14/api/rule.md rename to archive/2.0.0a15/api/rule.md diff --git a/archive/2.0.0a14/api/typing.md b/archive/2.0.0a15/api/typing.md similarity index 100% rename from archive/2.0.0a14/api/typing.md rename to archive/2.0.0a15/api/typing.md diff --git a/archive/2.0.0a14/api/utils.md b/archive/2.0.0a15/api/utils.md similarity index 100% rename from archive/2.0.0a14/api/utils.md rename to archive/2.0.0a15/api/utils.md diff --git a/archive/2.0.0a14/guide/README.md b/archive/2.0.0a15/guide/README.md similarity index 100% rename from archive/2.0.0a14/guide/README.md rename to archive/2.0.0a15/guide/README.md diff --git a/archive/2.0.0a14/guide/basic-configuration.md b/archive/2.0.0a15/guide/basic-configuration.md similarity index 100% rename from archive/2.0.0a14/guide/basic-configuration.md rename to archive/2.0.0a15/guide/basic-configuration.md diff --git a/archive/2.0.0a14/guide/cqhttp-guide.md b/archive/2.0.0a15/guide/cqhttp-guide.md similarity index 100% rename from archive/2.0.0a14/guide/cqhttp-guide.md rename to archive/2.0.0a15/guide/cqhttp-guide.md diff --git a/archive/2.0.0a14/guide/creating-a-handler.md b/archive/2.0.0a15/guide/creating-a-handler.md similarity index 100% rename from archive/2.0.0a14/guide/creating-a-handler.md rename to archive/2.0.0a15/guide/creating-a-handler.md diff --git a/archive/2.0.0a14/guide/creating-a-matcher.md b/archive/2.0.0a15/guide/creating-a-matcher.md similarity index 100% rename from archive/2.0.0a14/guide/creating-a-matcher.md rename to archive/2.0.0a15/guide/creating-a-matcher.md diff --git a/archive/2.0.0a14/guide/creating-a-plugin.md b/archive/2.0.0a15/guide/creating-a-plugin.md similarity index 100% rename from archive/2.0.0a14/guide/creating-a-plugin.md rename to archive/2.0.0a15/guide/creating-a-plugin.md diff --git a/archive/2.0.0a14/guide/creating-a-project.md b/archive/2.0.0a15/guide/creating-a-project.md similarity index 100% rename from archive/2.0.0a14/guide/creating-a-project.md rename to archive/2.0.0a15/guide/creating-a-project.md diff --git a/archive/2.0.0a14/guide/ding-guide.md b/archive/2.0.0a15/guide/ding-guide.md similarity index 100% rename from archive/2.0.0a14/guide/ding-guide.md rename to archive/2.0.0a15/guide/ding-guide.md diff --git a/archive/2.0.0a14/guide/end-or-start.md b/archive/2.0.0a15/guide/end-or-start.md similarity index 100% rename from archive/2.0.0a14/guide/end-or-start.md rename to archive/2.0.0a15/guide/end-or-start.md diff --git a/archive/2.0.0a14/guide/feishu-guide.md b/archive/2.0.0a15/guide/feishu-guide.md similarity index 100% rename from archive/2.0.0a14/guide/feishu-guide.md rename to archive/2.0.0a15/guide/feishu-guide.md diff --git a/archive/2.0.0a14/guide/getting-started.md b/archive/2.0.0a15/guide/getting-started.md similarity index 100% rename from archive/2.0.0a14/guide/getting-started.md rename to archive/2.0.0a15/guide/getting-started.md diff --git a/archive/2.0.0a14/guide/images/Handle-Event.png b/archive/2.0.0a15/guide/images/Handle-Event.png similarity index 100% rename from archive/2.0.0a14/guide/images/Handle-Event.png rename to archive/2.0.0a15/guide/images/Handle-Event.png diff --git a/archive/2.0.0a14/guide/images/ding/jiaqian.png b/archive/2.0.0a15/guide/images/ding/jiaqian.png similarity index 100% rename from archive/2.0.0a14/guide/images/ding/jiaqian.png rename to archive/2.0.0a15/guide/images/ding/jiaqian.png diff --git a/archive/2.0.0a14/guide/images/ding/test_webhook.png b/archive/2.0.0a15/guide/images/ding/test_webhook.png similarity index 100% rename from archive/2.0.0a14/guide/images/ding/test_webhook.png rename to archive/2.0.0a15/guide/images/ding/test_webhook.png diff --git a/archive/2.0.0a14/guide/images/ding/webhook.png b/archive/2.0.0a15/guide/images/ding/webhook.png similarity index 100% rename from archive/2.0.0a14/guide/images/ding/webhook.png rename to archive/2.0.0a15/guide/images/ding/webhook.png diff --git a/archive/2.0.0a14/guide/installation.md b/archive/2.0.0a15/guide/installation.md similarity index 100% rename from archive/2.0.0a14/guide/installation.md rename to archive/2.0.0a15/guide/installation.md diff --git a/archive/2.0.0a14/guide/loading-a-plugin.md b/archive/2.0.0a15/guide/loading-a-plugin.md similarity index 100% rename from archive/2.0.0a14/guide/loading-a-plugin.md rename to archive/2.0.0a15/guide/loading-a-plugin.md diff --git a/archive/2.0.0a14/guide/mirai-guide.md b/archive/2.0.0a15/guide/mirai-guide.md similarity index 96% rename from archive/2.0.0a14/guide/mirai-guide.md rename to archive/2.0.0a15/guide/mirai-guide.md index c2f2f53844e..aa598dfa047 100644 --- a/archive/2.0.0a14/guide/mirai-guide.md +++ b/archive/2.0.0a15/guide/mirai-guide.md @@ -133,7 +133,11 @@ pip install nonebot-adapter-mirai from nonebot.adapters.mirai import Bot nonebot.init() - nonebot.get_driver().register_adapter('mirai', Bot, qq=12345678) # qq参数需要填在mah中登录的qq + nonebot.get_driver().register_adapter('mirai', + Bot, + qq=12345678) + # qq参数需要填在mah中登录的qq, 如果需要多个帐号, 可以填写类似于 [123456,789100] 的数组形式 + nonebot.load_builtin_plugins() # 加载 nonebot 内置插件 nonebot.run() ``` diff --git a/archive/2.0.0a14/sidebar.config.json b/archive/2.0.0a15/sidebar.config.json similarity index 100% rename from archive/2.0.0a14/sidebar.config.json rename to archive/2.0.0a15/sidebar.config.json diff --git a/docs/.vuepress/versions.json b/docs/.vuepress/versions.json index 4b6f6dabfe5..fcfc7259e24 100644 --- a/docs/.vuepress/versions.json +++ b/docs/.vuepress/versions.json @@ -1,5 +1,5 @@ [ - "2.0.0a14", + "2.0.0a15", "2.0.0a13.post1", "2.0.0a10", "2.0.0a8.post2", diff --git a/docs/guide/mirai-guide.md b/docs/guide/mirai-guide.md index c2f2f53844e..aa598dfa047 100644 --- a/docs/guide/mirai-guide.md +++ b/docs/guide/mirai-guide.md @@ -133,7 +133,11 @@ pip install nonebot-adapter-mirai from nonebot.adapters.mirai import Bot nonebot.init() - nonebot.get_driver().register_adapter('mirai', Bot, qq=12345678) # qq参数需要填在mah中登录的qq + nonebot.get_driver().register_adapter('mirai', + Bot, + qq=12345678) + # qq参数需要填在mah中登录的qq, 如果需要多个帐号, 可以填写类似于 [123456,789100] 的数组形式 + nonebot.load_builtin_plugins() # 加载 nonebot 内置插件 nonebot.run() ``` diff --git a/nonebot/__init__.py b/nonebot/__init__.py index ae0401fa2ba..7f19e26d227 100644 --- a/nonebot/__init__.py +++ b/nonebot/__init__.py @@ -232,8 +232,8 @@ def init(*, _env_file: Optional[str] = None, **kwargs): default_filter.level = ( "DEBUG" if config.debug else "INFO") if config.log_level is None else config.log_level - logger.opt( - colors=True).info(f"Current Env: {env.environment}") + logger.opt(colors=True).info( + f"Current Env: {escape_tag(env.environment)}") logger.opt(colors=True).debug( f"Loaded Config: {escape_tag(str(config.dict()))}") diff --git a/nonebot/adapters/_base.py b/nonebot/adapters/_base.py index 8223aa0e37b..109326679e2 100644 --- a/nonebot/adapters/_base.py +++ b/nonebot/adapters/_base.py @@ -10,7 +10,7 @@ from copy import deepcopy from functools import partial from typing_extensions import Protocol -from dataclasses import dataclass, field +from dataclasses import dataclass, field, asdict from typing import (Any, Set, List, Dict, Type, Tuple, Union, TypeVar, Mapping, Generic, Optional, Iterable) @@ -275,28 +275,28 @@ def __radd__(self, other: Union[str, Mapping, Iterable[Mapping]]) -> TM: return self.get_message_class()(other) + self # type: ignore def __getitem__(self, key: str): - return self.data[key] + return getattr(self, key) def __setitem__(self, key: str, value: Any): - self.data[key] = value + return setattr(self, key, value) def __iter__(self): - yield from self.data.__iter__() + yield from asdict(self).keys() def __contains__(self, key: Any) -> bool: - return key in self.data + return key in asdict(self).keys() def get(self, key: str, default: Any = None): return getattr(self, key, default) def keys(self): - return self.data.keys() + return asdict(self).keys() def values(self): - return self.data.values() + return asdict(self).values() def items(self): - return self.data.items() + return asdict(self).items() def copy(self: T) -> T: return deepcopy(self) diff --git a/nonebot/drivers/__init__.py b/nonebot/drivers/__init__.py index 7607e4b3ca2..144870cd134 100644 --- a/nonebot/drivers/__init__.py +++ b/nonebot/drivers/__init__.py @@ -11,6 +11,7 @@ from typing import Any, Set, Dict, Type, Union, Optional, Callable, Awaitable, TYPE_CHECKING from nonebot.log import logger +from nonebot.utils import escape_tag from nonebot.config import Env, Config from nonebot.typing import T_BotConnectionHook, T_BotDisconnectionHook @@ -87,13 +88,13 @@ def register_adapter(self, name: str, adapter: Type["Bot"], **kwargs): * ``**kwargs``: 其他传递给适配器的参数 """ if name in self._adapters: - logger.opt( - colors=True).debug(f'Adapter "{name}" already exists') + logger.opt(colors=True).debug( + f'Adapter "{escape_tag(name)}" already exists') return self._adapters[name] = adapter adapter.register(self, self.config, **kwargs) - logger.opt( - colors=True).debug(f'Succeeded to load adapter "{name}"') + logger.opt(colors=True).debug( + f'Succeeded to load adapter "{escape_tag(name)}"') @property @abc.abstractmethod @@ -119,7 +120,7 @@ def run(self, *args, **kwargs): * ``**kwargs`` """ logger.opt(colors=True).debug( - f"Loaded adapters: {', '.join(self._adapters)}") + f"Loaded adapters: {escape_tag(', '.join(self._adapters))}") @abc.abstractmethod def on_startup(self, func: Callable) -> Callable: @@ -346,7 +347,7 @@ def type(self) -> str: @property @abc.abstractmethod - def closed(self): + def closed(self) -> bool: """ :类型: ``bool`` :说明: 连接是否已经关闭 diff --git a/nonebot/drivers/aiohttp.py b/nonebot/drivers/aiohttp.py index 10d464c0290..5c701a94ed7 100644 --- a/nonebot/drivers/aiohttp.py +++ b/nonebot/drivers/aiohttp.py @@ -16,6 +16,7 @@ from nonebot.log import logger from nonebot.adapters import Bot +from nonebot.utils import escape_tag from nonebot.typing import overrides from nonebot.config import Env, Config from nonebot.drivers import (ForwardDriver, HTTPPollingSetup, WebSocketSetup, @@ -213,7 +214,8 @@ async def _build_request( url = URL(setup.url) if not url.is_absolute() or not url.host: logger.opt(colors=True).error( - f"Error parsing url {url}") + f"Error parsing url {escape_tag(str(url))}" + ) return host = f"{url.host}:{url.port}" if url.port else url.host return HTTPRequest(setup.http_version, url.scheme, url.path, @@ -226,17 +228,26 @@ async def _build_request( setup_: Optional[HTTPPollingSetup] = None logger.opt(colors=True).info( - f"Start http polling for {setup.adapter.upper()} " - f"Bot {setup.self_id}") + f"Start http polling for {escape_tag(setup.adapter.upper())} " + f"Bot {escape_tag(setup.self_id)}") try: async with aiohttp.ClientSession() as session: while not self.should_exit.is_set(): - if not bot: + + try: if callable(setup): setup_ = await setup() else: setup_ = setup + except Exception as e: + logger.opt(colors=True, exception=e).error( + f"Error while parsing setup {setup!r}." + ) + await asyncio.sleep(3) + continue + + if not bot: request = await _build_request(setup_) if not request: return @@ -245,7 +256,6 @@ async def _build_request( bot = BotClass(setup.self_id, request) self._bot_connect(bot) elif callable(setup): - setup_ = await setup() request = await _build_request(setup_) if not request: await asyncio.sleep(setup_.poll_interval) @@ -265,7 +275,8 @@ async def _build_request( else: logger.opt(colors=True).error( "Unsupported HTTP Version " - f"{request.http_version}") + f"{escape_tag(request.http_version)}" + ) return logger.debug( @@ -284,7 +295,7 @@ async def _build_request( asyncio.create_task(bot.handle_message(data)) except aiohttp.ClientResponseError as e: logger.opt(colors=True, exception=e).error( - f"Error occurred while requesting {setup_.url}. " + f"Error occurred while requesting {escape_tag(setup_.url)}. " "Try to reconnect...") await asyncio.sleep(setup_.poll_interval) @@ -305,15 +316,23 @@ async def _ws_loop(self, setup: WEBSOCKET_SETUP): try: async with aiohttp.ClientSession() as session: while True: - if callable(setup): - setup_ = await setup() - else: - setup_ = setup + + try: + if callable(setup): + setup_ = await setup() + else: + setup_ = setup + except Exception as e: + logger.opt(colors=True, exception=e).error( + f"Error while parsing setup {setup!r}." + ) + await asyncio.sleep(3) + continue url = URL(setup_.url) if not url.is_absolute() or not url.host: logger.opt(colors=True).error( - f"Error parsing url {url}" + f"Error parsing url {escape_tag(str(url))}" ) await asyncio.sleep(setup_.reconnect_interval) continue @@ -329,8 +348,9 @@ async def _ws_loop(self, setup: WEBSOCKET_SETUP): headers=headers, timeout=30.) as ws: logger.opt(colors=True).info( - f"WebSocket Connection to {setup_.adapter.upper()} " - f"Bot {setup_.self_id} succeeded!") + f"WebSocket Connection to {escape_tag(setup_.adapter.upper())} " + f"Bot {escape_tag(setup_.self_id)} succeeded!" + ) request = WebSocket( "1.1", url.scheme, url.path, url.raw_query_string.encode("latin-1"), headers, @@ -360,7 +380,7 @@ async def _ws_loop(self, setup: WEBSOCKET_SETUP): except (aiohttp.ClientResponseError, aiohttp.ClientConnectionError) as e: logger.opt(colors=True, exception=e).error( - f"Error while connecting to {url}. " + f"Error while connecting to {escape_tag(str(url))}. " "Try to reconnect...") finally: if bot: diff --git a/nonebot/drivers/fastapi.py b/nonebot/drivers/fastapi.py index b263ba7a89b..62c0cef19aa 100644 --- a/nonebot/drivers/fastapi.py +++ b/nonebot/drivers/fastapi.py @@ -27,6 +27,7 @@ from nonebot.log import logger from nonebot.adapters import Bot +from nonebot.utils import escape_tag from nonebot.typing import overrides from nonebot.config import Env, Config as NoneBotConfig from nonebot.drivers import (ReverseDriver, ForwardDriver, HTTPPollingSetup, @@ -283,25 +284,26 @@ async def _handle_ws_reverse(self, adapter: str, # Create Bot Object BotClass = self._adapters[adapter] - x_self_id, _ = await BotClass.check_permission(self, ws) + self_id, _ = await BotClass.check_permission(self, ws) - if not x_self_id: + if not self_id: await ws.close(code=status.WS_1008_POLICY_VIOLATION) return - if x_self_id in self._clients: + if self_id in self._clients: logger.opt(colors=True).warning( - "There's already a reverse websocket connection, " - f"{adapter.upper()} Bot {x_self_id} ignored.") + "There's already a websocket connection, " + f"{escape_tag(adapter.upper())} Bot {escape_tag(self_id)} ignored." + ) await ws.close(code=status.WS_1008_POLICY_VIOLATION) return - bot = BotClass(x_self_id, ws) + bot = BotClass(self_id, ws) await ws.accept() logger.opt(colors=True).info( - f"WebSocket Connection from {adapter.upper()} " - f"Bot {x_self_id} Accepted!") + f"WebSocket Connection from {escape_tag(adapter.upper())} " + f"Bot {escape_tag(self_id)} Accepted!") self._bot_connect(bot) @@ -328,7 +330,8 @@ async def _build_request( url = httpx.URL(setup.url) if not url.netloc: logger.opt(colors=True).error( - f"Error parsing url {url}") + f"Error parsing url {escape_tag(str(url))}" + ) return return HTTPRequest( setup.http_version, url.scheme, url.path, url.query, { @@ -340,17 +343,26 @@ async def _build_request( setup_: Optional[HTTPPollingSetup] = None logger.opt(colors=True).info( - f"Start http polling for {setup.adapter.upper()} " - f"Bot {setup.self_id}") + f"Start http polling for {escape_tag(setup.adapter.upper())} " + f"Bot {escape_tag(setup.self_id)}") try: async with httpx.AsyncClient(http2=True) as session: while not self.shutdown.is_set(): - if not bot: + + try: if callable(setup): setup_ = await setup() else: setup_ = setup + except Exception as e: + logger.opt(colors=True, exception=e).error( + f"Error while parsing setup {setup!r}." + ) + await asyncio.sleep(3) + continue + + if not bot: request = await _build_request(setup_) if not request: return @@ -358,7 +370,6 @@ async def _build_request( bot = BotClass(setup.self_id, request) self._bot_connect(bot) elif callable(setup): - setup_ = await setup() request = await _build_request(setup_) if not request: await asyncio.sleep(setup_.poll_interval) @@ -383,7 +394,7 @@ async def _build_request( asyncio.create_task(bot.handle_message(data)) except httpx.HTTPError as e: logger.opt(colors=True, exception=e).error( - f"Error occurred while requesting {setup_.url}. " + f"Error occurred while requesting {escape_tag(setup_.url)}. " "Try to reconnect...") await asyncio.sleep(setup_.poll_interval) @@ -403,15 +414,23 @@ async def _ws_loop(self, setup: WEBSOCKET_SETUP): try: while True: - if callable(setup): - setup_ = await setup() - else: - setup_ = setup + + try: + if callable(setup): + setup_ = await setup() + else: + setup_ = setup + except Exception as e: + logger.opt(colors=True, exception=e).error( + f"Error while parsing setup {setup!r}." + ) + await asyncio.sleep(3) + continue url = httpx.URL(setup_.url) if not url.netloc: logger.opt(colors=True).error( - f"Error parsing url {url}" + f"Error parsing url {escape_tag(str(url))}" ) return @@ -423,8 +442,8 @@ async def _ws_loop(self, setup: WEBSOCKET_SETUP): connection = Connect(setup_.url) async with connection as ws: logger.opt(colors=True).info( - f"WebSocket Connection to {setup_.adapter.upper()} " - f"Bot {setup_.self_id} succeeded!") + f"WebSocket Connection to {escape_tag(setup_.adapter.upper())} " + f"Bot {escape_tag(setup_.self_id)} succeeded!") request = WebSocket("1.1", url.scheme, url.path, url.query, headers, ws) @@ -440,6 +459,7 @@ async def _ws_loop(self, setup: WEBSOCKET_SETUP): logger.opt(colors=True).error( "WebSocket connection closed by peer. " "Try to reconnect...") + break except Exception as e: logger.opt(colors=True, exception=e).error( f"Error while connecting to {url}. " diff --git a/nonebot/drivers/quart.py b/nonebot/drivers/quart.py index 75e3566dc85..d105122b6b3 100644 --- a/nonebot/drivers/quart.py +++ b/nonebot/drivers/quart.py @@ -16,6 +16,7 @@ from pydantic import BaseSettings from nonebot.log import logger +from nonebot.utils import escape_tag from nonebot.typing import overrides from nonebot.config import Env, Config as NoneBotConfig from nonebot.drivers import ReverseDriver, HTTPRequest, WebSocket as BaseWebSocket @@ -198,15 +199,16 @@ async def _handle_ws_reverse(self, adapter: str): if self_id in self._clients: logger.opt(colors=True).warning( - "There's already a reverse websocket connection, " - f"{adapter.upper()} Bot {self_id} ignored.") + "There's already a websocket connection, " + f"{escape_tag(adapter.upper())} Bot {escape_tag(self_id)} ignored." + ) raise exceptions.Forbidden(description='Client already exists.') bot = BotClass(self_id, ws) await ws.accept() logger.opt(colors=True).info( - f"WebSocket Connection from {adapter.upper()} " - f"Bot {self_id} Accepted!") + f"WebSocket Connection from {escape_tag(adapter.upper())} " + f"Bot {escape_tag(self_id)} Accepted!") self._bot_connect(bot) try: diff --git a/nonebot/message.py b/nonebot/message.py index 4a3dc22cead..a6044d2cc45 100644 --- a/nonebot/message.py +++ b/nonebot/message.py @@ -11,6 +11,7 @@ from nonebot.log import logger from nonebot.rule import TrieRule +from nonebot.utils import escape_tag from nonebot.matcher import matchers, Matcher from nonebot.exception import IgnoredException, StopPropagation, NoLogException from nonebot.typing import T_State, T_EventPreProcessor, T_RunPreProcessor, T_EventPostProcessor, T_RunPostProcessor @@ -193,7 +194,7 @@ async def handle_event(bot: "Bot", event: "Event") -> Optional[Exception]: asyncio.create_task(handle_event(bot, event)) """ show_log = True - log_msg = f"{bot.type.upper()} {bot.self_id} | " + log_msg = f"{escape_tag(bot.type.upper())} {escape_tag(bot.self_id)} | " try: log_msg += event.get_log_string() except NoLogException: @@ -210,7 +211,7 @@ async def handle_event(bot: "Bot", event: "Event") -> Optional[Exception]: await asyncio.gather(*coros) except IgnoredException as e: logger.opt(colors=True).info( - f"Event {event.get_event_name()} is ignored") + f"Event {escape_tag(event.get_event_name())} is ignored") return e except Exception as e: logger.opt(colors=True, exception=e).error( diff --git a/nonebot/plugin/__init__.py b/nonebot/plugin/__init__.py index f4457d5c713..038db8fc9bd 100644 --- a/nonebot/plugin/__init__.py +++ b/nonebot/plugin/__init__.py @@ -16,6 +16,7 @@ from nonebot.log import logger from nonebot.matcher import Matcher from nonebot.handler import Handler +from nonebot.utils import escape_tag from nonebot.permission import Permission from nonebot.typing import T_State, T_StateFactory, T_Handler, T_RuleChecker from nonebot.rule import Rule, startswith, endswith, keyword, command, shell_command, ArgumentParser, regex @@ -945,12 +946,13 @@ def _load_plugin(manager: PluginManager, plugin_name: str) -> Optional[Plugin]: plugin = Plugin(plugin_name, module) plugins[plugin_name] = plugin - logger.opt( - colors=True).success(f'Succeeded to import "{plugin_name}"') + logger.opt(colors=True).success( + f'Succeeded to import "{escape_tag(plugin_name)}"') return plugin except Exception as e: logger.opt(colors=True, exception=e).error( - f'Failed to import "{plugin_name}"') + f'Failed to import "{escape_tag(plugin_name)}"' + ) return None diff --git a/nonebot/plugin/manager.py b/nonebot/plugin/manager.py index b317da97162..7718937020e 100644 --- a/nonebot/plugin/manager.py +++ b/nonebot/plugin/manager.py @@ -189,7 +189,11 @@ def _check_absolute_import(self, origin_path: str) -> Optional[str]: for path in paths: try: rel_path = Path(origin_path).relative_to(path) - return ".".join(rel_path.parts[:-1] + (rel_path.stem,)) + if rel_path.stem == "__init__": + return f"{self.internal_module.__name__}." + ".".join( + rel_path.parts[:-1]) + return f"{self.internal_module.__name__}." + ".".join( + rel_path.parts[:-1] + (rel_path.stem,)) except ValueError: continue diff --git a/nonebot/utils.py b/nonebot/utils.py index 8253d3c7429..7891bdf2389 100644 --- a/nonebot/utils.py +++ b/nonebot/utils.py @@ -80,6 +80,6 @@ def logger_wrapper(logger_name: str): def log(level: str, message: str, exception: Optional[Exception] = None): return logger.opt(colors=True, exception=exception).log( - level, f"{logger_name} | " + message) + level, f"{escape_tag(logger_name)} | " + message) return log diff --git a/packages/nonebot-adapter-cqhttp/nonebot/adapters/cqhttp/bot.py b/packages/nonebot-adapter-cqhttp/nonebot/adapters/cqhttp/bot.py index a6a922df4d9..a927c7ab002 100644 --- a/packages/nonebot-adapter-cqhttp/nonebot/adapters/cqhttp/bot.py +++ b/packages/nonebot-adapter-cqhttp/nonebot/adapters/cqhttp/bot.py @@ -96,10 +96,13 @@ def _check_at_me(bot: "Bot", event: "Event"): if event.message_type == "private": event.to_me = True else: - at_me_seg = MessageSegment.at(event.self_id) + + def _is_at_me_seg(segment: MessageSegment): + return segment.type == "at" and str(segment.data.get( + "qq", "")) == str(event.self_id) # check the first segment - if event.message[0] == at_me_seg: + if _is_at_me_seg(event.message[0]): event.to_me = True event.message.pop(0) if event.message and event.message[0].type == "text": @@ -107,7 +110,7 @@ def _check_at_me(bot: "Bot", event: "Event"): "text"].lstrip() if not event.message[0].data["text"]: del event.message[0] - if event.message and event.message[0] == at_me_seg: + if event.message and _is_at_me_seg(event.message[0]): event.message.pop(0) if event.message and event.message[0].type == "text": event.message[0].data["text"] = event.message[0].data[ @@ -125,7 +128,7 @@ def _check_at_me(bot: "Bot", event: "Event"): i -= 1 last_msg_seg = event.message[i] - if last_msg_seg == at_me_seg: + if _is_at_me_seg(last_msg_seg): event.to_me = True del event.message[i:] @@ -253,7 +256,7 @@ def register(cls, driver: Driver, config: "Config"): WebSocketSetup("cqhttp", self_id, url, headers=headers)) except Exception as e: logger.opt(colors=True, exception=e).error( - f"Bad url {url} for bot {self_id} " + f"Bad url {escape_tag(url)} for bot {escape_tag(self_id)} " "in cqhttp forward websocket") @classmethod @@ -306,7 +309,7 @@ async def handle_message(self, message: bytes): 调用 `_check_reply <#async-check-reply-bot-event>`_, `_check_at_me <#check-at-me-bot-event>`_, `_check_nickname <#check-nickname-bot-event>`_ 处理事件并转换为 `Event <#class-event>`_ """ - data = json.loads(message) + data: dict = json.loads(message) if not data: return @@ -339,7 +342,7 @@ async def handle_message(self, message: bytes): await handle_event(self, event) except Exception as e: logger.opt(colors=True, exception=e).error( - f"Failed to handle event. Raw: {escape_tag(data)}" + f"Failed to handle event. Raw: {escape_tag(str(data))}" ) @overrides(BaseBot) diff --git a/packages/nonebot-adapter-cqhttp/poetry.lock b/packages/nonebot-adapter-cqhttp/poetry.lock index 4deabf1c75a..6a2e782aeb7 100644 --- a/packages/nonebot-adapter-cqhttp/poetry.lock +++ b/packages/nonebot-adapter-cqhttp/poetry.lock @@ -200,7 +200,7 @@ dev = ["codecov (>=2.0.15)", "colorama (>=0.3.4)", "flake8 (>=3.7.7)", "tox (>=3 [[package]] name = "nonebot2" -version = "2.0.0-alpha.14" +version = "2.0.0-alpha.15" description = "An asynchronous python bot framework." category = "main" optional = false @@ -344,16 +344,16 @@ standard = ["websockets (>=9.1)", "httptools (>=0.2.0,<0.3.0)", "watchgod (>=0.6 [[package]] name = "uvloop" -version = "0.15.3" +version = "0.16.0" description = "Fast implementation of asyncio event loop on top of libuv" category = "main" optional = false python-versions = ">=3.7" [package.extras] -dev = ["Cython (>=0.29.20,<0.30.0)", "pytest (>=3.6.0)", "Sphinx (>=1.7.3,<1.8.0)", "sphinxcontrib-asyncio (>=0.2.0,<0.3.0)", "sphinx-rtd-theme (>=0.2.4,<0.3.0)", "aiohttp", "flake8 (>=3.8.4,<3.9.0)", "psutil", "pycodestyle (>=2.6.0,<2.7.0)", "pyOpenSSL (>=19.0.0,<19.1.0)", "mypy (>=0.800)"] -docs = ["Sphinx (>=1.7.3,<1.8.0)", "sphinxcontrib-asyncio (>=0.2.0,<0.3.0)", "sphinx-rtd-theme (>=0.2.4,<0.3.0)"] -test = ["aiohttp", "flake8 (>=3.8.4,<3.9.0)", "psutil", "pycodestyle (>=2.6.0,<2.7.0)", "pyOpenSSL (>=19.0.0,<19.1.0)", "mypy (>=0.800)"] +dev = ["Cython (>=0.29.24,<0.30.0)", "pytest (>=3.6.0)", "Sphinx (>=4.1.2,<4.2.0)", "sphinxcontrib-asyncio (>=0.3.0,<0.4.0)", "sphinx-rtd-theme (>=0.5.2,<0.6.0)", "aiohttp", "flake8 (>=3.9.2,<3.10.0)", "psutil", "pycodestyle (>=2.7.0,<2.8.0)", "pyOpenSSL (>=19.0.0,<19.1.0)", "mypy (>=0.800)"] +docs = ["Sphinx (>=4.1.2,<4.2.0)", "sphinxcontrib-asyncio (>=0.3.0,<0.4.0)", "sphinx-rtd-theme (>=0.5.2,<0.6.0)"] +test = ["aiohttp", "flake8 (>=3.9.2,<3.10.0)", "psutil", "pycodestyle (>=2.7.0,<2.8.0)", "pyOpenSSL (>=19.0.0,<19.1.0)", "mypy (>=0.800)"] [[package]] name = "watchgod" @@ -566,16 +566,22 @@ uvicorn = [ {file = "uvicorn-0.14.0.tar.gz", hash = "sha256:45ad7dfaaa7d55cab4cd1e85e03f27e9d60bc067ddc59db52a2b0aeca8870292"}, ] uvloop = [ - {file = "uvloop-0.15.3-cp37-cp37m-macosx_10_14_x86_64.whl", hash = "sha256:e71fb9038bfcd7646ca126c5ef19b17e48d4af9e838b2bcfda7a9f55a6552a32"}, - {file = "uvloop-0.15.3-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:7522df4e45e4f25b50adbbbeb5bb9847495c438a628177099d2721f2751ff825"}, - {file = "uvloop-0.15.3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ae2b325c0f6d748027f7463077e457006b4fdb35a8788f01754aadba825285ee"}, - {file = "uvloop-0.15.3-cp38-cp38-macosx_10_14_x86_64.whl", hash = "sha256:0de811931e90ae2da9e19ce70ffad73047ab0c1dba7c6e74f9ae1a3aabeb89bd"}, - {file = "uvloop-0.15.3-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:7f4b8a905df909a407c5791fb582f6c03b0d3b491ecdc1cdceaefbc9bf9e08f6"}, - {file = "uvloop-0.15.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2d8ffe44ae709f839c54bacf14ed283f41bee90430c3b398e521e10f8d117b3a"}, - {file = "uvloop-0.15.3-cp39-cp39-macosx_10_14_x86_64.whl", hash = "sha256:63a3288abbc9c8ee979d7e34c34e780b2fbab3e7e53d00b6c80271119f277399"}, - {file = "uvloop-0.15.3-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:5cda65fc60a645470b8525ce014516b120b7057b576fa876cdfdd5e60ab1efbb"}, - {file = "uvloop-0.15.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1ff05116ede1ebdd81802df339e5b1d4cab1dfbd99295bf27e90b4cec64d70e9"}, - {file = "uvloop-0.15.3.tar.gz", hash = "sha256:905f0adb0c09c9f44222ee02f6b96fd88b493478fffb7a345287f9444e926030"}, + {file = "uvloop-0.16.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:6224f1401025b748ffecb7a6e2652b17768f30b1a6a3f7b44660e5b5b690b12d"}, + {file = "uvloop-0.16.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:30ba9dcbd0965f5c812b7c2112a1ddf60cf904c1c160f398e7eed3a6b82dcd9c"}, + {file = "uvloop-0.16.0-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:bd53f7f5db562f37cd64a3af5012df8cac2c464c97e732ed556800129505bd64"}, + {file = "uvloop-0.16.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:772206116b9b57cd625c8a88f2413df2fcfd0b496eb188b82a43bed7af2c2ec9"}, + {file = "uvloop-0.16.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:b572256409f194521a9895aef274cea88731d14732343da3ecdb175228881638"}, + {file = "uvloop-0.16.0-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:04ff57aa137230d8cc968f03481176041ae789308b4d5079118331ab01112450"}, + {file = "uvloop-0.16.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3a19828c4f15687675ea912cc28bbcb48e9bb907c801873bd1519b96b04fb805"}, + {file = "uvloop-0.16.0-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:e814ac2c6f9daf4c36eb8e85266859f42174a4ff0d71b99405ed559257750382"}, + {file = "uvloop-0.16.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:bd8f42ea1ea8f4e84d265769089964ddda95eb2bb38b5cbe26712b0616c3edee"}, + {file = "uvloop-0.16.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:647e481940379eebd314c00440314c81ea547aa636056f554d491e40503c8464"}, + {file = "uvloop-0.16.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8e0d26fa5875d43ddbb0d9d79a447d2ace4180d9e3239788208527c4784f7cab"}, + {file = "uvloop-0.16.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:6ccd57ae8db17d677e9e06192e9c9ec4bd2066b77790f9aa7dede2cc4008ee8f"}, + {file = "uvloop-0.16.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:089b4834fd299d82d83a25e3335372f12117a7d38525217c2258e9b9f4578897"}, + {file = "uvloop-0.16.0-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:98d117332cc9e5ea8dfdc2b28b0a23f60370d02e1395f88f40d1effd2cb86c4f"}, + {file = "uvloop-0.16.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1e5f2e2ff51aefe6c19ee98af12b4ae61f5be456cd24396953244a30880ad861"}, + {file = "uvloop-0.16.0.tar.gz", hash = "sha256:f74bc20c7b67d1c27c72601c78cf95be99d5c2cdd4514502b4f3eb0933ff1228"}, ] watchgod = [ {file = "watchgod-0.7-py3-none-any.whl", hash = "sha256:d6c1ea21df37847ac0537ca0d6c2f4cdf513562e95f77bb93abbcf05573407b7"}, diff --git a/packages/nonebot-adapter-cqhttp/pyproject.toml b/packages/nonebot-adapter-cqhttp/pyproject.toml index c490347dee4..d59d6212dd3 100644 --- a/packages/nonebot-adapter-cqhttp/pyproject.toml +++ b/packages/nonebot-adapter-cqhttp/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "nonebot-adapter-cqhttp" -version = "2.0.0-alpha.14" +version = "2.0.0-alpha.15" description = "OneBot(CQHTTP) adapter for nonebot2" authors = ["yanyongyu "] license = "MIT" diff --git a/packages/nonebot-adapter-ding/nonebot/adapters/ding/bot.py b/packages/nonebot-adapter-ding/nonebot/adapters/ding/bot.py index 4e13c9700ef..57dac28402d 100644 --- a/packages/nonebot-adapter-ding/nonebot/adapters/ding/bot.py +++ b/packages/nonebot-adapter-ding/nonebot/adapters/ding/bot.py @@ -8,6 +8,7 @@ import httpx from nonebot.log import logger +from nonebot.utils import escape_tag from nonebot.typing import overrides from nonebot.message import handle_event from nonebot.adapters import Bot as BaseBot @@ -82,7 +83,7 @@ async def check_permission( @overrides(BaseBot) async def handle_message(self, message: bytes): - data = json.loads(message) + data: dict = json.loads(message) if not data: return @@ -104,7 +105,7 @@ async def handle_message(self, message: bytes): await handle_event(self, event) except Exception as e: logger.opt(colors=True, exception=e).error( - f"Failed to handle event. Raw: {data}" + f"Failed to handle event. Raw: {escape_tag(str(data))}" ) return diff --git a/packages/nonebot-adapter-ding/poetry.lock b/packages/nonebot-adapter-ding/poetry.lock index 4deabf1c75a..6a2e782aeb7 100644 --- a/packages/nonebot-adapter-ding/poetry.lock +++ b/packages/nonebot-adapter-ding/poetry.lock @@ -200,7 +200,7 @@ dev = ["codecov (>=2.0.15)", "colorama (>=0.3.4)", "flake8 (>=3.7.7)", "tox (>=3 [[package]] name = "nonebot2" -version = "2.0.0-alpha.14" +version = "2.0.0-alpha.15" description = "An asynchronous python bot framework." category = "main" optional = false @@ -344,16 +344,16 @@ standard = ["websockets (>=9.1)", "httptools (>=0.2.0,<0.3.0)", "watchgod (>=0.6 [[package]] name = "uvloop" -version = "0.15.3" +version = "0.16.0" description = "Fast implementation of asyncio event loop on top of libuv" category = "main" optional = false python-versions = ">=3.7" [package.extras] -dev = ["Cython (>=0.29.20,<0.30.0)", "pytest (>=3.6.0)", "Sphinx (>=1.7.3,<1.8.0)", "sphinxcontrib-asyncio (>=0.2.0,<0.3.0)", "sphinx-rtd-theme (>=0.2.4,<0.3.0)", "aiohttp", "flake8 (>=3.8.4,<3.9.0)", "psutil", "pycodestyle (>=2.6.0,<2.7.0)", "pyOpenSSL (>=19.0.0,<19.1.0)", "mypy (>=0.800)"] -docs = ["Sphinx (>=1.7.3,<1.8.0)", "sphinxcontrib-asyncio (>=0.2.0,<0.3.0)", "sphinx-rtd-theme (>=0.2.4,<0.3.0)"] -test = ["aiohttp", "flake8 (>=3.8.4,<3.9.0)", "psutil", "pycodestyle (>=2.6.0,<2.7.0)", "pyOpenSSL (>=19.0.0,<19.1.0)", "mypy (>=0.800)"] +dev = ["Cython (>=0.29.24,<0.30.0)", "pytest (>=3.6.0)", "Sphinx (>=4.1.2,<4.2.0)", "sphinxcontrib-asyncio (>=0.3.0,<0.4.0)", "sphinx-rtd-theme (>=0.5.2,<0.6.0)", "aiohttp", "flake8 (>=3.9.2,<3.10.0)", "psutil", "pycodestyle (>=2.7.0,<2.8.0)", "pyOpenSSL (>=19.0.0,<19.1.0)", "mypy (>=0.800)"] +docs = ["Sphinx (>=4.1.2,<4.2.0)", "sphinxcontrib-asyncio (>=0.3.0,<0.4.0)", "sphinx-rtd-theme (>=0.5.2,<0.6.0)"] +test = ["aiohttp", "flake8 (>=3.9.2,<3.10.0)", "psutil", "pycodestyle (>=2.7.0,<2.8.0)", "pyOpenSSL (>=19.0.0,<19.1.0)", "mypy (>=0.800)"] [[package]] name = "watchgod" @@ -566,16 +566,22 @@ uvicorn = [ {file = "uvicorn-0.14.0.tar.gz", hash = "sha256:45ad7dfaaa7d55cab4cd1e85e03f27e9d60bc067ddc59db52a2b0aeca8870292"}, ] uvloop = [ - {file = "uvloop-0.15.3-cp37-cp37m-macosx_10_14_x86_64.whl", hash = "sha256:e71fb9038bfcd7646ca126c5ef19b17e48d4af9e838b2bcfda7a9f55a6552a32"}, - {file = "uvloop-0.15.3-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:7522df4e45e4f25b50adbbbeb5bb9847495c438a628177099d2721f2751ff825"}, - {file = "uvloop-0.15.3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ae2b325c0f6d748027f7463077e457006b4fdb35a8788f01754aadba825285ee"}, - {file = "uvloop-0.15.3-cp38-cp38-macosx_10_14_x86_64.whl", hash = "sha256:0de811931e90ae2da9e19ce70ffad73047ab0c1dba7c6e74f9ae1a3aabeb89bd"}, - {file = "uvloop-0.15.3-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:7f4b8a905df909a407c5791fb582f6c03b0d3b491ecdc1cdceaefbc9bf9e08f6"}, - {file = "uvloop-0.15.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2d8ffe44ae709f839c54bacf14ed283f41bee90430c3b398e521e10f8d117b3a"}, - {file = "uvloop-0.15.3-cp39-cp39-macosx_10_14_x86_64.whl", hash = "sha256:63a3288abbc9c8ee979d7e34c34e780b2fbab3e7e53d00b6c80271119f277399"}, - {file = "uvloop-0.15.3-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:5cda65fc60a645470b8525ce014516b120b7057b576fa876cdfdd5e60ab1efbb"}, - {file = "uvloop-0.15.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1ff05116ede1ebdd81802df339e5b1d4cab1dfbd99295bf27e90b4cec64d70e9"}, - {file = "uvloop-0.15.3.tar.gz", hash = "sha256:905f0adb0c09c9f44222ee02f6b96fd88b493478fffb7a345287f9444e926030"}, + {file = "uvloop-0.16.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:6224f1401025b748ffecb7a6e2652b17768f30b1a6a3f7b44660e5b5b690b12d"}, + {file = "uvloop-0.16.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:30ba9dcbd0965f5c812b7c2112a1ddf60cf904c1c160f398e7eed3a6b82dcd9c"}, + {file = "uvloop-0.16.0-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:bd53f7f5db562f37cd64a3af5012df8cac2c464c97e732ed556800129505bd64"}, + {file = "uvloop-0.16.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:772206116b9b57cd625c8a88f2413df2fcfd0b496eb188b82a43bed7af2c2ec9"}, + {file = "uvloop-0.16.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:b572256409f194521a9895aef274cea88731d14732343da3ecdb175228881638"}, + {file = "uvloop-0.16.0-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:04ff57aa137230d8cc968f03481176041ae789308b4d5079118331ab01112450"}, + {file = "uvloop-0.16.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3a19828c4f15687675ea912cc28bbcb48e9bb907c801873bd1519b96b04fb805"}, + {file = "uvloop-0.16.0-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:e814ac2c6f9daf4c36eb8e85266859f42174a4ff0d71b99405ed559257750382"}, + {file = "uvloop-0.16.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:bd8f42ea1ea8f4e84d265769089964ddda95eb2bb38b5cbe26712b0616c3edee"}, + {file = "uvloop-0.16.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:647e481940379eebd314c00440314c81ea547aa636056f554d491e40503c8464"}, + {file = "uvloop-0.16.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8e0d26fa5875d43ddbb0d9d79a447d2ace4180d9e3239788208527c4784f7cab"}, + {file = "uvloop-0.16.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:6ccd57ae8db17d677e9e06192e9c9ec4bd2066b77790f9aa7dede2cc4008ee8f"}, + {file = "uvloop-0.16.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:089b4834fd299d82d83a25e3335372f12117a7d38525217c2258e9b9f4578897"}, + {file = "uvloop-0.16.0-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:98d117332cc9e5ea8dfdc2b28b0a23f60370d02e1395f88f40d1effd2cb86c4f"}, + {file = "uvloop-0.16.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1e5f2e2ff51aefe6c19ee98af12b4ae61f5be456cd24396953244a30880ad861"}, + {file = "uvloop-0.16.0.tar.gz", hash = "sha256:f74bc20c7b67d1c27c72601c78cf95be99d5c2cdd4514502b4f3eb0933ff1228"}, ] watchgod = [ {file = "watchgod-0.7-py3-none-any.whl", hash = "sha256:d6c1ea21df37847ac0537ca0d6c2f4cdf513562e95f77bb93abbcf05573407b7"}, diff --git a/packages/nonebot-adapter-ding/pyproject.toml b/packages/nonebot-adapter-ding/pyproject.toml index 5a75db2ee34..91541af89c5 100644 --- a/packages/nonebot-adapter-ding/pyproject.toml +++ b/packages/nonebot-adapter-ding/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "nonebot-adapter-ding" -version = "2.0.0-alpha.14" +version = "2.0.0-alpha.15" description = "Ding adapter for nonebot2" authors = ["Artin ", "yanyongyu "] license = "MIT" diff --git a/packages/nonebot-adapter-feishu/nonebot/adapters/feishu/__init__.py b/packages/nonebot-adapter-feishu/nonebot/adapters/feishu/__init__.py index 532b2d9c0cc..44e2cadfce1 100644 --- a/packages/nonebot-adapter-feishu/nonebot/adapters/feishu/__init__.py +++ b/packages/nonebot-adapter-feishu/nonebot/adapters/feishu/__init__.py @@ -1,3 +1,12 @@ +import logging + +from nonebot.log import LoguruHandler, logger + +aiocache_logger = logging.getLogger("aiocache.serializers.serializers") +aiocache_logger.setLevel(logging.DEBUG) +aiocache_logger.handlers.clear() +aiocache_logger.addHandler(LoguruHandler()) + from .bot import Bot from .event import * from .event import Event diff --git a/packages/nonebot-adapter-feishu/nonebot/adapters/feishu/bot.py b/packages/nonebot-adapter-feishu/nonebot/adapters/feishu/bot.py index c5ae46e1b21..d513fb8cd7b 100644 --- a/packages/nonebot-adapter-feishu/nonebot/adapters/feishu/bot.py +++ b/packages/nonebot-adapter-feishu/nonebot/adapters/feishu/bot.py @@ -6,15 +6,16 @@ from aiocache import Cache, cached from aiocache.serializers import PickleSerializer -from nonebot.adapters import Bot as BaseBot -from nonebot.drivers import Driver, HTTPRequest, HTTPResponse from nonebot.log import logger -from nonebot.message import handle_event +from nonebot.utils import escape_tag from nonebot.typing import overrides +from nonebot.message import handle_event +from nonebot.adapters import Bot as BaseBot +from nonebot.drivers import Driver, HTTPRequest, HTTPResponse from .config import Config as FeishuConfig -from .event import (Event, GroupMessageEvent, MessageEvent, - PrivateMessageEvent, get_event_model) +from .event import (Event, GroupMessageEvent, MessageEvent, PrivateMessageEvent, + get_event_model) from .exception import ActionFailed, ApiNotAvailable, NetworkError from .message import Message, MessageSegment, MessageSerializer from .utils import AESCipher, log @@ -202,7 +203,7 @@ async def handle_message(self, message: bytes): 处理事件并转换为 `Event <#class-event>`_ """ - data = json.loads(message) + data: dict = json.loads(message) if data.get("type") == "url_verification": return @@ -229,7 +230,7 @@ async def handle_message(self, message: bytes): await handle_event(self, event) except Exception as e: logger.opt(colors=True, exception=e).error( - f"Failed to handle event. Raw: {message}" + f"Failed to handle event. Raw: {escape_tag(str(data))}" ) def _construct_url(self, path: str) -> str: diff --git a/packages/nonebot-adapter-feishu/poetry.lock b/packages/nonebot-adapter-feishu/poetry.lock index 727abb2c1c9..086d33c47e9 100644 --- a/packages/nonebot-adapter-feishu/poetry.lock +++ b/packages/nonebot-adapter-feishu/poetry.lock @@ -214,7 +214,7 @@ dev = ["codecov (>=2.0.15)", "colorama (>=0.3.4)", "flake8 (>=3.7.7)", "tox (>=3 [[package]] name = "nonebot2" -version = "2.0.0-alpha.14" +version = "2.0.0-alpha.15" description = "An asynchronous python bot framework." category = "main" optional = false @@ -366,16 +366,16 @@ standard = ["websockets (>=9.1)", "httptools (>=0.2.0,<0.3.0)", "watchgod (>=0.6 [[package]] name = "uvloop" -version = "0.15.3" +version = "0.16.0" description = "Fast implementation of asyncio event loop on top of libuv" category = "main" optional = false python-versions = ">=3.7" [package.extras] -dev = ["Cython (>=0.29.20,<0.30.0)", "pytest (>=3.6.0)", "Sphinx (>=1.7.3,<1.8.0)", "sphinxcontrib-asyncio (>=0.2.0,<0.3.0)", "sphinx-rtd-theme (>=0.2.4,<0.3.0)", "aiohttp", "flake8 (>=3.8.4,<3.9.0)", "psutil", "pycodestyle (>=2.6.0,<2.7.0)", "pyOpenSSL (>=19.0.0,<19.1.0)", "mypy (>=0.800)"] -docs = ["Sphinx (>=1.7.3,<1.8.0)", "sphinxcontrib-asyncio (>=0.2.0,<0.3.0)", "sphinx-rtd-theme (>=0.2.4,<0.3.0)"] -test = ["aiohttp", "flake8 (>=3.8.4,<3.9.0)", "psutil", "pycodestyle (>=2.6.0,<2.7.0)", "pyOpenSSL (>=19.0.0,<19.1.0)", "mypy (>=0.800)"] +dev = ["Cython (>=0.29.24,<0.30.0)", "pytest (>=3.6.0)", "Sphinx (>=4.1.2,<4.2.0)", "sphinxcontrib-asyncio (>=0.3.0,<0.4.0)", "sphinx-rtd-theme (>=0.5.2,<0.6.0)", "aiohttp", "flake8 (>=3.9.2,<3.10.0)", "psutil", "pycodestyle (>=2.7.0,<2.8.0)", "pyOpenSSL (>=19.0.0,<19.1.0)", "mypy (>=0.800)"] +docs = ["Sphinx (>=4.1.2,<4.2.0)", "sphinxcontrib-asyncio (>=0.3.0,<0.4.0)", "sphinx-rtd-theme (>=0.5.2,<0.6.0)"] +test = ["aiohttp", "flake8 (>=3.9.2,<3.10.0)", "psutil", "pycodestyle (>=2.7.0,<2.8.0)", "pyOpenSSL (>=19.0.0,<19.1.0)", "mypy (>=0.800)"] [[package]] name = "watchgod" @@ -624,16 +624,22 @@ uvicorn = [ {file = "uvicorn-0.14.0.tar.gz", hash = "sha256:45ad7dfaaa7d55cab4cd1e85e03f27e9d60bc067ddc59db52a2b0aeca8870292"}, ] uvloop = [ - {file = "uvloop-0.15.3-cp37-cp37m-macosx_10_14_x86_64.whl", hash = "sha256:e71fb9038bfcd7646ca126c5ef19b17e48d4af9e838b2bcfda7a9f55a6552a32"}, - {file = "uvloop-0.15.3-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:7522df4e45e4f25b50adbbbeb5bb9847495c438a628177099d2721f2751ff825"}, - {file = "uvloop-0.15.3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ae2b325c0f6d748027f7463077e457006b4fdb35a8788f01754aadba825285ee"}, - {file = "uvloop-0.15.3-cp38-cp38-macosx_10_14_x86_64.whl", hash = "sha256:0de811931e90ae2da9e19ce70ffad73047ab0c1dba7c6e74f9ae1a3aabeb89bd"}, - {file = "uvloop-0.15.3-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:7f4b8a905df909a407c5791fb582f6c03b0d3b491ecdc1cdceaefbc9bf9e08f6"}, - {file = "uvloop-0.15.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2d8ffe44ae709f839c54bacf14ed283f41bee90430c3b398e521e10f8d117b3a"}, - {file = "uvloop-0.15.3-cp39-cp39-macosx_10_14_x86_64.whl", hash = "sha256:63a3288abbc9c8ee979d7e34c34e780b2fbab3e7e53d00b6c80271119f277399"}, - {file = "uvloop-0.15.3-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:5cda65fc60a645470b8525ce014516b120b7057b576fa876cdfdd5e60ab1efbb"}, - {file = "uvloop-0.15.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1ff05116ede1ebdd81802df339e5b1d4cab1dfbd99295bf27e90b4cec64d70e9"}, - {file = "uvloop-0.15.3.tar.gz", hash = "sha256:905f0adb0c09c9f44222ee02f6b96fd88b493478fffb7a345287f9444e926030"}, + {file = "uvloop-0.16.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:6224f1401025b748ffecb7a6e2652b17768f30b1a6a3f7b44660e5b5b690b12d"}, + {file = "uvloop-0.16.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:30ba9dcbd0965f5c812b7c2112a1ddf60cf904c1c160f398e7eed3a6b82dcd9c"}, + {file = "uvloop-0.16.0-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:bd53f7f5db562f37cd64a3af5012df8cac2c464c97e732ed556800129505bd64"}, + {file = "uvloop-0.16.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:772206116b9b57cd625c8a88f2413df2fcfd0b496eb188b82a43bed7af2c2ec9"}, + {file = "uvloop-0.16.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:b572256409f194521a9895aef274cea88731d14732343da3ecdb175228881638"}, + {file = "uvloop-0.16.0-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:04ff57aa137230d8cc968f03481176041ae789308b4d5079118331ab01112450"}, + {file = "uvloop-0.16.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3a19828c4f15687675ea912cc28bbcb48e9bb907c801873bd1519b96b04fb805"}, + {file = "uvloop-0.16.0-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:e814ac2c6f9daf4c36eb8e85266859f42174a4ff0d71b99405ed559257750382"}, + {file = "uvloop-0.16.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:bd8f42ea1ea8f4e84d265769089964ddda95eb2bb38b5cbe26712b0616c3edee"}, + {file = "uvloop-0.16.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:647e481940379eebd314c00440314c81ea547aa636056f554d491e40503c8464"}, + {file = "uvloop-0.16.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8e0d26fa5875d43ddbb0d9d79a447d2ace4180d9e3239788208527c4784f7cab"}, + {file = "uvloop-0.16.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:6ccd57ae8db17d677e9e06192e9c9ec4bd2066b77790f9aa7dede2cc4008ee8f"}, + {file = "uvloop-0.16.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:089b4834fd299d82d83a25e3335372f12117a7d38525217c2258e9b9f4578897"}, + {file = "uvloop-0.16.0-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:98d117332cc9e5ea8dfdc2b28b0a23f60370d02e1395f88f40d1effd2cb86c4f"}, + {file = "uvloop-0.16.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1e5f2e2ff51aefe6c19ee98af12b4ae61f5be456cd24396953244a30880ad861"}, + {file = "uvloop-0.16.0.tar.gz", hash = "sha256:f74bc20c7b67d1c27c72601c78cf95be99d5c2cdd4514502b4f3eb0933ff1228"}, ] watchgod = [ {file = "watchgod-0.7-py3-none-any.whl", hash = "sha256:d6c1ea21df37847ac0537ca0d6c2f4cdf513562e95f77bb93abbcf05573407b7"}, diff --git a/packages/nonebot-adapter-feishu/pyproject.toml b/packages/nonebot-adapter-feishu/pyproject.toml index c517f9176f0..166b05ca133 100644 --- a/packages/nonebot-adapter-feishu/pyproject.toml +++ b/packages/nonebot-adapter-feishu/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "nonebot-adapter-feishu" -version = "2.0.0-alpha.14" +version = "2.0.0-alpha.15" description = "feishu(larksuite) adapter for nonebot2" authors = ["StarHeartHunt "] license = "MIT" diff --git a/packages/nonebot-adapter-mirai/nonebot/adapters/mirai/bot.py b/packages/nonebot-adapter-mirai/nonebot/adapters/mirai/bot.py index de96a29ef77..aa1e1c5c422 100644 --- a/packages/nonebot-adapter-mirai/nonebot/adapters/mirai/bot.py +++ b/packages/nonebot-adapter-mirai/nonebot/adapters/mirai/bot.py @@ -1,5 +1,6 @@ +import asyncio import json -from datetime import datetime, timedelta +from functools import partial from io import BytesIO from ipaddress import IPv4Address from typing import Any, Dict, List, NoReturn, Optional, Tuple, Union @@ -9,7 +10,9 @@ from nonebot.adapters import Bot as BaseBot from nonebot.config import Config -from nonebot.drivers import Driver, ReverseDriver, HTTPConnection, HTTPResponse, WebSocket, ForwardDriver, WebSocketSetup +from nonebot.drivers import (Driver, ForwardDriver, HTTPConnection, + HTTPResponse, ReverseDriver, WebSocket, + WebSocketSetup) from nonebot.exception import ApiNotAvailable from nonebot.typing import overrides @@ -21,8 +24,7 @@ class SessionManager: """Bot会话管理器, 提供API主动调用接口""" - sessions: Dict[int, Tuple[str, datetime, httpx.AsyncClient]] = {} - session_expiry: timedelta = timedelta(minutes=15) + sessions: Dict[int, Tuple[str, httpx.AsyncClient]] = {} def __init__(self, session_key: str, client: httpx.AsyncClient): self.session_key, self.client = session_key, client @@ -126,19 +128,15 @@ async def new(cls, self_id: int, *, host: IPv4Address, port: int, 'qq': self_id }) assert response.json()['code'] == 0 - cls.sessions[self_id] = session_key, datetime.now(), client + cls.sessions[self_id] = session_key, client return cls(session_key, client) @classmethod - def get(cls, - self_id: int, - check_expire: bool = True) -> Optional["SessionManager"]: + def get(cls, self_id: int): if self_id not in cls.sessions: return None - key, time, client = cls.sessions[self_id] - if check_expire and (datetime.now() - time > cls.session_expiry): - return None + key, client = cls.sessions[self_id] return cls(key, client) @@ -165,6 +163,9 @@ def type(self) -> str: def api(self) -> SessionManager: """返回该Bot对象的会话管理实例以提供API主动调用""" api = SessionManager.get(self_id=int(self.self_id)) + if api is None: + if isinstance(self.request, WebSocket): + asyncio.create_task(self.request.close(1000)) assert api is not None, 'SessionManager has not been initialized' return api @@ -192,7 +193,7 @@ async def check_permission( def register(cls, driver: Driver, config: "Config", - qq: Optional[int] = None): + qq: Optional[Union[int, List[int]]] = None): cls.mirai_config = MiraiConfig(**config.dict()) if (cls.mirai_config.auth_key and cls.mirai_config.host and cls.mirai_config.port) is None: @@ -205,11 +206,12 @@ def register(cls, f"Current driver {cls.config.driver} don't support forward connections" ) elif isinstance(driver, ForwardDriver) and qq: + self_ids = [qq] if isinstance(qq, int) else qq - async def url_factory(): + async def url_factory(qq: int): assert cls.mirai_config.host and cls.mirai_config.port and cls.mirai_config.auth_key session = await SessionManager.new( - qq, # type: ignore + qq, host=cls.mirai_config.host, port=cls.mirai_config.port, auth_key=cls.mirai_config.auth_key) @@ -219,7 +221,9 @@ async def url_factory(): url=(f'ws://{cls.mirai_config.host}:{cls.mirai_config.port}' f'/all?sessionKey={session.session_key}')) - driver.setup_websocket(url_factory) + for self_id in self_ids: + driver.setup_websocket(partial(url_factory, qq=self_id)) + elif isinstance(driver, ReverseDriver): logger.debug( 'Param "qq" does not set for mirai adapter, use http post instead' @@ -227,7 +231,6 @@ async def url_factory(): @overrides(BaseBot) async def handle_message(self, message: bytes): - Log.debug(f'received message {message}') try: await process_event( bot=self, diff --git a/packages/nonebot-adapter-mirai/nonebot/adapters/mirai/event/base.py b/packages/nonebot-adapter-mirai/nonebot/adapters/mirai/event/base.py index 8597195f986..6c33ba5a170 100644 --- a/packages/nonebot-adapter-mirai/nonebot/adapters/mirai/event/base.py +++ b/packages/nonebot-adapter-mirai/nonebot/adapters/mirai/event/base.py @@ -9,6 +9,7 @@ from nonebot.adapters import Message as BaseMessage from nonebot.log import logger from nonebot.typing import overrides +from nonebot.utils import escape_tag class UserPermission(str, Enum): @@ -88,7 +89,7 @@ def all_subclasses(cls: Type[Event]): @overrides(BaseEvent) def get_type(self) -> Literal["message", "notice", "request", "meta_event"]: - from . import message, notice, request, meta + from . import message, meta, notice, request if isinstance(self, message.MessageEvent): return 'message' elif isinstance(self, notice.NoticeEvent): @@ -104,7 +105,7 @@ def get_event_name(self) -> str: @overrides(BaseEvent) def get_event_description(self) -> str: - return str(self.normalize_dict()) + return escape_tag(str(self.normalize_dict())) @overrides(BaseEvent) def get_message(self) -> BaseMessage: diff --git a/packages/nonebot-adapter-mirai/poetry.lock b/packages/nonebot-adapter-mirai/poetry.lock index 75c6fdc053a..3f5eecfe025 100644 --- a/packages/nonebot-adapter-mirai/poetry.lock +++ b/packages/nonebot-adapter-mirai/poetry.lock @@ -200,7 +200,7 @@ dev = ["codecov (>=2.0.15)", "colorama (>=0.3.4)", "flake8 (>=3.7.7)", "tox (>=3 [[package]] name = "nonebot2" -version = "2.0.0-alpha.14" +version = "2.0.0-alpha.15" description = "An asynchronous python bot framework." category = "main" optional = false @@ -344,16 +344,16 @@ standard = ["websockets (>=9.1)", "httptools (>=0.2.0,<0.3.0)", "watchgod (>=0.6 [[package]] name = "uvloop" -version = "0.15.3" +version = "0.16.0" description = "Fast implementation of asyncio event loop on top of libuv" category = "main" optional = false python-versions = ">=3.7" [package.extras] -dev = ["Cython (>=0.29.20,<0.30.0)", "pytest (>=3.6.0)", "Sphinx (>=1.7.3,<1.8.0)", "sphinxcontrib-asyncio (>=0.2.0,<0.3.0)", "sphinx-rtd-theme (>=0.2.4,<0.3.0)", "aiohttp", "flake8 (>=3.8.4,<3.9.0)", "psutil", "pycodestyle (>=2.6.0,<2.7.0)", "pyOpenSSL (>=19.0.0,<19.1.0)", "mypy (>=0.800)"] -docs = ["Sphinx (>=1.7.3,<1.8.0)", "sphinxcontrib-asyncio (>=0.2.0,<0.3.0)", "sphinx-rtd-theme (>=0.2.4,<0.3.0)"] -test = ["aiohttp", "flake8 (>=3.8.4,<3.9.0)", "psutil", "pycodestyle (>=2.6.0,<2.7.0)", "pyOpenSSL (>=19.0.0,<19.1.0)", "mypy (>=0.800)"] +dev = ["Cython (>=0.29.24,<0.30.0)", "pytest (>=3.6.0)", "Sphinx (>=4.1.2,<4.2.0)", "sphinxcontrib-asyncio (>=0.3.0,<0.4.0)", "sphinx-rtd-theme (>=0.5.2,<0.6.0)", "aiohttp", "flake8 (>=3.9.2,<3.10.0)", "psutil", "pycodestyle (>=2.7.0,<2.8.0)", "pyOpenSSL (>=19.0.0,<19.1.0)", "mypy (>=0.800)"] +docs = ["Sphinx (>=4.1.2,<4.2.0)", "sphinxcontrib-asyncio (>=0.3.0,<0.4.0)", "sphinx-rtd-theme (>=0.5.2,<0.6.0)"] +test = ["aiohttp", "flake8 (>=3.9.2,<3.10.0)", "psutil", "pycodestyle (>=2.7.0,<2.8.0)", "pyOpenSSL (>=19.0.0,<19.1.0)", "mypy (>=0.800)"] [[package]] name = "watchgod" @@ -566,16 +566,22 @@ uvicorn = [ {file = "uvicorn-0.14.0.tar.gz", hash = "sha256:45ad7dfaaa7d55cab4cd1e85e03f27e9d60bc067ddc59db52a2b0aeca8870292"}, ] uvloop = [ - {file = "uvloop-0.15.3-cp37-cp37m-macosx_10_14_x86_64.whl", hash = "sha256:e71fb9038bfcd7646ca126c5ef19b17e48d4af9e838b2bcfda7a9f55a6552a32"}, - {file = "uvloop-0.15.3-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:7522df4e45e4f25b50adbbbeb5bb9847495c438a628177099d2721f2751ff825"}, - {file = "uvloop-0.15.3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ae2b325c0f6d748027f7463077e457006b4fdb35a8788f01754aadba825285ee"}, - {file = "uvloop-0.15.3-cp38-cp38-macosx_10_14_x86_64.whl", hash = "sha256:0de811931e90ae2da9e19ce70ffad73047ab0c1dba7c6e74f9ae1a3aabeb89bd"}, - {file = "uvloop-0.15.3-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:7f4b8a905df909a407c5791fb582f6c03b0d3b491ecdc1cdceaefbc9bf9e08f6"}, - {file = "uvloop-0.15.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2d8ffe44ae709f839c54bacf14ed283f41bee90430c3b398e521e10f8d117b3a"}, - {file = "uvloop-0.15.3-cp39-cp39-macosx_10_14_x86_64.whl", hash = "sha256:63a3288abbc9c8ee979d7e34c34e780b2fbab3e7e53d00b6c80271119f277399"}, - {file = "uvloop-0.15.3-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:5cda65fc60a645470b8525ce014516b120b7057b576fa876cdfdd5e60ab1efbb"}, - {file = "uvloop-0.15.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1ff05116ede1ebdd81802df339e5b1d4cab1dfbd99295bf27e90b4cec64d70e9"}, - {file = "uvloop-0.15.3.tar.gz", hash = "sha256:905f0adb0c09c9f44222ee02f6b96fd88b493478fffb7a345287f9444e926030"}, + {file = "uvloop-0.16.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:6224f1401025b748ffecb7a6e2652b17768f30b1a6a3f7b44660e5b5b690b12d"}, + {file = "uvloop-0.16.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:30ba9dcbd0965f5c812b7c2112a1ddf60cf904c1c160f398e7eed3a6b82dcd9c"}, + {file = "uvloop-0.16.0-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:bd53f7f5db562f37cd64a3af5012df8cac2c464c97e732ed556800129505bd64"}, + {file = "uvloop-0.16.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:772206116b9b57cd625c8a88f2413df2fcfd0b496eb188b82a43bed7af2c2ec9"}, + {file = "uvloop-0.16.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:b572256409f194521a9895aef274cea88731d14732343da3ecdb175228881638"}, + {file = "uvloop-0.16.0-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:04ff57aa137230d8cc968f03481176041ae789308b4d5079118331ab01112450"}, + {file = "uvloop-0.16.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3a19828c4f15687675ea912cc28bbcb48e9bb907c801873bd1519b96b04fb805"}, + {file = "uvloop-0.16.0-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:e814ac2c6f9daf4c36eb8e85266859f42174a4ff0d71b99405ed559257750382"}, + {file = "uvloop-0.16.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:bd8f42ea1ea8f4e84d265769089964ddda95eb2bb38b5cbe26712b0616c3edee"}, + {file = "uvloop-0.16.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:647e481940379eebd314c00440314c81ea547aa636056f554d491e40503c8464"}, + {file = "uvloop-0.16.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8e0d26fa5875d43ddbb0d9d79a447d2ace4180d9e3239788208527c4784f7cab"}, + {file = "uvloop-0.16.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:6ccd57ae8db17d677e9e06192e9c9ec4bd2066b77790f9aa7dede2cc4008ee8f"}, + {file = "uvloop-0.16.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:089b4834fd299d82d83a25e3335372f12117a7d38525217c2258e9b9f4578897"}, + {file = "uvloop-0.16.0-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:98d117332cc9e5ea8dfdc2b28b0a23f60370d02e1395f88f40d1effd2cb86c4f"}, + {file = "uvloop-0.16.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1e5f2e2ff51aefe6c19ee98af12b4ae61f5be456cd24396953244a30880ad861"}, + {file = "uvloop-0.16.0.tar.gz", hash = "sha256:f74bc20c7b67d1c27c72601c78cf95be99d5c2cdd4514502b4f3eb0933ff1228"}, ] watchgod = [ {file = "watchgod-0.7-py3-none-any.whl", hash = "sha256:d6c1ea21df37847ac0537ca0d6c2f4cdf513562e95f77bb93abbcf05573407b7"}, diff --git a/packages/nonebot-adapter-mirai/pyproject.toml b/packages/nonebot-adapter-mirai/pyproject.toml index f8488df2f91..3a97dfbd050 100644 --- a/packages/nonebot-adapter-mirai/pyproject.toml +++ b/packages/nonebot-adapter-mirai/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "nonebot-adapter-mirai" -version = "2.0.0-alpha.14" +version = "2.0.0-alpha.15" description = "Mirai Api HTTP adapter for nonebot2" authors = ["Mix ", "yanyongyu "] license = "AGPL-3.0-or-later" diff --git a/pages/changelog.md b/pages/changelog.md index 2dc523a544f..1b49d9e6da4 100644 --- a/pages/changelog.md +++ b/pages/changelog.md @@ -4,6 +4,11 @@ sidebar: auto # 更新日志 +## v2.0.0a15 + +- 修复 `fastapi` Driver 未能正确进行 reconnect +- 修复 `MessageSegment` 错误的 Mapping 映射 + ## v2.0.0a14 - 修改日志等级,支持输出等级自定义 diff --git a/poetry.lock b/poetry.lock index da2933bba4b..c031dabcb00 100644 --- a/poetry.lock +++ b/poetry.lock @@ -437,7 +437,7 @@ python-versions = ">=3.6" [[package]] name = "nonebot-adapter-cqhttp" -version = "2.0.0-alpha.14" +version = "2.0.0-alpha.15" description = "OneBot(CQHTTP) adapter for nonebot2" category = "dev" optional = false @@ -454,7 +454,7 @@ url = "packages/nonebot-adapter-cqhttp" [[package]] name = "nonebot-adapter-ding" -version = "2.0.0-alpha.14" +version = "2.0.0-alpha.15" description = "Ding adapter for nonebot2" category = "dev" optional = false @@ -471,7 +471,7 @@ url = "packages/nonebot-adapter-ding" [[package]] name = "nonebot-adapter-feishu" -version = "2.0.0-alpha.14" +version = "2.0.0-alpha.15" description = "feishu(larksuite) adapter for nonebot2" category = "dev" optional = false @@ -490,7 +490,7 @@ url = "packages/nonebot-adapter-feishu" [[package]] name = "nonebot-adapter-mirai" -version = "2.0.0-alpha.14" +version = "2.0.0-alpha.15" description = "Mirai Api HTTP adapter for nonebot2" category = "dev" optional = false @@ -972,16 +972,16 @@ standard = ["websockets (>=9.1)", "httptools (>=0.2.0,<0.3.0)", "watchgod (>=0.6 [[package]] name = "uvloop" -version = "0.15.3" +version = "0.16.0" description = "Fast implementation of asyncio event loop on top of libuv" category = "main" optional = false python-versions = ">=3.7" [package.extras] -dev = ["Cython (>=0.29.20,<0.30.0)", "pytest (>=3.6.0)", "Sphinx (>=1.7.3,<1.8.0)", "sphinxcontrib-asyncio (>=0.2.0,<0.3.0)", "sphinx-rtd-theme (>=0.2.4,<0.3.0)", "aiohttp", "flake8 (>=3.8.4,<3.9.0)", "psutil", "pycodestyle (>=2.6.0,<2.7.0)", "pyOpenSSL (>=19.0.0,<19.1.0)", "mypy (>=0.800)"] -docs = ["Sphinx (>=1.7.3,<1.8.0)", "sphinxcontrib-asyncio (>=0.2.0,<0.3.0)", "sphinx-rtd-theme (>=0.2.4,<0.3.0)"] -test = ["aiohttp", "flake8 (>=3.8.4,<3.9.0)", "psutil", "pycodestyle (>=2.6.0,<2.7.0)", "pyOpenSSL (>=19.0.0,<19.1.0)", "mypy (>=0.800)"] +dev = ["Cython (>=0.29.24,<0.30.0)", "pytest (>=3.6.0)", "Sphinx (>=4.1.2,<4.2.0)", "sphinxcontrib-asyncio (>=0.3.0,<0.4.0)", "sphinx-rtd-theme (>=0.5.2,<0.6.0)", "aiohttp", "flake8 (>=3.9.2,<3.10.0)", "psutil", "pycodestyle (>=2.7.0,<2.8.0)", "pyOpenSSL (>=19.0.0,<19.1.0)", "mypy (>=0.800)"] +docs = ["Sphinx (>=4.1.2,<4.2.0)", "sphinxcontrib-asyncio (>=0.3.0,<0.4.0)", "sphinx-rtd-theme (>=0.5.2,<0.6.0)"] +test = ["aiohttp", "flake8 (>=3.9.2,<3.10.0)", "psutil", "pycodestyle (>=2.7.0,<2.8.0)", "pyOpenSSL (>=19.0.0,<19.1.0)", "mypy (>=0.800)"] [[package]] name = "watchgod" @@ -1373,12 +1373,22 @@ loguru = [ {file = "loguru-0.5.3.tar.gz", hash = "sha256:b28e72ac7a98be3d28ad28570299a393dfcd32e5e3f6a353dec94675767b6319"}, ] markupsafe = [ + {file = "MarkupSafe-2.0.1-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:d8446c54dc28c01e5a2dbac5a25f071f6653e6e40f3a8818e8b45d790fe6ef53"}, + {file = "MarkupSafe-2.0.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:36bc903cbb393720fad60fc28c10de6acf10dc6cc883f3e24ee4012371399a38"}, + {file = "MarkupSafe-2.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2d7d807855b419fc2ed3e631034685db6079889a1f01d5d9dac950f764da3dad"}, + {file = "MarkupSafe-2.0.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:add36cb2dbb8b736611303cd3bfcee00afd96471b09cda130da3581cbdc56a6d"}, + {file = "MarkupSafe-2.0.1-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:168cd0a3642de83558a5153c8bd34f175a9a6e7f6dc6384b9655d2697312a646"}, + {file = "MarkupSafe-2.0.1-cp310-cp310-win32.whl", hash = "sha256:99df47edb6bda1249d3e80fdabb1dab8c08ef3975f69aed437cb69d0a5de1e28"}, + {file = "MarkupSafe-2.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:e0f138900af21926a02425cf736db95be9f4af72ba1bb21453432a07f6082134"}, {file = "MarkupSafe-2.0.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:f9081981fe268bd86831e5c75f7de206ef275defcb82bc70740ae6dc507aee51"}, {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:0955295dd5eec6cb6cc2fe1698f4c6d84af2e92de33fbcac4111913cd100a6ff"}, {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:0446679737af14f45767963a1a9ef7620189912317d095f2d9ffa183a4d25d2b"}, {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux2010_i686.whl", hash = "sha256:f826e31d18b516f653fe296d967d700fddad5901ae07c622bb3705955e1faa94"}, {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:fa130dd50c57d53368c9d59395cb5526eda596d3ffe36666cd81a44d56e48872"}, {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:905fec760bd2fa1388bb5b489ee8ee5f7291d692638ea5f67982d968366bef9f"}, + {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:bf5d821ffabf0ef3533c39c518f3357b171a1651c1ff6827325e4489b0e46c3c"}, + {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:0d4b31cc67ab36e3392bbf3862cfbadac3db12bdd8b02a2731f509ed5b829724"}, + {file = "MarkupSafe-2.0.1-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:baa1a4e8f868845af802979fcdbf0bb11f94f1cb7ced4c4b8a351bb60d108145"}, {file = "MarkupSafe-2.0.1-cp36-cp36m-win32.whl", hash = "sha256:6c4ca60fa24e85fe25b912b01e62cb969d69a23a5d5867682dd3e80b5b02581d"}, {file = "MarkupSafe-2.0.1-cp36-cp36m-win_amd64.whl", hash = "sha256:b2f4bf27480f5e5e8ce285a8c8fd176c0b03e93dcc6646477d4630e83440c6a9"}, {file = "MarkupSafe-2.0.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:0717a7390a68be14b8c793ba258e075c6f4ca819f15edfc2a3a027c823718567"}, @@ -1387,14 +1397,21 @@ markupsafe = [ {file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux2010_i686.whl", hash = "sha256:d7f9850398e85aba693bb640262d3611788b1f29a79f0c93c565694658f4071f"}, {file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:6a7fae0dd14cf60ad5ff42baa2e95727c3d81ded453457771d02b7d2b3f9c0c2"}, {file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:b7f2d075102dc8c794cbde1947378051c4e5180d52d276987b8d28a3bd58c17d"}, + {file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e9936f0b261d4df76ad22f8fee3ae83b60d7c3e871292cd42f40b81b70afae85"}, + {file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:2a7d351cbd8cfeb19ca00de495e224dea7e7d919659c2841bbb7f420ad03e2d6"}, + {file = "MarkupSafe-2.0.1-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:60bf42e36abfaf9aff1f50f52644b336d4f0a3fd6d8a60ca0d054ac9f713a864"}, {file = "MarkupSafe-2.0.1-cp37-cp37m-win32.whl", hash = "sha256:a30e67a65b53ea0a5e62fe23682cfe22712e01f453b95233b25502f7c61cb415"}, {file = "MarkupSafe-2.0.1-cp37-cp37m-win_amd64.whl", hash = "sha256:611d1ad9a4288cf3e3c16014564df047fe08410e628f89805e475368bd304914"}, + {file = "MarkupSafe-2.0.1-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:5bb28c636d87e840583ee3adeb78172efc47c8b26127267f54a9c0ec251d41a9"}, {file = "MarkupSafe-2.0.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:be98f628055368795d818ebf93da628541e10b75b41c559fdf36d104c5787066"}, {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux1_i686.whl", hash = "sha256:1d609f577dc6e1aa17d746f8bd3c31aa4d258f4070d61b2aa5c4166c1539de35"}, {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:7d91275b0245b1da4d4cfa07e0faedd5b0812efc15b702576d103293e252af1b"}, {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux2010_i686.whl", hash = "sha256:01a9b8ea66f1658938f65b93a85ebe8bc016e6769611be228d797c9d998dd298"}, {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:47ab1e7b91c098ab893b828deafa1203de86d0bc6ab587b160f78fe6c4011f75"}, {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:97383d78eb34da7e1fa37dd273c20ad4320929af65d156e35a5e2d89566d9dfb"}, + {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6fcf051089389abe060c9cd7caa212c707e58153afa2c649f00346ce6d260f1b"}, + {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:5855f8438a7d1d458206a2466bf82b0f104a3724bf96a1c781ab731e4201731a"}, + {file = "MarkupSafe-2.0.1-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:3dd007d54ee88b46be476e293f48c85048603f5f516008bee124ddd891398ed6"}, {file = "MarkupSafe-2.0.1-cp38-cp38-win32.whl", hash = "sha256:023cb26ec21ece8dc3907c0e8320058b2e0cb3c55cf9564da612bc325bed5e64"}, {file = "MarkupSafe-2.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:984d76483eb32f1bcb536dc27e4ad56bba4baa70be32fa87152832cdd9db0833"}, {file = "MarkupSafe-2.0.1-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:2ef54abee730b502252bcdf31b10dacb0a416229b72c18b19e24a4509f273d26"}, @@ -1404,6 +1421,9 @@ markupsafe = [ {file = "MarkupSafe-2.0.1-cp39-cp39-manylinux2010_i686.whl", hash = "sha256:4efca8f86c54b22348a5467704e3fec767b2db12fc39c6d963168ab1d3fc9135"}, {file = "MarkupSafe-2.0.1-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:ab3ef638ace319fa26553db0624c4699e31a28bb2a835c5faca8f8acf6a5a902"}, {file = "MarkupSafe-2.0.1-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:f8ba0e8349a38d3001fae7eadded3f6606f0da5d748ee53cc1dab1d6527b9509"}, + {file = "MarkupSafe-2.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c47adbc92fc1bb2b3274c4b3a43ae0e4573d9fbff4f54cd484555edbf030baf1"}, + {file = "MarkupSafe-2.0.1-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_12_i686.manylinux2010_i686.whl", hash = "sha256:37205cac2a79194e3750b0af2a5720d95f786a55ce7df90c3af697bfa100eaac"}, + {file = "MarkupSafe-2.0.1-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:1f2ade76b9903f39aa442b4aadd2177decb66525062db244b35d71d0ee8599b6"}, {file = "MarkupSafe-2.0.1-cp39-cp39-win32.whl", hash = "sha256:10f82115e21dc0dfec9ab5c0223652f7197feb168c940f3ef61563fc2d6beb74"}, {file = "MarkupSafe-2.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:693ce3f9e70a6cf7d2fb9e6c9d8b204b6b39897a2c4a1aa65728d5ac97dcc1d8"}, {file = "MarkupSafe-2.0.1.tar.gz", hash = "sha256:594c67807fb16238b30c44bdf74f36c02cdf22d1c8cda91ef8a0ed8dabf5620a"}, @@ -1705,16 +1725,22 @@ uvicorn = [ {file = "uvicorn-0.14.0.tar.gz", hash = "sha256:45ad7dfaaa7d55cab4cd1e85e03f27e9d60bc067ddc59db52a2b0aeca8870292"}, ] uvloop = [ - {file = "uvloop-0.15.3-cp37-cp37m-macosx_10_14_x86_64.whl", hash = "sha256:e71fb9038bfcd7646ca126c5ef19b17e48d4af9e838b2bcfda7a9f55a6552a32"}, - {file = "uvloop-0.15.3-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:7522df4e45e4f25b50adbbbeb5bb9847495c438a628177099d2721f2751ff825"}, - {file = "uvloop-0.15.3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ae2b325c0f6d748027f7463077e457006b4fdb35a8788f01754aadba825285ee"}, - {file = "uvloop-0.15.3-cp38-cp38-macosx_10_14_x86_64.whl", hash = "sha256:0de811931e90ae2da9e19ce70ffad73047ab0c1dba7c6e74f9ae1a3aabeb89bd"}, - {file = "uvloop-0.15.3-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:7f4b8a905df909a407c5791fb582f6c03b0d3b491ecdc1cdceaefbc9bf9e08f6"}, - {file = "uvloop-0.15.3-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2d8ffe44ae709f839c54bacf14ed283f41bee90430c3b398e521e10f8d117b3a"}, - {file = "uvloop-0.15.3-cp39-cp39-macosx_10_14_x86_64.whl", hash = "sha256:63a3288abbc9c8ee979d7e34c34e780b2fbab3e7e53d00b6c80271119f277399"}, - {file = "uvloop-0.15.3-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:5cda65fc60a645470b8525ce014516b120b7057b576fa876cdfdd5e60ab1efbb"}, - {file = "uvloop-0.15.3-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1ff05116ede1ebdd81802df339e5b1d4cab1dfbd99295bf27e90b4cec64d70e9"}, - {file = "uvloop-0.15.3.tar.gz", hash = "sha256:905f0adb0c09c9f44222ee02f6b96fd88b493478fffb7a345287f9444e926030"}, + {file = "uvloop-0.16.0-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:6224f1401025b748ffecb7a6e2652b17768f30b1a6a3f7b44660e5b5b690b12d"}, + {file = "uvloop-0.16.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:30ba9dcbd0965f5c812b7c2112a1ddf60cf904c1c160f398e7eed3a6b82dcd9c"}, + {file = "uvloop-0.16.0-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:bd53f7f5db562f37cd64a3af5012df8cac2c464c97e732ed556800129505bd64"}, + {file = "uvloop-0.16.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:772206116b9b57cd625c8a88f2413df2fcfd0b496eb188b82a43bed7af2c2ec9"}, + {file = "uvloop-0.16.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:b572256409f194521a9895aef274cea88731d14732343da3ecdb175228881638"}, + {file = "uvloop-0.16.0-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:04ff57aa137230d8cc968f03481176041ae789308b4d5079118331ab01112450"}, + {file = "uvloop-0.16.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3a19828c4f15687675ea912cc28bbcb48e9bb907c801873bd1519b96b04fb805"}, + {file = "uvloop-0.16.0-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:e814ac2c6f9daf4c36eb8e85266859f42174a4ff0d71b99405ed559257750382"}, + {file = "uvloop-0.16.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:bd8f42ea1ea8f4e84d265769089964ddda95eb2bb38b5cbe26712b0616c3edee"}, + {file = "uvloop-0.16.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:647e481940379eebd314c00440314c81ea547aa636056f554d491e40503c8464"}, + {file = "uvloop-0.16.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8e0d26fa5875d43ddbb0d9d79a447d2ace4180d9e3239788208527c4784f7cab"}, + {file = "uvloop-0.16.0-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:6ccd57ae8db17d677e9e06192e9c9ec4bd2066b77790f9aa7dede2cc4008ee8f"}, + {file = "uvloop-0.16.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:089b4834fd299d82d83a25e3335372f12117a7d38525217c2258e9b9f4578897"}, + {file = "uvloop-0.16.0-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:98d117332cc9e5ea8dfdc2b28b0a23f60370d02e1395f88f40d1effd2cb86c4f"}, + {file = "uvloop-0.16.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1e5f2e2ff51aefe6c19ee98af12b4ae61f5be456cd24396953244a30880ad861"}, + {file = "uvloop-0.16.0.tar.gz", hash = "sha256:f74bc20c7b67d1c27c72601c78cf95be99d5c2cdd4514502b4f3eb0933ff1228"}, ] watchgod = [ {file = "watchgod-0.7-py3-none-any.whl", hash = "sha256:d6c1ea21df37847ac0537ca0d6c2f4cdf513562e95f77bb93abbcf05573407b7"}, diff --git a/pyproject.toml b/pyproject.toml index 3f286a32c69..ad958f5f83b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "nonebot2" -version = "2.0.0-alpha.14" +version = "2.0.0-alpha.15" description = "An asynchronous python bot framework." authors = ["yanyongyu "] license = "MIT"