Metadata-Version: 2.4
Name: nonebot-plugin-palworld-sync
Version: 0.1.1
Summary: 基于NoneBot2的幻兽帕鲁 (Palworld) 服务器 REST API 插件
Keywords: nonebot,nonebot2,palworld,pal
Author: yuexps@qq.com
Requires-Python: >=3.9,<4.0
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Dist: httpx (>=0.20.0,<1.0.0)
Requires-Dist: nonebot-adapter-onebot (>=2.4.0,<3.0.0)
Requires-Dist: nonebot2 (>=2.2.0,<3.0.0)
Project-URL: Homepage, https://github.com/yuexps/nonebot-plugin-palworld-sync
Project-URL: Repository, https://github.com/yuexps/nonebot-plugin-palworld-sync
Description-Content-Type: text/markdown

<p align="center">
  <a href="https://adapter-onebot.netlify.app/"><img src="https://img.shields.io/badge/nonebot2-plugin-red.svg" alt="nonebot2"></a>
  <a href="https://pypi.org/project/nonebot-plugin-palworld-sync"><img src="https://img.shields.io/pypi/v/nonebot-plugin-palworld-sync.svg" alt="pypi"></a>
  <img src="https://img.shields.io/badge/python-3.9+-blue.svg" alt="python">
</p>

# nonebot-plugin-palworld-sync

基于 Nonebot2 的幻兽帕鲁 (Palworld) 服务器 REST API 插件。

## 介绍

通过幻兽帕鲁官方 REST API 实现服务器状态监控与群内管理。支持群消息和游戏内互通、玩家踢出/封禁/解封、在线人数查询以及关机与存档等操作。

## 安装

推荐使用 `nb-cli` 安装：
```bash
nb plugin install nonebot-plugin-palworld-sync --upgrade
```

<details>
<summary>或使用包管理器</summary>

```bash
pip install nonebot-plugin-palworld-sync --upgrade
```
并在 `pyproject.toml` 或 `bot.py` 中加载插件：
```toml
plugins = ["nonebot_plugin_palworld_sync"]
```
</details>

## 1. 插件配置

### 幻兽帕鲁服务端配置 (PalWorldSettings.ini)
```ini
RESTAPIEnabled=True,RESTAPIPort=8212,AdminPassword="您的管理员密码"
```

### Nonebot 环境变量配置 (.env)
```env
PALWORLD_API_URL="http://<服务器IP>:8212"
PALWORLD_API_PASSWORD="您的管理员密码"
PALWORLD_QQ_GROUPS=["123456", "789012"]  # 必填：本插件生效的 QQ 群号列表（JSON 数组格式），非列表内的群不响应任何指令
PALWORLD_FORWARD_GROUP_MSG=True  # 可选：设置为 True 即可开启 QQ 群消息互通转发至游戏内，默认 False
```

---

## 2. 指令一览

### 公共指令

| 指令 | 参数要求 | 功能描述 |
| :--- | :--- | :--- |
| /pw status | 无 | 查看服务器状态 (版本、FPS、在线人数、核心设置等) |
| /pw players [目标] | [目标]: 选填 (名字/PlayerID/SteamID) | 查看在线玩家简表，若指定目标则返回其详细状态 |

### 管理员指令 (限超级用户、群主、群管理员)

| 指令 | 参数要求 | 功能描述 |
| :--- | :--- | :--- |
| /pw say <msg> | <msg>: 消息内容 | 发送全局广播消息 |
| /pw kick <target> [reason] | <target>: 名字/PlayerID/SteamID<br>[reason]: 可空 | 踢出指定玩家 (支持在线玩家名字模糊匹配) |
| /pw ban <target> [reason] | <target>: 名字/PlayerID/SteamID<br>[reason]: 可空 | 封禁指定玩家 (支持在线玩家名字模糊匹配) |
| /pw unban <steam_id> | <steam_id>: SteamID | 解封指定的玩家 |
| /pw save | 无 | 保存当前游戏世界的存盘 |
| /pw shutdown [秒/force] [msg] | [秒/force]: 秒数或 force 强制关闭<br>[msg]: 可空 | 关闭服务器 (优雅关机或强关合并) |

