Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ 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
rev: v4.0.0-alpha.8
hooks:
- id: prettier
types_or: [javascript, jsx, ts, tsx, markdown, yaml, json]
stages: [commit]
stages: [pre-commit]
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,20 @@ 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()
) # 获取当前事件主体用户的信息
```

可以用依赖注入的方式使用:

```python
from nonebot_plugin_userinfo import EventUserInfo, UserInfo


@matcher.handle()
async def handle(user_info: UserInfo = EventUserInfo()): # 获取当前事件主体用户的信息
pass
Expand All @@ -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
Expand Down
Loading