Nonebot2 用户信息获取插件
Project description
多平台的用户信息获取插件,可以获取用户名、用户头像等信息
可以获取的信息:
字段 | 类型 | 说明 | 默认值 | 备注 |
---|---|---|---|---|
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 感谢歪日佬的技术支持
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file nonebot_plugin_userinfo-0.2.6.tar.gz
.
File metadata
- Download URL: nonebot_plugin_userinfo-0.2.6.tar.gz
- Upload date:
- Size: 10.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.0 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d1ce897e94a9d4c0b5300bc8f239a4676f9bb62c78a14e0f0527e5398ffc840 |
|
MD5 | e5ece54f6d00e60ee3ec3f2ac2728716 |
|
BLAKE2b-256 | 5eb9605b5bd26374ef2276c857ee7848eb5b16e537e89511883ae2d1975d0359 |
File details
Details for the file nonebot_plugin_userinfo-0.2.6-py3-none-any.whl
.
File metadata
- Download URL: nonebot_plugin_userinfo-0.2.6-py3-none-any.whl
- Upload date:
- Size: 17.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.0 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 79d2481af08a5ec77cf171c685eecd14eaf1ce4d5a1ec1fd22fbb0b85e06c260 |
|
MD5 | f3fc20051218b7471534a47a1498656b |
|
BLAKE2b-256 | af5095dd4b6e4f0577e9e6a52e034d2b6cb165a17dfe3860a24bae1e9961da67 |