Skip to main content

nonebot_plugin_hoshino_sign 的重置版

Project description

NoneBotPluginLogo

nonebot-plugin-pcr-sign

✨ pcr签到 集印章/邮戳 ✨

license pypi python pre-commit.ci status NoneBot Registry uv ruff CodeFactor

📖 介绍

一个从 一个从 hoshino 借鉴的 nonebot2 签到插件nonebot-plugin-hoshino-sign 借鉴的 nonebot2 签到插件

💿 安装

[!TIP] 想要启用 CLI 数据迁移功能,需安装 nonebot-plugin-pcr-sign[cli]

使用 nb-cli 安装 在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装
nb plugin install nonebot-plugin-pcr-sign
使用包管理器安装 在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令
pip
pip install nonebot-plugin-pcr-sign
pdm
pdm add nonebot-plugin-pcr-sign
poetry
poetry add nonebot-plugin-pcr-sign
conda
conda install nonebot-plugin-pcr-sign

打开 nonebot2 项目根目录下的 pyproject.toml 文件, 在 [tool.nonebot] 部分追加写入

plugins = ["nonebot_plugin_pcr_sign"]

⚙️ 配置

配置表

在 nonebot2 项目的.env文件中修改配置项

配置项 必填 默认值 说明
sign_argot_expire_time 300 暗语过期时间(单位: 类型:int
stamp_path RES_DIR / "stamps" 印章图片路径
sign_background_source "default" 签到背景图来源
album_background_source "default" 收集册背景图来源

background_source

sign_background_source 为签到背景图来源,可选值为字面量 default / LoliAPI / Lolicon / random 或者结构 CustomSourceLoliAPILolicon 均为网络请求获取随机背景图,random为从默认签到背景目录中随机, CustomSource 用于自定义背景图。 默认为 default

album_background_source 为收集册背景图来源,可选值为字面量 default / kraft / pcr / prev / random 或者结构 CustomSource 。前四者均为预设背景,random为从默认收集册背景目录中随机,CustomSource 用于自定义背景图。 默认为 default

以下是 CustomSource 用法

在配置文件中设置 xxx_background_sourceCustomSource结构的字典

CustomSource配置示例
  • 网络链接

    • uri 可为网络图片 API,只要返回的是图片即可
    • uri 也可以为 base64 编码的图片,如 data:image/png;base64,xxxxxx (一般也没人这么干)
sign_background_source = '{"uri": "https://example.com/image.jpg"}'
  • 本地图片

[!TIP]

  • uri 也可以为本地图片路径,如 imgs/image.jpg/path/to/image.jpg
  • 如果本地图片路径是相对路径,会使用 nonebot-plugin-localstore 指定的 data 目录作为根目录
  • 如果本地图片路径是目录,会随机选择目录下的一张图片作为背景图
sign_background_source = '{"uri": "/imgs/image.jpg"}'

🎉 使用

[!NOTE] 记得使用命令前缀

🪧 指令表

指令 权限 参数 说明
sign/签到/盖章/妈 所有 签到
album/收集册 所有 or @ 查看自己(或别人)的收集册

🫣 暗语表

[!NOTE] 🧭 暗语使用指北

暗语消息来自 nonebot-plugin-argot 插件

对暗语对象回复对应的暗语指令即可获取暗语消息

暗语指令 对象 说明
background 签到图 查看背景图
stamp 签到图 获取印章图
raw 签到图 获取原文字消息

[!TIP] 注意暗语消息有过期时间,默认 5min 后失效,可通过配置修改

📸 效果图

🐾 签到图

示例图1

🎞️ 收集册

示例图2

🚚 迁移

如果有从nonebot-plugin-hoshino-sign迁移数据到本插件的需求

请使用 pip install nonebot-plugin-pcr-sign[cli] 安装所需依赖

uv add nonebot-plugin-pcr-sign[cli]什么的,总之加上[cli],别那么死板

nonebot-plugin-hoshino-sign 的默认数据目录为 "./data/nonebot_plugin_hoshino_sign/"

目录结构如下:

  • 数据根目录
    • json
      • goodwill.json
    • db
      • pcr_stamp.db

运行 nb pcr migrate 进行迁移,默认会指向该路径寻找旧数据文件

如果旧数据在其他路径保存,可以使用 nb pcr migrate -d <path> 指定数据文件根路径

例如:nb pcr migrate -d ./data/sign/

[!TIP] 运行一次成功就好了哦! 重复执行迁移会导致用户好感度再被加一次的(

旧数据的用户好感度会累加到已有数据中

💖 鸣谢

📋 TODO

  • 数据迁移脚本(从原hoshino_sign插件迁移数据)
  • 待补充,欢迎pr

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_pcr_sign-0.3.1.tar.gz (50.3 MB view details)

Uploaded Source

Built Distribution

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

nonebot_plugin_pcr_sign-0.3.1-py3-none-any.whl (50.3 MB view details)

Uploaded Python 3

File details

Details for the file nonebot_plugin_pcr_sign-0.3.1.tar.gz.

File metadata

  • Download URL: nonebot_plugin_pcr_sign-0.3.1.tar.gz
  • Upload date:
  • Size: 50.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for nonebot_plugin_pcr_sign-0.3.1.tar.gz
Algorithm Hash digest
SHA256 f05cba4d55a5dd75f0795d0fe6e82ae909caa73a46d4caecc6f8176331de22e7
MD5 37f31772607202e0faf34b036855ed3f
BLAKE2b-256 86e2e98747db4395b6f696e79faea403b03c73d144959214f3a7d4a857a0e466

See more details on using hashes here.

File details

Details for the file nonebot_plugin_pcr_sign-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for nonebot_plugin_pcr_sign-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 338537ee7de84e9c9855e9076531e8c17fea62d2e88bbf2ee240581313285a57
MD5 a801178be1193b06cb83e9e93b7dc8d1
BLAKE2b-256 d3838b61911b2ea708579f33152410a936376c8806e0456203aa0d2c14a09aa4

See more details on using hashes here.

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