diff --git a/nonebot_plugin_value/action_type.py b/nonebot_plugin_value/action_type.py index 9b85f5f..9826d6c 100644 --- a/nonebot_plugin_value/action_type.py +++ b/nonebot_plugin_value/action_type.py @@ -8,7 +8,3 @@ class Method(str, Enum): WITHDRAW = "WITHDRAW" # 取款 TRANSFER_IN = "TRANSFER_IN" # 转入(与转出同时存在) TRANSFER_OUT = "TRANSFER_OUT" # 转出(与转入同时存在) - - @classmethod - def valid_actions(cls, action: str) -> bool: - return action in cls.__dict__.values() diff --git a/nonebot_plugin_value/api/api_balance.py b/nonebot_plugin_value/api/api_balance.py index d582b1a..396c344 100644 --- a/nonebot_plugin_value/api/api_balance.py +++ b/nonebot_plugin_value/api/api_balance.py @@ -11,7 +11,7 @@ from ..services.balance import set_frozen as _set_frozen from ..services.balance import set_frozen_all as _set_frozen_all from ..services.balance import transfer_funds as _transfer -from .api_currency import get_default_currency as _get_default +from ..uuid_lib import DEFAULT_CURRENCY_UUID async def set_frozen_all(account_id: str, frozen: bool) -> None: @@ -47,7 +47,7 @@ async def list_accounts(currency_id: str | None = None) -> list[UserAccountData] list[UserAccountData]: 包含用户数据的列表 """ if currency_id is None: - currency_id = (await _get_default()).id + currency_id = DEFAULT_CURRENCY_UUID.hex async with get_session() as session: return [ UserAccountData( @@ -72,7 +72,7 @@ async def del_account(user_id: str, currency_id: str | None = None) -> bool: bool: 是否成功 """ if currency_id is None: - currency_id = (await _get_default()).id + currency_id = DEFAULT_CURRENCY_UUID.hex return await _del_account(user_id, currency_id=currency_id) @@ -89,7 +89,7 @@ async def get_or_create_account( UserAccountData: 用户数据 """ if currency_id is None: - currency_id = (await _get_default()).id + currency_id = DEFAULT_CURRENCY_UUID.hex async with get_session() as session: data = await _go_account(user_id, currency_id, session) session.add(data) @@ -113,7 +113,7 @@ async def batch_del_balance( """ data_list: list[UserAccountData] = [] if currency_id is None: - currency_id = (await _get_default()).id + currency_id = DEFAULT_CURRENCY_UUID.hex await _batch_del(updates, currency_id, source, return_all_on_fail=True) for user_id, _ in updates: data_list.append(await get_or_create_account(user_id, currency_id)) @@ -137,7 +137,7 @@ async def batch_add_balance( """ data_list: list[UserAccountData] = [] if currency_id is None: - currency_id = (await _get_default()).id + currency_id = DEFAULT_CURRENCY_UUID.hex await _batch_add(updates, currency_id, source, return_all_on_fail=True) for user_id, _ in updates: data_list.append(await get_or_create_account(user_id, currency_id)) @@ -166,7 +166,7 @@ async def add_balance( """ if currency_id is None: - currency_id = (await _get_default()).id + currency_id = DEFAULT_CURRENCY_UUID.hex data = await _a_balance(user_id, currency_id, amount, source) if not data.success: raise RuntimeError(data.message) @@ -194,7 +194,7 @@ async def del_balance( UserAccountData: 用户数据 """ if currency_id is None: - currency_id = (await _get_default()).id + currency_id = DEFAULT_CURRENCY_UUID.hex data = await _d_balance(user_id, currency_id, amount, source) if not data.success: raise RuntimeError(data.message) @@ -224,7 +224,7 @@ async def transfer_funds( UserAccountData: 用户账户数据 """ if currency_id is None: - currency_id = (await _get_default()).id + currency_id = DEFAULT_CURRENCY_UUID.hex if not source: source = f"from '{from_id}' to '{to_id}'" data = await _transfer(from_id, to_id, currency_id, amount, source) diff --git a/nonebot_plugin_value/api/depends/data_classes.py b/nonebot_plugin_value/api/depends/data_classes.py index 50b5f74..50bc127 100644 --- a/nonebot_plugin_value/api/depends/data_classes.py +++ b/nonebot_plugin_value/api/depends/data_classes.py @@ -2,7 +2,7 @@ from nonebot.adapters import Event -from ...uuid_lib import to_uuid +from ...uuid_lib import DEFAULT_CURRENCY_UUID, to_uuid from ..api_balance import UserAccountData, get_or_create_account from ..api_currency import CurrencyData, get_currency, get_default_currency from ..api_transaction import ( @@ -34,7 +34,7 @@ class Account: async def __call__(self, event: Event) -> UserAccountData: if self.currency_id is None: - self.currency_id = (await get_default_currency()).id + self.currency_id = DEFAULT_CURRENCY_UUID.hex return await get_or_create_account( to_uuid(event.get_user_id()), self.currency_id ) diff --git a/nonebot_plugin_value/api/depends/factory.py b/nonebot_plugin_value/api/depends/factory.py index eb0e3f8..5a8ded9 100644 --- a/nonebot_plugin_value/api/depends/factory.py +++ b/nonebot_plugin_value/api/depends/factory.py @@ -1,8 +1,10 @@ from collections.abc import Awaitable, Callable +from typing import Any from ...pyd_models.balance_pyd import UserAccountData from ...pyd_models.currency_pyd import CurrencyData from ...pyd_models.transaction_pyd import TransactionData +from ...uuid_lib import DEFAULT_CURRENCY_UUID from ..executor import AccountExecutor from .data_classes import Account, Currency, TransactionHistory @@ -60,7 +62,8 @@ def transaction_data( @staticmethod def account_executor( *, - currency_id: str | None = None, + currency_id: str = DEFAULT_CURRENCY_UUID.hex, + **kwargs: Any, ) -> Callable[..., Awaitable[AccountExecutor]]: """ Args: @@ -69,4 +72,4 @@ def account_executor( Returns: Callable[..., Awaitable[AccountExecutor]]: 账号数据操作对象 """ - return AccountExecutor(currency_id) + return AccountExecutor(currency_id=currency_id, **kwargs) diff --git a/nonebot_plugin_value/api/executor.py b/nonebot_plugin_value/api/executor.py index 12d2617..5db950e 100644 --- a/nonebot_plugin_value/api/executor.py +++ b/nonebot_plugin_value/api/executor.py @@ -3,28 +3,24 @@ from nonebot.adapters import Event from typing_extensions import Self -from ..uuid_lib import to_uuid +from ..uuid_lib import DEFAULT_CURRENCY_UUID, to_uuid from .api_balance import ( UserAccountData, add_balance, del_balance, get_or_create_account, ) -from .api_currency import get_default_currency @dataclass class AccountExecutor: - currency_id: str | None = field(default=None) + currency_id: str = field(default=DEFAULT_CURRENCY_UUID.hex) user_id: str = field(default="") data_map: dict[str, UserAccountData] = field(default_factory=lambda: {}) async def __call__(self, event: Event) -> Self: self.user_id = to_uuid(event.get_user_id()) - if self.currency_id is None: - currency_id = (await get_default_currency()).id - else: - currency_id = self.currency_id + currency_id = self.currency_id self.data_map[currency_id] = await get_or_create_account( self.user_id, currency_id ) @@ -40,11 +36,15 @@ async def get_data(self, currency_id: str | None = None) -> UserAccountData: UserAccountData: 账号数据 """ currency_id = currency_id or self.currency_id - assert currency_id is not None, "Currency ID is required" - return self.data_map.get( + if data := self.data_map.get( + currency_id, + ): + return data + self.data_map[currency_id] = self.data_map.get( currency_id, await get_or_create_account(self.user_id, currency_id), ) + return self.data_map[currency_id] async def get_balance( self, @@ -77,7 +77,6 @@ async def add_balance( Self: Self """ currency_id = currency_id or self.currency_id - assert currency_id is not None, "Currency ID is required" self.data_map[currency_id] = await add_balance( self.user_id, amount, @@ -103,7 +102,6 @@ async def decrease_balance( Self: Self """ currency_id = currency_id or self.currency_id - assert currency_id is not None, "Currency ID is required" self.data_map[currency_id] = await del_balance( self.user_id, amount, diff --git a/nonebot_plugin_value/hook/hooks_manager.py b/nonebot_plugin_value/hook/hooks_manager.py index 8e0be48..6016da7 100644 --- a/nonebot_plugin_value/hook/hooks_manager.py +++ b/nonebot_plugin_value/hook/hooks_manager.py @@ -1,11 +1,10 @@ # 事件预处理/后处理钩子 from collections.abc import Awaitable, Callable -from typing import Any from nonebot import logger from .context import TransactionComplete, TransactionContext -from .exception import CancelAction +from .exception import CancelAction, DataUpdate from .hooks_type import HooksType @@ -13,8 +12,7 @@ class HooksManager: __hooks: dict[str, list[Callable[..., Awaitable[None]]]] _instance = None - def __new__(cls, *args: Any, **kwargs: Any): - """重写 __new__ 方法实现单例模式""" + def __new__(cls): if cls._instance is None: cls._instance = super().__new__(cls) cls._instance.__hooks = {} @@ -38,7 +36,7 @@ def register( self, hook_name: str, hook_func: Callable[..., Awaitable[None]] ) -> None: """注册一个Hook""" - if not HooksType.valid_hooks(hook_name): + if hook_name not in HooksType: raise ValueError(f"Invalid hook name: {hook_name}") self.__hooks.setdefault(hook_name, []).append(hook_func) @@ -51,7 +49,7 @@ async def run_hooks( async def _run_single_hook(hook: Callable[..., Awaitable[None]]) -> None: try: await hook(context) - except CancelAction: + except CancelAction | DataUpdate: raise except Exception: logger.opt(exception=True).error("钩子执行失败") diff --git a/nonebot_plugin_value/hook/hooks_type.py b/nonebot_plugin_value/hook/hooks_type.py index b3a45e3..e9ecf08 100644 --- a/nonebot_plugin_value/hook/hooks_type.py +++ b/nonebot_plugin_value/hook/hooks_type.py @@ -1,19 +1,17 @@ -class HooksType: - __pre = "vault_pre_transaction" - __post = "vault_post_transaction" +from enum import Enum + + +class HooksType(str, Enum): + PRE = "vault_pre_transaction" + POST = "vault_post_transaction" @classmethod def pre(cls) -> str: - return cls.__pre + return cls.PRE.value @classmethod def post(cls) -> str: - return cls.__post - - @classmethod - def valid_hooks(cls, hook_name: str) -> bool: - return hook_name in [cls.__pre, cls.__post] - + return cls.POST.value @classmethod def methods(cls) -> list[str]: - return [cls.__pre, cls.__post] + return [hook.value for hook in cls] diff --git a/nonebot_plugin_value/models/balance.py b/nonebot_plugin_value/models/balance.py index a5e02d0..115108f 100644 --- a/nonebot_plugin_value/models/balance.py +++ b/nonebot_plugin_value/models/balance.py @@ -14,7 +14,7 @@ ) from sqlalchemy.orm import MappedColumn, mapped_column, relationship -from ..uuid_lib import NAMESPACE_VALUE +from ..uuid_lib import NAMESPACE_VALUE, get_uni_id from .utils import OnDeleteEnum @@ -63,7 +63,9 @@ def __init__(self, **kwargs: Any): raise ValueError("id and currency_id must be provided") if "uni_id" not in kwargs: namespace = NAMESPACE_VALUE - uni_id_val = uuid.uuid5(namespace, kwargs["id"] + kwargs["currency_id"]) + uni_id_val = uuid.uuid5( + namespace, get_uni_id(kwargs["id"], kwargs["currency_id"]) + ) kwargs["id"] = uni_id_val super().__init__(**kwargs) diff --git a/nonebot_plugin_value/repository.py b/nonebot_plugin_value/repository.py index 55f3f68..b9c56b0 100644 --- a/nonebot_plugin_value/repository.py +++ b/nonebot_plugin_value/repository.py @@ -1,7 +1,7 @@ # Repository,更加底层的数据库操作接口 from collections.abc import Sequence from datetime import datetime, timezone -from uuid import uuid1, uuid5 +from uuid import uuid1 from nonebot import logger from nonebot_plugin_orm import AsyncSession @@ -17,10 +17,13 @@ from .models.balance import Transaction, UserAccount from .models.currency import CurrencyMeta from .pyd_models.currency_pyd import CurrencyData -from .uuid_lib import NAMESPACE_VALUE, get_uni_id +from .uuid_lib import DEFAULT_CURRENCY_UUID, DEFAULT_NAME, NAMESPACE_VALUE, get_uni_id -DEFAULT_NAME = "DEFAULT_CURRENCY_USD" -DEFAULT_CURRENCY_UUID = uuid5(NAMESPACE_VALUE, DEFAULT_NAME) +__all__ = [ + "DEFAULT_CURRENCY_UUID", + "DEFAULT_NAME", + "NAMESPACE_VALUE", +] class CurrencyRepository: diff --git a/nonebot_plugin_value/services/balance.py b/nonebot_plugin_value/services/balance.py index 023cb68..09ff392 100644 --- a/nonebot_plugin_value/services/balance.py +++ b/nonebot_plugin_value/services/balance.py @@ -185,7 +185,7 @@ async def del_balance( account_id = account.id try: await HooksManager().run_hooks( - HooksType.pre(), + HooksType.PRE.value, TransactionContext( user_id=user_id, currency=currency_id, @@ -218,7 +218,7 @@ async def del_balance( ) try: await HooksManager().run_hooks( - HooksType.post(), + HooksType.POST.value, TransactionComplete( message="交易完成", source_balance=balance_before, @@ -298,7 +298,7 @@ async def add_balance( balance_before = account.balance try: await HooksManager().run_hooks( - HooksType.pre(), + HooksType.PRE.value, TransactionContext( user_id=user_id, currency=currency_id, @@ -329,7 +329,7 @@ async def add_balance( ) try: await HooksManager().run_hooks( - HooksType.post(), + HooksType.POST.value, TransactionComplete( message="交易完成", source_balance=balance_before, @@ -396,7 +396,7 @@ async def transfer_funds( try: try: await HooksManager().run_hooks( - HooksType.pre(), + HooksType.PRE.value, TransactionContext( user_id=fromuser_id, currency=currency_id, @@ -408,7 +408,7 @@ async def transfer_funds( amount = abs(du.amount) try: await HooksManager().run_hooks( - HooksType.pre(), + HooksType.PRE.value, TransactionContext( user_id=touser_id, currency=currency_id, @@ -454,7 +454,7 @@ async def transfer_funds( ) try: await HooksManager().run_hooks( - HooksType.post(), + HooksType.POST.value, TransactionComplete( message="交易完成(转账)", source_balance=from_balance_before, @@ -464,7 +464,7 @@ async def transfer_funds( ), ) await HooksManager().run_hooks( - HooksType.post(), + HooksType.POST.value, TransactionComplete( message="交易完成(转账)", source_balance=to_balance_before, diff --git a/nonebot_plugin_value/uuid_lib.py b/nonebot_plugin_value/uuid_lib.py index 1035ed9..2b1a677 100644 --- a/nonebot_plugin_value/uuid_lib.py +++ b/nonebot_plugin_value/uuid_lib.py @@ -2,7 +2,8 @@ # UUID namespace常量定义。 NAMESPACE_VALUE = UUID("e6fec076-98df-4979-8618-36ad04dea39f") - +DEFAULT_NAME = "DEFAULT_CURRENCY_USD" +DEFAULT_CURRENCY_UUID = uuid5(NAMESPACE_VALUE, DEFAULT_NAME) def to_uuid(s: str) -> str: """获取UUID diff --git a/pyproject.toml b/pyproject.toml index e8a1de9..c755966 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "nonebot-plugin-value" -version = "0.1.4.post1" +version = "0.1.5" description = "Economy API for NoneBot2" readme = "README.md" requires-python = ">=3.10, <4.0.0" @@ -20,6 +20,7 @@ dev-dependencies = [ "nb-cli>=1.4.1", "alembic>=1.16.2", "nonebot-plugin-orm[default]>=0.7.4", + "nonebot-adapter-onebot>=2.4.6", "ruff>=0.12.0", "pyright>=1.0.0", "aiosqlite>=0.19.0", diff --git a/tests/value_tests/depends.py b/tests/value_tests/depends.py new file mode 100644 index 0000000..459a951 --- /dev/null +++ b/tests/value_tests/depends.py @@ -0,0 +1,35 @@ +import pytest +from nonebug import App # type: ignore + + +def make_event(): + from nonebot.adapters.onebot.v11 import Message, MessageEvent + from nonebot.adapters.onebot.v11.event import Sender + + return MessageEvent( + time=0, + self_id=0, + user_id=123456789, + post_type="message", + message=Message(""), + sub_type="friend", + message_type="private", + message_id=0, + raw_message="", + font=0, + sender=Sender(), + original_message=Message(), + ) + + +@pytest.mark.asyncio +async def test_depends(app: App): + from nonebot_plugin_value.api.api_balance import del_account + from nonebot_plugin_value.api.depends.factory import DependsSwitch + from nonebot_plugin_value.uuid_lib import to_uuid + + uid = to_uuid("123456789") + executor = await (DependsSwitch().account_executor())(make_event()) + await executor.add_balance(100) + assert await executor.get_balance() == 100.0 + await del_account(uid) diff --git a/uv.lock b/uv.lock index 1b79b5b..50b1d73 100644 --- a/uv.lock +++ b/uv.lock @@ -569,6 +569,54 @@ wheels = [ { url = "https://mirrors.aliyun.com/pypi/packages/b3/38/89ba8ad64ae25be8de66a6d463314cf1eb366222074cfda9ee839c56a4b4/mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8" }, ] +[[package]] +name = "msgpack" +version = "1.1.1" +source = { registry = "https://mirrors.aliyun.com/pypi/simple" } +sdist = { url = "https://mirrors.aliyun.com/pypi/packages/45/b1/ea4f68038a18c77c9467400d166d74c4ffa536f34761f7983a104357e614/msgpack-1.1.1.tar.gz", hash = "sha256:77b79ce34a2bdab2594f490c8e80dd62a02d650b91a75159a63ec413b8d104cd" } +wheels = [ + { url = "https://mirrors.aliyun.com/pypi/packages/33/52/f30da112c1dc92cf64f57d08a273ac771e7b29dea10b4b30369b2d7e8546/msgpack-1.1.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:353b6fc0c36fde68b661a12949d7d49f8f51ff5fa019c1e47c87c4ff34b080ed" }, + { url = "https://mirrors.aliyun.com/pypi/packages/e4/35/7bfc0def2f04ab4145f7f108e3563f9b4abae4ab0ed78a61f350518cc4d2/msgpack-1.1.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:79c408fcf76a958491b4e3b103d1c417044544b68e96d06432a189b43d1215c8" }, + { url = "https://mirrors.aliyun.com/pypi/packages/e8/c5/df5d6c1c39856bc55f800bf82778fd4c11370667f9b9e9d51b2f5da88f20/msgpack-1.1.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:78426096939c2c7482bf31ef15ca219a9e24460289c00dd0b94411040bb73ad2" }, + { url = "https://mirrors.aliyun.com/pypi/packages/20/8e/0bb8c977efecfe6ea7116e2ed73a78a8d32a947f94d272586cf02a9757db/msgpack-1.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8b17ba27727a36cb73aabacaa44b13090feb88a01d012c0f4be70c00f75048b4" }, + { url = "https://mirrors.aliyun.com/pypi/packages/59/a1/731d52c1aeec52006be6d1f8027c49fdc2cfc3ab7cbe7c28335b2910d7b6/msgpack-1.1.1-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7a17ac1ea6ec3c7687d70201cfda3b1e8061466f28f686c24f627cae4ea8efd0" }, + { url = "https://mirrors.aliyun.com/pypi/packages/2b/92/b42911c52cda2ba67a6418ffa7d08969edf2e760b09015593c8a8a27a97d/msgpack-1.1.1-cp310-cp310-musllinux_1_2_aarch64.whl", hash = "sha256:88d1e966c9235c1d4e2afac21ca83933ba59537e2e2727a999bf3f515ca2af26" }, + { url = "https://mirrors.aliyun.com/pypi/packages/61/dc/8ae165337e70118d4dab651b8b562dd5066dd1e6dd57b038f32ebc3e2f07/msgpack-1.1.1-cp310-cp310-musllinux_1_2_i686.whl", hash = "sha256:f6d58656842e1b2ddbe07f43f56b10a60f2ba5826164910968f5933e5178af75" }, + { url = "https://mirrors.aliyun.com/pypi/packages/58/27/555851cb98dcbd6ce041df1eacb25ac30646575e9cd125681aa2f4b1b6f1/msgpack-1.1.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:96decdfc4adcbc087f5ea7ebdcfd3dee9a13358cae6e81d54be962efc38f6338" }, + { url = "https://mirrors.aliyun.com/pypi/packages/d4/64/39a26add4ce16f24e99eabb9005e44c663db00e3fce17d4ae1ae9d61df99/msgpack-1.1.1-cp310-cp310-win32.whl", hash = "sha256:6640fd979ca9a212e4bcdf6eb74051ade2c690b862b679bfcb60ae46e6dc4bfd" }, + { url = "https://mirrors.aliyun.com/pypi/packages/7d/18/73dfa3e9d5d7450d39debde5b0d848139f7de23bd637a4506e36c9800fd6/msgpack-1.1.1-cp310-cp310-win_amd64.whl", hash = "sha256:8b65b53204fe1bd037c40c4148d00ef918eb2108d24c9aaa20bc31f9810ce0a8" }, + { url = "https://mirrors.aliyun.com/pypi/packages/7f/83/97f24bf9848af23fe2ba04380388216defc49a8af6da0c28cc636d722502/msgpack-1.1.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:71ef05c1726884e44f8b1d1773604ab5d4d17729d8491403a705e649116c9558" }, + { url = "https://mirrors.aliyun.com/pypi/packages/aa/7f/2eaa388267a78401f6e182662b08a588ef4f3de6f0eab1ec09736a7aaa2b/msgpack-1.1.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:36043272c6aede309d29d56851f8841ba907a1a3d04435e43e8a19928e243c1d" }, + { url = "https://mirrors.aliyun.com/pypi/packages/f8/46/31eb60f4452c96161e4dfd26dbca562b4ec68c72e4ad07d9566d7ea35e8a/msgpack-1.1.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a32747b1b39c3ac27d0670122b57e6e57f28eefb725e0b625618d1b59bf9d1e0" }, + { url = "https://mirrors.aliyun.com/pypi/packages/45/16/a20fa8c32825cc7ae8457fab45670c7a8996d7746ce80ce41cc51e3b2bd7/msgpack-1.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8a8b10fdb84a43e50d38057b06901ec9da52baac6983d3f709d8507f3889d43f" }, + { url = "https://mirrors.aliyun.com/pypi/packages/86/ea/6c958e07692367feeb1a1594d35e22b62f7f476f3c568b002a5ea09d443d/msgpack-1.1.1-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ba0c325c3f485dc54ec298d8b024e134acf07c10d494ffa24373bea729acf704" }, + { url = "https://mirrors.aliyun.com/pypi/packages/75/05/ac84063c5dae79722bda9f68b878dc31fc3059adb8633c79f1e82c2cd946/msgpack-1.1.1-cp311-cp311-musllinux_1_2_aarch64.whl", hash = "sha256:88daaf7d146e48ec71212ce21109b66e06a98e5e44dca47d853cbfe171d6c8d2" }, + { url = "https://mirrors.aliyun.com/pypi/packages/69/e8/fe86b082c781d3e1c09ca0f4dacd457ede60a13119b6ce939efe2ea77b76/msgpack-1.1.1-cp311-cp311-musllinux_1_2_i686.whl", hash = "sha256:d8b55ea20dc59b181d3f47103f113e6f28a5e1c89fd5b67b9140edb442ab67f2" }, + { url = "https://mirrors.aliyun.com/pypi/packages/3b/2b/bafc9924df52d8f3bb7c00d24e57be477f4d0f967c0a31ef5e2225e035c7/msgpack-1.1.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:4a28e8072ae9779f20427af07f53bbb8b4aa81151054e882aee333b158da8752" }, + { url = "https://mirrors.aliyun.com/pypi/packages/a2/3b/1f717e17e53e0ed0b68fa59e9188f3f610c79d7151f0e52ff3cd8eb6b2dc/msgpack-1.1.1-cp311-cp311-win32.whl", hash = "sha256:7da8831f9a0fdb526621ba09a281fadc58ea12701bc709e7b8cbc362feabc295" }, + { url = "https://mirrors.aliyun.com/pypi/packages/48/45/9d1780768d3b249accecc5a38c725eb1e203d44a191f7b7ff1941f7df60c/msgpack-1.1.1-cp311-cp311-win_amd64.whl", hash = "sha256:5fd1b58e1431008a57247d6e7cc4faa41c3607e8e7d4aaf81f7c29ea013cb458" }, + { url = "https://mirrors.aliyun.com/pypi/packages/e3/26/389b9c593eda2b8551b2e7126ad3a06af6f9b44274eb3a4f054d48ff7e47/msgpack-1.1.1-cp312-cp312-macosx_10_13_x86_64.whl", hash = "sha256:ae497b11f4c21558d95de9f64fff7053544f4d1a17731c866143ed6bb4591238" }, + { url = "https://mirrors.aliyun.com/pypi/packages/ab/65/7d1de38c8a22cf8b1551469159d4b6cf49be2126adc2482de50976084d78/msgpack-1.1.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:33be9ab121df9b6b461ff91baac6f2731f83d9b27ed948c5b9d1978ae28bf157" }, + { url = "https://mirrors.aliyun.com/pypi/packages/0f/bd/cacf208b64d9577a62c74b677e1ada005caa9b69a05a599889d6fc2ab20a/msgpack-1.1.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6f64ae8fe7ffba251fecb8408540c34ee9df1c26674c50c4544d72dbf792e5ce" }, + { url = "https://mirrors.aliyun.com/pypi/packages/4d/ec/fd869e2567cc9c01278a736cfd1697941ba0d4b81a43e0aa2e8d71dab208/msgpack-1.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a494554874691720ba5891c9b0b39474ba43ffb1aaf32a5dac874effb1619e1a" }, + { url = "https://mirrors.aliyun.com/pypi/packages/55/2a/35860f33229075bce803a5593d046d8b489d7ba2fc85701e714fc1aaf898/msgpack-1.1.1-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:cb643284ab0ed26f6957d969fe0dd8bb17beb567beb8998140b5e38a90974f6c" }, + { url = "https://mirrors.aliyun.com/pypi/packages/8c/16/69ed8f3ada150bf92745fb4921bd621fd2cdf5a42e25eb50bcc57a5328f0/msgpack-1.1.1-cp312-cp312-musllinux_1_2_aarch64.whl", hash = "sha256:d275a9e3c81b1093c060c3837e580c37f47c51eca031f7b5fb76f7b8470f5f9b" }, + { url = "https://mirrors.aliyun.com/pypi/packages/c6/b6/0c398039e4c6d0b2e37c61d7e0e9d13439f91f780686deb8ee64ecf1ae71/msgpack-1.1.1-cp312-cp312-musllinux_1_2_i686.whl", hash = "sha256:4fd6b577e4541676e0cc9ddc1709d25014d3ad9a66caa19962c4f5de30fc09ef" }, + { url = "https://mirrors.aliyun.com/pypi/packages/b8/d0/0cf4a6ecb9bc960d624c93effaeaae75cbf00b3bc4a54f35c8507273cda1/msgpack-1.1.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:bb29aaa613c0a1c40d1af111abf025f1732cab333f96f285d6a93b934738a68a" }, + { url = "https://mirrors.aliyun.com/pypi/packages/62/83/9697c211720fa71a2dfb632cad6196a8af3abea56eece220fde4674dc44b/msgpack-1.1.1-cp312-cp312-win32.whl", hash = "sha256:870b9a626280c86cff9c576ec0d9cbcc54a1e5ebda9cd26dab12baf41fee218c" }, + { url = "https://mirrors.aliyun.com/pypi/packages/c0/23/0abb886e80eab08f5e8c485d6f13924028602829f63b8f5fa25a06636628/msgpack-1.1.1-cp312-cp312-win_amd64.whl", hash = "sha256:5692095123007180dca3e788bb4c399cc26626da51629a31d40207cb262e67f4" }, + { url = "https://mirrors.aliyun.com/pypi/packages/a1/38/561f01cf3577430b59b340b51329803d3a5bf6a45864a55f4ef308ac11e3/msgpack-1.1.1-cp313-cp313-macosx_10_13_x86_64.whl", hash = "sha256:3765afa6bd4832fc11c3749be4ba4b69a0e8d7b728f78e68120a157a4c5d41f0" }, + { url = "https://mirrors.aliyun.com/pypi/packages/09/48/54a89579ea36b6ae0ee001cba8c61f776451fad3c9306cd80f5b5c55be87/msgpack-1.1.1-cp313-cp313-macosx_11_0_arm64.whl", hash = "sha256:8ddb2bcfd1a8b9e431c8d6f4f7db0773084e107730ecf3472f1dfe9ad583f3d9" }, + { url = "https://mirrors.aliyun.com/pypi/packages/a0/60/daba2699b308e95ae792cdc2ef092a38eb5ee422f9d2fbd4101526d8a210/msgpack-1.1.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:196a736f0526a03653d829d7d4c5500a97eea3648aebfd4b6743875f28aa2af8" }, + { url = "https://mirrors.aliyun.com/pypi/packages/20/22/2ebae7ae43cd8f2debc35c631172ddf14e2a87ffcc04cf43ff9df9fff0d3/msgpack-1.1.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9d592d06e3cc2f537ceeeb23d38799c6ad83255289bb84c2e5792e5a8dea268a" }, + { url = "https://mirrors.aliyun.com/pypi/packages/40/1b/54c08dd5452427e1179a40b4b607e37e2664bca1c790c60c442c8e972e47/msgpack-1.1.1-cp313-cp313-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4df2311b0ce24f06ba253fda361f938dfecd7b961576f9be3f3fbd60e87130ac" }, + { url = "https://mirrors.aliyun.com/pypi/packages/2e/60/6bb17e9ffb080616a51f09928fdd5cac1353c9becc6c4a8abd4e57269a16/msgpack-1.1.1-cp313-cp313-musllinux_1_2_aarch64.whl", hash = "sha256:e4141c5a32b5e37905b5940aacbc59739f036930367d7acce7a64e4dec1f5e0b" }, + { url = "https://mirrors.aliyun.com/pypi/packages/ee/97/88983e266572e8707c1f4b99c8fd04f9eb97b43f2db40e3172d87d8642db/msgpack-1.1.1-cp313-cp313-musllinux_1_2_i686.whl", hash = "sha256:b1ce7f41670c5a69e1389420436f41385b1aa2504c3b0c30620764b15dded2e7" }, + { url = "https://mirrors.aliyun.com/pypi/packages/bc/66/36c78af2efaffcc15a5a61ae0df53a1d025f2680122e2a9eb8442fed3ae4/msgpack-1.1.1-cp313-cp313-musllinux_1_2_x86_64.whl", hash = "sha256:4147151acabb9caed4e474c3344181e91ff7a388b888f1e19ea04f7e73dc7ad5" }, + { url = "https://mirrors.aliyun.com/pypi/packages/8c/87/a75eb622b555708fe0427fab96056d39d4c9892b0c784b3a721088c7ee37/msgpack-1.1.1-cp313-cp313-win32.whl", hash = "sha256:500e85823a27d6d9bba1d057c871b4210c1dd6fb01fbb764e37e4e8847376323" }, + { url = "https://mirrors.aliyun.com/pypi/packages/ca/91/7dc28d5e2a11a5ad804cf2b7f7a5fcb1eb5a4966d66a5d2b41aee6376543/msgpack-1.1.1-cp313-cp313-win_amd64.whl", hash = "sha256:6d489fba546295983abd142812bda76b57e33d0b9f5d5b71c09a583285506f69" }, +] + [[package]] name = "multidict" version = "6.6.3" @@ -705,6 +753,21 @@ wheels = [ { url = "https://mirrors.aliyun.com/pypi/packages/d2/1d/1b658dbd2b9fa9c4c9f32accbfc0205d532c8c6194dc0f2a4c0428e7128a/nodeenv-1.9.1-py2.py3-none-any.whl", hash = "sha256:ba11c9782d29c27c70ffbdda2d7415098754709be8a7056d79a737cd901155c9" }, ] +[[package]] +name = "nonebot-adapter-onebot" +version = "2.4.6" +source = { registry = "https://mirrors.aliyun.com/pypi/simple" } +dependencies = [ + { name = "msgpack" }, + { name = "nonebot2" }, + { name = "pydantic" }, + { name = "typing-extensions" }, +] +sdist = { url = "https://mirrors.aliyun.com/pypi/packages/11/97/504e898471c2ba18a5c0f8db99ed81e755f6b3cbf647ce804485d8b8f77e/nonebot_adapter_onebot-2.4.6.tar.gz", hash = "sha256:e33c93649ad11b320d8e9ff213635f29b23b4d0413c9158bd031c513c2f8f701" } +wheels = [ + { url = "https://mirrors.aliyun.com/pypi/packages/60/a8/219fb6327b3395b9b05d2e46383795825d079d1c024660304037d3dc0448/nonebot_adapter_onebot-2.4.6-py3-none-any.whl", hash = "sha256:b1ec7023fd83d731f63b513217327a57d12893a261944934b9195f79173791ad" }, +] + [[package]] name = "nonebot-plugin-localstore" version = "0.7.4" @@ -745,7 +808,7 @@ default = [ [[package]] name = "nonebot-plugin-value" -version = "0.1.4" +version = "0.1.4.post1" source = { virtual = "." } dependencies = [ { name = "aiofiles" }, @@ -761,6 +824,7 @@ dev = [ { name = "aiosqlite" }, { name = "alembic" }, { name = "nb-cli" }, + { name = "nonebot-adapter-onebot" }, { name = "nonebot-plugin-orm", extra = ["default"] }, { name = "nonebot2", extra = ["fastapi"] }, { name = "nonebug" }, @@ -784,6 +848,7 @@ dev = [ { name = "aiosqlite", specifier = ">=0.19.0" }, { name = "alembic", specifier = ">=1.16.2" }, { name = "nb-cli", specifier = ">=1.4.1" }, + { name = "nonebot-adapter-onebot", specifier = ">=2.4.6" }, { name = "nonebot-plugin-orm", extras = ["default"], specifier = ">=0.7.4" }, { name = "nonebot2", extras = ["fastapi"], specifier = ">=2.4.2" }, { name = "nonebug", specifier = ">=0.4.3" },