GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - noneplugin/nonebot-plugin-userinfo: Nonebot2 用户信息获取插件

BranchesTags
Open more actions menu

Latest commit

 

History

89 Commits
89 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
nonebot_plugin_userinfo
nonebot_plugin_userinfo
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
.pre-commit-config.yaml
.pre-commit-config.yaml
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
poetry.lock
poetry.lock
 
 
pyproject.toml
pyproject.toml
 
 

Repository files navigation

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 = await 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

鸣谢

  • nonebot-plugin-send-anything-anywhere 项目的灵感来源以及部分实现的参考
  • uy/sun 感谢歪日佬的技术支持

About

Nonebot2 用户信息获取插件

Resources

Readme
MIT license
Activity
Custom properties

Stars

32 stars

Watchers

1 watching

Forks

4 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.