Skip to main content

NoneBot2 插件:监控 Bot 在线状态,检测 Bot 离线并发送邮件通知

Project description

logo

✨ nonebot-plugin-bot-monitor ✨

LICENSE pypi python uv
ruff pre-commit

📖 介绍

NoneBot2 插件:监控 Bot 在线状态,检测 Bot 离线并发送邮件通知。

💿 安装

使用 nb-cli 安装 在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装
nb plugin install nonebot-plugin-bot-monitor --upgrade

使用 pypi 源安装

nb plugin install nonebot-plugin-bot-monitor --upgrade -i "https://pypi.org/simple"

使用清华源安装

nb plugin install nonebot-plugin-bot-monitor --upgrade -i "https://pypi.tuna.tsinghua.edu.cn/simple"
使用包管理器安装 在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令
uv
uv add nonebot-plugin-bot-monitor

安装仓库 master 分支

uv add git+https://github.com/TogetsuDo/nonebot-plugin-bot-monitor@master
pdm
pdm add nonebot-plugin-bot-monitor

安装仓库 master 分支

pdm add git+https://github.com/TogetsuDo/nonebot-plugin-bot-monitor@master
poetry
poetry add nonebot-plugin-bot-monitor

安装仓库 master 分支

poetry add git+https://github.com/TogetsuDo/nonebot-plugin-bot-monitor@master

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

plugins = ["nonebot_plugin_bot_monitor"]

⚙️ 配置

在 nonebot2 项目的 .env 文件中添加以下配置:

配置项 必填 默认值 说明
BOT_monitor_SMTP_USER SMTP 发件人账号
BOT_monitor_SMTP_PASSWORD SMTP 授权码(非登录密码)
BOT_monitor_SMTP_SERVER SMTP 服务器地址
BOT_monitor_SMTP_PORT 465 SMTP 端口,465 使用 SSL,其他端口使用 STARTTLS
BOT_monitor_NOTICE_EMAIL 接收离线通知的邮箱
BOT_monitor_OFFLINE_GRACE_TIME 30 离线宽限期(秒),Bot 在此时间内重连则不发送通知
BOT_monitor_ADMIN_EMAILS [] 额外通知邮箱列表,离线时同时通知这些邮箱
BOT_monitor_CMD_BOT_status Bot在吗 查询 Bot 状态的命令名
BOT_monitor_CMD_TEST_MAIL 测试邮件 测试邮件发送的命令名
BOT_monitor_SMTP_USER=your@email.com
BOT_monitor_SMTP_PASSWORD=your_auth_code
BOT_monitor_SMTP_SERVER=smtp.example.com
BOT_monitor_SMTP_PORT=465
BOT_monitor_NOTICE_EMAIL=receiver@email.com
BOT_monitor_OFFLINE_GRACE_TIME=30
BOT_monitor_ADMIN_EMAILS=["admin1@qq.com", "admin2@qq.com"]

# 可选:自定义命令名
BOT_monitor_CMD_BOT_status=Bot在吗
BOT_monitor_CMD_TEST_MAIL=测试邮件

邮箱配置请参考各邮件服务商的 SMTP 设置说明(QQ 邮箱、163 邮箱等均需使用授权码而非登录密码)。

🎉 使用

以下命令仅 SUPERUSERS 可用:

指令 权限 需要@ 范围 说明
Bot在吗(可自定义) 超级用户 群聊/私聊 查询所有 Bot 的在线/离线状态
测试邮件(可自定义) 超级用户 群聊/私聊 向配置的邮箱发送测试邮件,验证邮件配置是否正确

依赖

License

MIT

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_bot_monitor-1.0.2.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

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

nonebot_plugin_bot_monitor-1.0.2-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file nonebot_plugin_bot_monitor-1.0.2.tar.gz.

File metadata

  • Download URL: nonebot_plugin_bot_monitor-1.0.2.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for nonebot_plugin_bot_monitor-1.0.2.tar.gz
Algorithm Hash digest
SHA256 30dc48b57738f30c2c79e39e379d016ec9d4628d1afbf9db5217b5e9c7e1df75
MD5 44fff83b6091eb9dd786bd3211730be6
BLAKE2b-256 56fc35e96dd902e5130cde9219e1181b8eb0fdfccbbf61c38388a10b515af103

See more details on using hashes here.

File details

Details for the file nonebot_plugin_bot_monitor-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: nonebot_plugin_bot_monitor-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for nonebot_plugin_bot_monitor-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 45b4144c7fe49a915b812c666fb142e3a110c54a0460a55800971af358384431
MD5 d6798dd6573b49b6086cd58e38c92710
BLAKE2b-256 1203a1ac509a75d603fdf3a6522b27151ca23dd6ef4036f8a39c7860472ae887

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