多平台的用户信息获取插件,可以获取用户名、用户头像等信息
可以获取的信息:
| 字段 | 类型 | 说明 | 默认值 | 备注 |
|---|---|---|---|---|
| user_id | str |
用户 id | ||
| user_name | str |
用户名 | ||
| user_displayname | Optional[str] |
用户昵称 | None |
|
| user_remark | Optional[str] |
用户备注 | None |
|
| user_avatar | Optional[ImageSource] |
用户头像 | None |
ImageSource 可通过 get_url 获取链接,通过 get_image 获取 bytes 结果 |
| user_gender | str |
用户性别 | "unknown" |
安装
- 使用 nb-cli
nb plugin install nonebot_plugin_userinfo
- 使用 pip
pip install nonebot_plugin_userinfo
使用
from nonebot_plugin_userinfo import get_user_info
@matcher.handle()
async def handle(bot: Bot, event: Event):
user_info = get_user_info(bot, event, event.get_user_id()) # 获取当前事件主体用户的信息
可以用依赖注入的方式使用:
from nonebot_plugin_userinfo import EventUserInfo, UserInfo
@matcher.handle()
async def handle(user_info: UserInfo = EventUserInfo()): # 获取当前事件主体用户的信息
pass
from nonebot_plugin_userinfo import BotUserInfo, UserInfo
@matcher.handle()
async def handle(user_info: UserInfo = BotUserInfo()): # 获取Bot用户信息
pass
支持的 adapter
- OneBot v11
- OneBot v12
- Console
- Kaiheila
- Telegram
- Feishu
- RedProtocol
- Discord
- DoDo
- Satori
鸣谢
- nonebot-plugin-send-anything-anywhere 项目的灵感来源以及部分实现的参考
- uy/sun 感谢歪日佬的技术支持
Metadata
Release files for nonebot_plugin_userinfo 0.2.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nonebot_plugin_userinfo-0.2.6.tar.gz | 10.9 kB | Without provenance | Details for nonebot_plugin_userinfo-0.2.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nonebot_plugin_userinfo-0.2.6-py3-none-any.whl | Python 3 | none | any | Details for nonebot_plugin_userinfo-0.2.6-py3-none-any.whl |
Total release size: 28.3 kB
Release files / nonebot_plugin_userinfo-0.2.6.tar.gz
| Download URL | nonebot_plugin_userinfo-0.2.6.tar.gz |
|---|---|
| Size | 10.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0d1ce897e94a9d4c0b5300bc8f239a4676f9bb62c78a14e0f0527e5398ffc840
|
|
BLAKE2b-256 checksum How to use checksums |
5eb9605b5bd26374ef2276c857ee7848eb5b16e537e89511883ae2d1975d0359
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.11.0 Linux/6.5.0-1025-azure
|
Release files / nonebot_plugin_userinfo-0.2.6-py3-none-any.whl
| Download URL | nonebot_plugin_userinfo-0.2.6-py3-none-any.whl |
|---|---|
| Size | 17.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
79d2481af08a5ec77cf171c685eecd14eaf1ce4d5a1ec1fd22fbb0b85e06c260
|
|
BLAKE2b-256 checksum How to use checksums |
af5095dd4b6e4f0577e9e6a52e034d2b6cb165a17dfe3860a24bae1e9961da67
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.11.0 Linux/6.5.0-1025-azure
|
Security for nonebot_plugin_userinfo 0.2.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.