diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8732967..cd8b509 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,11 +6,11 @@ ci: autoupdate_commit_msg: "chore: auto update by pre-commit hooks" repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.5.0 + rev: v0.16.10 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] - stages: [commit] + stages: [pre-commit] - id: ruff-format - repo: https://github.com/pre-commit/mirrors-prettier @@ -18,4 +18,4 @@ repos: hooks: - id: prettier types_or: [javascript, jsx, ts, tsx, markdown, yaml, json] - stages: [commit] + stages: [pre-commit] diff --git a/README.md b/README.md index f41b832..d73ff46 100644 --- a/README.md +++ b/README.md @@ -51,9 +51,12 @@ pip install nonebot_plugin_userinfo ```python from nonebot_plugin_userinfo import get_user_info + @matcher.handle() async def handle(bot: Bot, event: Event): - user_info = await get_user_info(bot, event, event.get_user_id()) # 获取当前事件主体用户的信息 + user_info = await get_user_info( + bot, event, event.get_user_id() + ) # 获取当前事件主体用户的信息 ``` 可以用依赖注入的方式使用: @@ -61,6 +64,7 @@ async def handle(bot: Bot, event: Event): ```python from nonebot_plugin_userinfo import EventUserInfo, UserInfo + @matcher.handle() async def handle(user_info: UserInfo = EventUserInfo()): # 获取当前事件主体用户的信息 pass @@ -69,6 +73,7 @@ async def handle(user_info: UserInfo = EventUserInfo()): # 获取当前事件 ```python from nonebot_plugin_userinfo import BotUserInfo, UserInfo + @matcher.handle() async def handle(user_info: UserInfo = BotUserInfo()): # 获取Bot用户信息 pass