Skip to main content

Nonebot2 用户信息获取插件

Project description

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

鸣谢

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nonebot_plugin_userinfo-0.2.5.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

nonebot_plugin_userinfo-0.2.5-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

Details for the file nonebot_plugin_userinfo-0.2.5.tar.gz.

File metadata

  • Download URL: nonebot_plugin_userinfo-0.2.5.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

Hashes for nonebot_plugin_userinfo-0.2.5.tar.gz
Algorithm Hash digest
SHA256 5ad93361d7fd9d3a3eaebd28a5b387a86004bd267e5985f82045e2eb31ddca49
MD5 14cebe8b192a01d451872bb04f25017b
BLAKE2b-256 b058f8e19b15929813963038ee8a15e913c77c0d7aa77a85b1378cfa1b03e539

See more details on using hashes here.

File details

Details for the file nonebot_plugin_userinfo-0.2.5-py3-none-any.whl.

File metadata

File hashes

Hashes for nonebot_plugin_userinfo-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f80c7c3eca36ec9231a6c36951ad662d4f62ed44e08551e2621f4957d3e8313b
MD5 7c6dfe4af5c7be813c048727d0f49c9e
BLAKE2b-256 f4df00a37d93e1e389999936a79d2c7f6d69475b0dc2c564d03f0a1b78e56f86

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page