Skip to main content

适用于 Nonebot2 的用户插件

Project description

nonebot

NoneBot Plugin User

✨ NoneBot 用户插件 ✨

license pypi python codecov QQ Chat Group

简介

使用方式

加载插件后发送 /user/inspect/bind

查看用户信息

通过 user 命令可查看用户信息:

平台名:qq
平台 ID:10000
用户名:uy/sun
创建日期:2023-11-02 04:52:42

查看会话信息

通过 inspect 命令可查看当前会话信息:

平台名:qq
平台 ID:10000
自身 ID:20000
群组 ID:30000

绑定用户

通过 bind 命令可将不同用户的数据绑定:

命令 bind 可用于在多个平台间绑定用户数据。绑定过程中,原始平台的用户数据将完全保留,而目标平台的用户数据将被原始平台的数据所覆盖。
请确认当前平台是你的目标平台,并在 5 分钟内使用你的账号在原始平台内向机器人发送以下文本:
/bind nonebot/123456
绑定完成后,你可以随时使用「bind -r」来解除绑定状态。

插件适配

先在插件代码最前面声明依赖

from nonebot import require
require("nonebot_plugin_user")

获取用户信息

from nonebot_plugin_user import User

@matcher.handle()
async def _(user: User):
    await matcher.finish(user.id)

获取用户会话信息

from nonebot_plugin_user import UserSession

@matcher.handle()
async def _(session: UserSession):
    await matcher.finish(session.user_id)

配置项

配置方式:直接在 NoneBot 全局配置文件中添加以下配置项即可。

user_token_prefix

  • 类型: str
  • 默认: nonebot/
  • 说明: 生成令牌的前缀

计划

  • 支持权限

鸣谢

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_user-0.4.1.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

nonebot_plugin_user-0.4.1-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file nonebot_plugin_user-0.4.1.tar.gz.

File metadata

  • Download URL: nonebot_plugin_user-0.4.1.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.5

File hashes

Hashes for nonebot_plugin_user-0.4.1.tar.gz
Algorithm Hash digest
SHA256 80ea561a46c22d0e087edefb9a2bce8cfc4395426fbb54506d85382538eb68de
MD5 2fe402013b75e1672423b1bf76010f3e
BLAKE2b-256 878509ddd7ca42a5f9fd77cc34fa07f5249fb5c7ee45c94e47fa0b8e4b4a3c6e

See more details on using hashes here.

File details

Details for the file nonebot_plugin_user-0.4.1-py3-none-any.whl.

File metadata

File hashes

Hashes for nonebot_plugin_user-0.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1d4daba6659774b65ebbc9b679d50c5505a8dcdd76a71a122b09452e0aaa2d11
MD5 6b2dc651e34aa8042a610d7a9eccc113
BLAKE2b-256 157a7a6d8f2bbc428afa5674bb285829689f92af85de4323c1d1fbb7f3e5b3a5

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