Skip to main content
nonebot

nonebot-plugin-userinfo

✨ Nonebot2 用户信息获取插件 ✨

license Python NoneBot pypi

多平台的用户信息获取插件,可以获取用户名、用户头像等信息

可以获取的信息:

字段 类型 说明 默认值 备注
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
  • QQ

鸣谢

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)

Source distribution for nonebot_plugin_userinfo 0.2.6
File Size Uploaded
nonebot_plugin_userinfo-0.2.6.tar.gz 10.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nonebot_plugin_userinfo 0.2.6
File Interpreter ABI Platform
nonebot_plugin_userinfo-0.2.6-py3-none-any.whl Python 3 none any Details

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

Release history Release notifications | RSS feed

This release

0.2.6 This release

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page