Skip to main content

nonebot多平台账户信息绑定

Project description

nonebot_plugin_bind

pypi python pypi

适配支持

  • onebotv11
  • telegram
  • discord
  • kook(开黑啦)
  • villa(大别野)
  • 飞书

使用说明

用户使用说明

命令 限制 含义
'bind' 或 '绑定' 群聊或私聊 发起绑定事件
'bindinfo' 或 '绑定信息' 仅私聊 查看账户绑定信息

具体使用请看下图流程示例
(如果是在群聊中发起的绑定,不会显示下面的绑定信息,只会显示其他内容)
使用qq发送bind命令
使用discord发送bind命令和token
使用qq发送密钥确认绑定

开发者说明

使用依赖注入获取用户信息的示例

from typing import Annotated

from nonebot import require
require('nonebot_plugin_bind')

from nonebot_plugin_bind import GetUser

_bind_info_ = on_command("bindinfo", aliases={"绑定信息"})


@_bind_info_.handle()
async def __(event: Event, bot: Bot, matcher: Matcher, user: Annotated[User, GetUser()]):
    # 这里获取到的user可以访问属性来获取用户的具体账户信息,其中user.id是每个跨平台用户的唯一索引,也可以使用str()方法来转化成字符串
    if _is_private_(event, bot):
        await matcher.finish(f"当前账户的绑定信息如下:\n{str(user)}")
    else:
        await matcher.finish("账户绑定信息只能在私聊中查看")

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_bind-0.1.3.tar.gz (5.8 kB view hashes)

Uploaded Source

Built Distribution

nonebot_plugin_bind-0.1.3-py3-none-any.whl (7.0 kB view hashes)

Uploaded Python 3

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