A NoneBot2 plugin for querying Minecraft server status and generating status images
Project description
Minecraft MOTD 插件
用于查询一系列 Minecraft 服务器状态并生成在一张图片上的 NoneBot 插件。
配置
权限说明
管理员权限包括:
- NoneBot 超级管理员 (SUPERUSERS)
- 插件超级管理员 (MC_MOTD_SUPERUSERS)
- 群管理员或群主(需开启群管理员权限)
确保三者中有一项已经配置,否则将无法添加/删除服务器
配置项说明
在配置管理员权限后,以下项理论上均为可选配置项,默认值已经足够应对大多数场景
| 配置项 | 类型 | 默认值 | 作用 |
|---|---|---|---|
MC_MOTD_SUPERUSERS |
List[str] | [] |
插件超级管理员QQ号列表 |
MC_MOTD_TIMEOUT |
float | 5.0 |
服务器查询超时时间(秒) |
MC_MOTD_FILTER_BOTS |
bool | true |
是否启用假人过滤(Carpet假人) |
MC_MOTD_BOT_NAMES |
List[str] | ["Anonymous Player"] |
假人名称列表 |
MC_MOTD_ALLOW_PRIVATE |
bool | true |
允许私聊使用插件 |
MC_MOTD_ALLOWED_GROUPS |
List[str] | [] |
允许使用插件的群聊列表(空列表表示所有群聊都允许) |
MC_MOTD_GROUP_ADMIN_PERMISSION |
bool | true |
是否允许群管理员执行管理操作 |
MC_MOTD_IMAGE_WIDTH |
int | 1000 |
图片宽度(像素) |
MC_MOTD_ITEM_HEIGHT |
int | 160 |
每个服务器项目高度(像素) |
MC_MOTD_MARGIN |
int | 30 |
图片边距(像素) |
MC_MOTD_TITLE |
str | "Minecraft 服务器状态" |
图片标题 |
MC_MOTD_CUSTOM_FONT |
str | "" |
自定义字体路径(相对/绝对,相对路径根目录为机器人根目录) |
MC_MOTD_ENABLE_COMPRESSION |
bool | true |
是否启用图片压缩(PNG 转 Webp) |
MC_MOTD_COMPRESSION_QUALITY |
int | 80 |
图片压缩质量(1-100 百分比) |
推荐配置
在 .env 文件中添加以下配置:
# 权限管理
MC_MOTD_SUPERUSERS=["123456789", "987654321"]
# 可选配置
# 性能优化配置
MC_MOTD_TIMEOUT=8.0
MC_MOTD_ENABLE_COMPRESSION=true
MC_MOTD_COMPRESSION_QUALITY=75
# 权限控制配置(按需调整)
MC_MOTD_ALLOW_PRIVATE=true
MC_MOTD_GROUP_ADMIN_PERMISSION=true
MC_MOTD_ALLOWED_GROUPS=[]
# 假人过滤配置
MC_MOTD_FILTER_BOTS=true
MC_MOTD_BOT_NAMES=["Anonymous Player", "bot_", "fake_"]
# 外观定制(可选)
MC_MOTD_TITLE="我的服务器状态"
MC_MOTD_IMAGE_WIDTH=1200
使用
用户命令
/motd- 查询所有服务器状态/motd --detail- 显示详细信息包括玩家列表
管理员命令
/motd add ip:port 标签- 添加服务器/motd del ip:port- 删除服务器/motd del -rf- 删除所有服务器/motd help- 显示帮助
示例
/motd add hypixel.net Hypixel服务器
/motd add play.example.com:25566 我的服务器
/motd del hypixel.net
/motd --detail
注意事项
- 必须配置管理员权限后才可使用管理功能
- 数据库文件会自动创建在插件数据目录
- 假人过滤/显示详细信息仅对支持玩家列表的服务器有效
- 建议适当调整超时时间以适应网络环境
图片示例
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
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_mcmotd-1.0.0.tar.gz.
File metadata
- Download URL: nonebot_plugin_mcmotd-1.0.0.tar.gz
- Upload date:
- Size: 17.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db4f6427186cbb6cbb504a4148b107078c443830cdaa0a3bd3946ae4cadb986e
|
|
| MD5 |
960a21410f6968478c0bda52e21b1f35
|
|
| BLAKE2b-256 |
bb7ca6874ae4f014b6cb9d11f32e4d850fb72fa82d2fc98675eed06d3032574d
|
File details
Details for the file nonebot_plugin_mcmotd-1.0.0-py3-none-any.whl.
File metadata
- Download URL: nonebot_plugin_mcmotd-1.0.0-py3-none-any.whl
- Upload date:
- Size: 20.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f06a976c24ded917e8616c02b0915eda55e2c3a7a4085fd0f9d25071435b4490
|
|
| MD5 |
95cf2acd73b92fdd38b855ba2e8de12e
|
|
| BLAKE2b-256 |
68783ae2ac55f6356cdebb3c2bd1bc551ac40f76273eb252e4d94fcf87fe9bf5
|