Skip to main content

适用于 Nonebot2 的用户插件

Project description

nonebot

NoneBot Plugin User

✨ NoneBot 用户插件 ✨

license pypi python codecov QQ Chat Group

简介

使用方式

加载插件后发送 /user/bind

查看用户信息

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

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

绑定用户

通过 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.platform_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.6.0.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nonebot_plugin_user-0.6.0-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nonebot_plugin_user-0.6.0.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for nonebot_plugin_user-0.6.0.tar.gz
Algorithm Hash digest
SHA256 1fb595dc2f1826aed216097a27b971b1d374ba42531a4bbe37e5ce9366c5d429
MD5 952555375249c75cfdf853e38bfd7ef2
BLAKE2b-256 1a5dfa839f1e4b1081c70ea2f63195478ba7c7e8cee6a028d8c86a84511078cc

See more details on using hashes here.

Provenance

The following attestation bundles were made for nonebot_plugin_user-0.6.0.tar.gz:

Publisher: release.yml on he0119/nonebot-plugin-user

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for nonebot_plugin_user-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3768ab8b884e469e5460136d3f230cf0e4854a4954ffd02216c6f13134ef9b85
MD5 d91830db460afdcb0a8ad6306083e573
BLAKE2b-256 912810a308da3c32e816f8b52311d753b556dbc35f5e24a7d90558c75c6f2e60

See more details on using hashes here.

Provenance

The following attestation bundles were made for nonebot_plugin_user-0.6.0-py3-none-any.whl:

Publisher: release.yml on he0119/nonebot-plugin-user

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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