Skip to main content

将代码统计嵌入 Bot 中

Project description

NoneBot-Plugin-Wakatime

✨ NoneBot Wakatime 查询插件 ✨

pypi python pdm-managed alc-resolved
NoneBot Registry Supported Adapters
📸 演示与预览   |   📦️ 下载插件   |   💬 加入交流群

📖 介绍

NoneBot Wakatime 查询插件。将你的代码统计嵌入 Bot 中

[!IMPORTANT] 收藏项目,你将从 GitHub 上无延迟地接收所有发布通知~⭐️

starify
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_idclient_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 配置为 None

wakatime_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 或者结构 CustomSourceLoliAPILolicon 均为随机背景图,CustomSource 用于自定义背景图。 默认为 default

以下是 CustomSource 用法

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

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']

📸 效果图

默认背景图

rendering

💖 鸣谢

贡献者们

All Contributors

感谢这些大佬对本项目作出的贡献:

Komorebi
Komorebi

💻
Azide
Azide

💻
Jigsaw
Jigsaw

💻
wyf7685
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


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_wakatime-0.2.9.tar.gz (9.8 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_wakatime-0.2.9-py3-none-any.whl (9.0 MB view details)

Uploaded Python 3

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

Hashes for nonebot_plugin_wakatime-0.2.9.tar.gz
Algorithm Hash digest
SHA256 37f940e37dbad33a6a3aedc1227a0e98920cfa8b4ce0c9afecec964a867e078c
MD5 3e7fd03b88ab3df0fd954cda959e1d56
BLAKE2b-256 ab527a0b7b1bdcccdb5eb049bff3293f58a51deb238fca8069d8f3cff1ea0668

See more details on using hashes here.

File details

Details for the file nonebot_plugin_wakatime-0.2.9-py3-none-any.whl.

File metadata

File hashes

Hashes for nonebot_plugin_wakatime-0.2.9-py3-none-any.whl
Algorithm Hash digest
SHA256 fd734f5a256f349b4d9928712985411d4dff21b9d296400dffc105415a0ea0e2
MD5 8f9e5a65eb191c6ef854f3a32afe5ce4
BLAKE2b-256 8f2d80e73fa4fbb3922fa942f606a74f9be94f2d87e4242e6c40568adda6561d

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