将代码统计嵌入 Bot 中
Project description
📖 介绍
NoneBot Wakatime 查询插件。将你的代码统计嵌入 Bot 中
[!IMPORTANT] 收藏项目,你将从 GitHub 上无延迟地接收所有发布通知~⭐️
Star History
💿 安装
以下提到的方法任选 其一 即可
[!TIP] 若要启动 订阅 功能,需安装
nonebot-plugin-wakatime[apscheduler]
[推荐] 使用 nb-cli 安装
在 Bot 的根目录下打开命令行, 输入以下指令即可安装nb plugin install nonebot-plugin-wakatime
使用包管理器安装
pip install nonebot-plugin-wakatime
# or, use poetry
poetry add nonebot-plugin-wakatime
# or, use pdm
pdm add nonebot-plugin-wakatime
打开 NoneBot 项目根目录下的配置文件, 在 [plugin] 部分追加写入
plugins = ["nonebot_plugin_wakatime"]
⚙️ 配置
在项目的配置文件中添加下表中配置
[!note]
client_id和client_secret均从 WakaTime App 获取
redirect_uri的配置参见 此处
| 配置项 | 必填 | 默认值 |
|---|---|---|
| wakatime__client_id | 是 | 无 |
| wakatime__client_secret | 是 | 无 |
| wakatime__redirect_uri | 是 | 无 |
| wakatime__api_url | 否 | https://wakatime.com/api/v1 |
| wakatime__register_route | 否 | /wakatime/register |
| wakatime__background_source | 否 | default |
| wakatime__enable_qq_button | 否 | False |
暗语配置:
[!tip] 若禁用暗语,则将
wakatime_argot__command配置为Nonewakatime_argot__command = null
| 配置项 | 必填 | 默认值 |
|---|---|---|
| wakatime_argot__command | 否 | background |
| wakatime_argot__expire | 否 | 300 |
redirect_uri
[!NOTE]
redirect_uri指绑定后跳转的页面,可以使用 WakaTime 域名和个人域名
使用 WakaTime 域名
-
在 WakaTime App 中的
Authorized Redirect URIs添加:https://wakatime.com/oauth/test -
在项目配置文件中写入:
wakatime__redirect_uri = https://wakatime.com/oauth/test
使用个人域名
[!TIP]
使用个人域名可以启用自动注册,即发送绑定指令后无需进行二次操作,用于简化绑定流程。
-
使用 nb-cli 安装服务端类型驱动器并修改配置文件
-
在 WakaTime App 中的
Authorized Redirect URIs添加:https://<your-domain:PORT>/wakatime/register -
在项目配置文件中写入:
wakatime__redirect_uri = https://<your-domain:PORT>/wakatime/register
background_source
wakatime__background_source 为背景图来源,可选值为字面量 default / LoliAPI / Lolicon 或者结构 CustomSource 。LoliAPI 和 Lolicon 均为随机背景图,CustomSource 用于自定义背景图。 默认为 default。
以下是 CustomSource 用法
在配置文件中设置 wakatime__background_source 为 CustomSource结构的字典
wakatime__background_source = '{"uri": "https://example.com/image.jpg"}'
其中
uri可为网络图片 API,只要返回的是图片即可uri也可以为 base64 编码的图片,如data:image/png;base64,xxxxxx(一般也没人这么干)uri也可以为本地图片路径,如imgs/image.jpg、/path/to/image.jpg- 如果本地图片路径是相对路径,会使用
nonebot-plugin-localstore指定的 data 目录作为根目录 - 如果本地图片路径是目录,会随机选择目录下的一张图片作为背景图
- 如果本地图片路径是相对路径,会使用
🎉 使用
[!note] 请检查你的
COMMAND_START以及上述配置项。这里默认使用/
绑定账号
首次绑定时向 Bot 发送 /wakatime bind,跟随链接指引进行绑定,成功后会跳转到 redirect_uri 处。
/wakatime bind [code]
解绑
/wakatime revoke
查询信息
/wakatime [@]
订阅
默认订阅为
weekly
取消订阅在指令后加-r|--revoke即可
/wakatime subscribe ['weekly' | 'monthly' | 'yearly']
📸 效果图
默认背景图
💖 鸣谢
he0119/nonebot-plugin-wordcloud:适用于 NoneBot2 的词云插件KomoriDev/nonebot-plugin-argot:提供 NoneBot2 暗语消息支持KomoriDev/Starify:提供了引人注目的徽章
贡献者们
感谢这些大佬对本项目作出的贡献:
Komorebi 💻 |
Azide 💻 |
Jigsaw 💻 |
wyf7685 🐛 💻 |
本段符合 all-contributors 规范
📄 许可证
本项目使用 MIT 许可证开源
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nonebot_plugin_wakatime-0.2.9.tar.gz.
File metadata
- Download URL: nonebot_plugin_wakatime-0.2.9.tar.gz
- Upload date:
- Size: 9.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
37f940e37dbad33a6a3aedc1227a0e98920cfa8b4ce0c9afecec964a867e078c
|
|
| MD5 |
3e7fd03b88ab3df0fd954cda959e1d56
|
|
| BLAKE2b-256 |
ab527a0b7b1bdcccdb5eb049bff3293f58a51deb238fca8069d8f3cff1ea0668
|
File details
Details for the file nonebot_plugin_wakatime-0.2.9-py3-none-any.whl.
File metadata
- Download URL: nonebot_plugin_wakatime-0.2.9-py3-none-any.whl
- Upload date:
- Size: 9.0 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd734f5a256f349b4d9928712985411d4dff21b9d296400dffc105415a0ea0e2
|
|
| MD5 |
8f9e5a65eb191c6ef854f3a32afe5ce4
|
|
| BLAKE2b-256 |
8f2d80e73fa4fbb3922fa942f606a74f9be94f2d87e4242e6c40568adda6561d
|