Skip to main content

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

Project description

nonebot2 pypi python

nonebot-plugin-palworld-sync

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

介绍

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

安装

推荐使用 nb-cli 安装:

nb plugin install nonebot-plugin-palworld-sync --upgrade
或使用包管理器
pip install nonebot-plugin-palworld-sync --upgrade

并在 pyproject.tomlbot.py 中加载插件:

plugins = ["nonebot_plugin_palworld_sync"]

1. 插件配置

幻兽帕鲁服务端配置 (PalWorldSettings.ini)

RESTAPIEnabled=True,RESTAPIPort=8212,AdminPassword="您的管理员密码"

Nonebot 环境变量配置 (.env)

# 基础配置 (官方 REST API)
PALWORLD_API_URL="http://<服务器IP>:8212"
PALWORLD_API_PASSWORD="您的管理员密码"
PALWORLD_QQ_GROUPS=["123456"]  # 生效 QQ 群列表 (JSON 数组格式)
PALWORLD_FORWARD_GROUP_MSG=False  # 是否转发 QQ 群消息到游戏内
PALWORLD_PLAYER_TRACKING=True  # 是否广播玩家进出服通知
PALWORLD_PLAYER_TRACKING_INTERVAL=10  # 状态轮询间隔(秒)

# PalDefender 配置 (可选,用于查包/发物品奖励/强拆)
PALWORLD_PDAPI_ENABLED=True  # 启用 API 扩展
PALWORLD_PDAPI_URL="http://<服务器IP>:17993"
PALWORLD_PDAPI_TOKEN="您的 Token"

# RCON 配置 (需服务端已配置并安装 PalDefender 以支持扩展 RCON 命令,用于 TPA 传送)
PALWORLD_RCON_HOST="<服务器IP>"
PALWORLD_RCON_PORT=25575
PALWORLD_TPA_TIMEOUT=60  # TPA 超时时间(秒)

2. 指令一览

玩家智能模糊匹配说明: 所有需要指定目标的指令(如踢出、封禁、传送、查包、发物品等),在匹配输入的目标昵称/ID时,采用精确匹配最优先,模糊匹配次之的逻辑。若检索到多名重名相似的玩家,为防止误伤,机器人将拒绝执行并列出备选重名列表供发起人细化。

公共指令

指令 参数要求 功能描述
/pw status 查看服务器状态 (版本、FPS、在线人数、核心配置等)
/pw players [目标] [目标] 选填 (名字/SteamID) 查看在线玩家,若指定目标则返回详细状态
/pw bind <目标> <目标> 必填 (游戏昵称/SteamID) 绑定 QQ 与游戏角色
/pw unbind 解除当前 QQ 绑定
/pw tpa <目标> <目标> 必填 (昵称/QQ/@群友) 申请传送到目标玩家身边 (TPA 交互,有效时间 60 秒)
/pw tpaccept 同意他人的 TPA 传送请求
/pw tpdeny 拒绝他人的 TPA 传送请求
/pw items [目标] [目标] 选填 (昵称/QQ/@群友) 查看背包物品 (不填查看自己,需启用 PDAPI)
/pw pals [目标] [目标] 选填 (昵称/QQ/@群友) 查看持有帕鲁详细属性、IV 值与被动词条 (需启用 PDAPI)

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

指令 参数要求 功能描述
/pw say 广播消息 发送全局广播公告
/pw kick [reason] 昵称/SteamID
[reason] 选填
踢出指定玩家
/pw ban [reason] 昵称/SteamID
[reason] 选填
封禁指定玩家
/pw unban <steam_id> <steam_id> SteamID 解封指定玩家
/pw save 保存当前游戏世界存盘
/pw shutdown [秒/force] [msg] [秒/force] 选填 (关闭时间)
[msg] 选填 (广播公告)
关闭服务器 (定时关闭或强制停止)
/pw guilds 查看服务器全部公会及据点 UUID (需启用 PDAPI)
/pw give [count] 玩家名/QQ/@群友
物品ID
[count] 数量 (默认1)
后台发放道具/武器/材料 (需启用 PDAPI)
/pw givepal 玩家名/QQ/@群友
帕鲁ID
后台发放特定帕鲁实体 (需启用 PDAPI)
/pw deletebase 据点UUID 一键强拆销毁指定的玩家据点 (需启用 PDAPI)

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_palworld_sync-0.1.3.tar.gz (15.5 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_palworld_sync-0.1.3-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

Details for the file nonebot_plugin_palworld_sync-0.1.3.tar.gz.

File metadata

File hashes

Hashes for nonebot_plugin_palworld_sync-0.1.3.tar.gz
Algorithm Hash digest
SHA256 ab4a9de66a2c2eee0d8b09656292a93f559a185734640e17fd72965f6fe4909d
MD5 2cef4b4c5c0200ba0f7751a9f9060add
BLAKE2b-256 4dc6cf81535688eb37e6b2a1f02093f587d94c9f397a839e0f22843d95b5a8a9

See more details on using hashes here.

File details

Details for the file nonebot_plugin_palworld_sync-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for nonebot_plugin_palworld_sync-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 aaea50bef6c476227d54ae3614c5f08bbb8a337a6161ffecb1f5d64d06af2009
MD5 8614079c343a8e45ca915b9bafb806b5
BLAKE2b-256 098c994af8c94452994fb90616bd8fb09613203a1696e97d5981c46232acf1ba

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