适用于nonebot2 v11的调用colormind.io的API随机获取一种配色方案。
🔧 开发环境
Nonebot2:2.0.0b5
python:3.8.13
操作系统:Windows10(CentOS7下正常运行,Linux兼容性问题不大)
编辑器:pycharm
💿 安装
环境依赖aiohttp库
1. nb-cli安装(推荐)
在你bot工程的文件夹下,运行cmd(运行路径要对啊),执行nb命令安装插件,插件配置会自动添加至配置文件
nb plugin install nonebot_plugin_colormind
2. 本地安装
先安装下 aiohttp
pip install aiohttp
将项目clone到你的机器人插件下的对应插件目录内(一般为机器人文件夹下的src/plugins),然后把nonebot_plugin_colormind文件夹里的内容拷贝至上一级目录即可。
clone命令参考(得先装git,懂的都懂):
git clone https://github.com/Ikaros-521/nonebot_plugin_colormind.git
也可以直接下载压缩包到插件目录解压,然后同样提取nonebot_plugin_colormind至上一级目录。
目录结构: 你的bot/src/plugins/nonebot_plugin_colormind/__init__.py
3. pip安装
pip install nonebot_plugin_colormind
打开 nonebot2 项目的 bot.py 文件, 在其中写入
nonebot.load_plugin('nonebot_plugin_colormind')
当然,如果是默认nb-cli创建的nonebot2的话,在bot路径pyproject.toml的[tool.nonebot]的plugins中添加nonebot_plugin_colormind即可
pyproject.toml配置例如:
[tool.nonebot]
plugin_dirs = ["src/plugins"]
plugins = ["nonebot_plugin_colormind"]
🎉 功能
调用colormind.io的API随机获取一种配色方案。
👉 命令
配色方案(命令前缀请自行替换)
命令结构:/配色方案
例如:/配色方案
bot返回内容:
推荐的配色方案为:#E95B4E #E8A64D #D3BE86 #547A58 #365747
[图片,分别是这些配色的方块]
📝 更新日志
项目打包上传至pypi
官网:https://pypi.org,注册账号,在系统用户根目录下创建`.pypirc`,配置
[distutils]
index-servers=pypi
[pypi] repository = https://upload.pypi.org/legacy/
username = 用户名
password = 密码
poetry
# 参考 https://www.freesion.com/article/58051228882/
# 1、安装poetry
pip install poetry
# 2、初始化配置文件(根据提示填写)
poetry init
# 3、微调配置文件pyproject.toml
# 4、运行 poetry install, 可生成 “poetry.lock” 文件(可跳过)
poetry install
# 5、编译,生成dist
poetry build
# 6、发布
poetry publish
twine
# 参考 https://www.cnblogs.com/danhuai/p/14915042.html
#创建setup.py文件 填写相关信息
# 1、可以先升级打包工具
pip install --upgrade setuptools wheel twine
# 2、打包
python setup.py sdist bdist_wheel
# 3、可以先检查一下包
twine check dist/*
# 4、上传包到pypi(需输入用户名、密码)
twine upload dist/*
Metadata
Release files for nonebot-plugin-colormind 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nonebot_plugin_colormind-0.1.0.tar.gz | 6.5 kB | Without provenance | Details for nonebot_plugin_colormind-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nonebot_plugin_colormind-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for nonebot_plugin_colormind-0.1.0-py3-none-any.whl |
Total release size: 12.3 kB
Release files / nonebot_plugin_colormind-0.1.0.tar.gz
| Download URL | nonebot_plugin_colormind-0.1.0.tar.gz |
|---|---|
| Size | 6.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ae5662c1f23b92c6ca3458fe678122d969057def44b35ca99a0ddc29be36e055
|
|
BLAKE2b-256 checksum How to use checksums |
7ff6ee5ec61d0d0fc050221e78e1a573da9c4fefd63e9a1c94cc683708cbbcd2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.2 CPython/3.8.13 Windows/10
|
Release files / nonebot_plugin_colormind-0.1.0-py3-none-any.whl
| Download URL | nonebot_plugin_colormind-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
250551d32b0931a662727fb9bc52114944a817677d3ed4341c96a390e72af02a
|
|
BLAKE2b-256 checksum How to use checksums |
fde6212d7f7849439ad0006986c101679137bb005ba837707c514b4fff4d9bfa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.2 CPython/3.8.13 Windows/10
|
Security for nonebot-plugin-colormind 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.