Discord Viper (ViperBridge)
ViperBridge 是一个高性能的、仅服务端的双向网关,用于桥接 Minecraft、Discord 和 REST API。无需客户端模组——原版玩家可正常连接。
模组功能
聊天中继 - Discord 频道与游戏内聊天之间的双向聊天,以及丰富的嵌入提示(加入、离开、死亡(含真实死亡原因)、进度达成(仅限真实公告,无配方刷屏)和服务器启动/停止)。
45 个 Discord 命令 - 每个命令均可作为原生斜杠 /command 和 !前缀 命令使用。所有斜杠回复均为私密(临时):仅执行命令者可见答案。
管理系统 - 踢出、封禁、IP 封禁、带自动解除的定时临时封禁(重启后保留)、服务端静音、编号警告、赦免、全员踢出以及封禁/白名单列表。静音、警告和临时封禁数据持久化保存在 viperbridge_punishments.json 中。
玩家查询 - 在线玩家实时读取;离线玩家读取其保存的玩家数据:坐标、精确到槽位的物品栏网格、正版与离线模式账号检测(含皮肤渲染)及最后上线时间。
单命令权限 - 每个命令都有独立的 Discord 角色/用户/Minecraft 玩家白名单、启用/禁用开关以及 Discord 客户端可见性标志。/help 仅列出请求者可使用的命令。
账号绑定 - 玩家通过一次性代码绑定 Discord 和 Minecraft 账号(在 Discord 中使用 /link,在游戏中使用 /viperbridge link <code>)。绑定关系支持按玩家权限,并兼容离线模式(Cracked)账号。
其他功能 - 控制台消息以约 1000 字符为块转发至 Discord(IP 地址被隐藏),实时玩家数量频道、机器人状态显示,以及基于 Bearer Token 的 REST API(健康检查、玩家列表、玩家信息、远程命令)。
命令列表
| Slash |
前缀 |
默认权限 |
描述 |
/help |
!help |
已授权 |
仅显示你可以使用的命令 |
/players |
!players |
已授权 |
列出在线玩家及其延迟 |
/player <name> |
!player <name> |
已授权 |
查看生命值、饥饿值、经验值、游戏模式、IP、物品栏 |
/coords <name> |
!coords <name> |
已授权 |
维度 + XYZ 坐标,支持在线或从存档数据中获取 |
/inventory <name> |
!inventory <name> |
已授权 |
精确到槽位的网格:盔甲、副手、快捷栏、主物品栏 |
/profile <name> |
!profile <name> |
已授权 |
检测是否破解版/正版、皮肤头像、链接状态 |
/skin <name> |
!skin <name> |
已授权 |
全身皮肤渲染 |
/link <mcname> |
!link <mcname> |
所有人 |
开始绑定,验证码将通过私信发送 |
/unlink |
!unlink |
已授权 |
移除你的账号绑定 |
/kick <name> [reason] |
!kick <name> [reason] |
已授权 |
踢出玩家 |
/ban <name> [reason] |
!ban <name> [reason] |
已授权 |
封禁玩家 |
/ipban <name> [reason] |
!ipban <name> [reason] |
已授权 |
IP 封禁玩家 |
/tempban <name> <dur> [reason] |
!tempban <name> <dur> [reason] |
已授权 |
限时封禁,自动解封(30秒/10分钟/2小时/7天) |
/mute <name> [dur] |
!mute <name> [dur] |
已授权 |
禁止聊天和命令(留空=永久) |
/unmute <name> |
!unmute <name> |
已授权 |
解除静音 |
/mutes |
!mutes |
已授权 |
被静音的玩家及剩余时间 |
/warn <name> [reason] |
!warn <name> [reason] |
已授权 |
编号警告,玩家在客户端内收到通知 |
/warnings <name> |
!warnings <name> |
已授权 |
显示玩家的警告记录 |
/clearwarns <name> |
!clearwarns <name> |
已授权 |
清除玩家的警告记录 |
/pardon <name> |
!pardon <name> |
已授权 |
解封玩家 |
/pardonip <ip> |
!pardonip <ip> |
已授权 |
解封 IP 地址 |
/kickall [reason] |
!kickall [reason] |
已授权 |
踢出所有在线玩家 |
/banlist |
!banlist |
已授权 |
被封禁的玩家及其原因 |
/kill <name> |
!kill <name> |
已授权 |
杀死玩家(必须在线) |
/say <message> |
!say <message> |
已授权 |
向所有玩家广播消息 |
/command <command> |
!cmd <command> |
已授权 |
执行任意 Minecraft 命令 |
/stop |
!stop |
已授权 |
停止服务器 |
/op <name> |
!op <name> |
已授权 |
授予管理员权限 |
/deop <name> |
!deop <name> |
已授权 |
移除管理员权限 |
/whitelist <action> [name] |
!whitelist <action> [name] |
已授权 |
添加/移除/开启/关闭/列表查看白名单 |
/gamemode <mode> [player] |
!gamemode <mode> [player] |
已授权 |
更改游戏模式 |
/give <player> <item> [count] |
!give <player> <item> [count] |
已授权 |
给予物品 |
/tp <player> <target> |
!tp <player> <target> |
已授权 |
传送至玩家或坐标 |
/heal <name> |
!heal <name> |
已授权 |
恢复生命值(必须在线) |
/feed <name> |
!feed <name> |
已授权 |
恢复饥饿值(必须在线) |
/seen <name> |
!seen <name> |
已授权 |
最后在线时间(或当前在线) |
/time <value> |
!time <value> |
已授权 |
白天/正午/夜晚/午夜/刻数 |
/weather <type> [sec] |
!weather <type> [sec] |
已授权 |
晴天/雨天/雷暴 |
/save |
!save |
已授权 |
将所有世界保存到磁盘 |
/status |
!status |
已授权 |
玩家数量、运行时间、内存、TPS 概览 |
/uptime |
!uptime |
已授权 |
服务器运行时间 |
/tps |
!tps |
已授权 |
TPS 信息 |
/memory |
!memory |
已授权 |
内存使用情况 |
/seed |
!seed |
已授权 |
世界种子 |
/ping |
!ping |
已授权 |
机器人延迟 |
/effect <player> <effect> [sec] [lvl] |
!effect <player> <effect> [sec] [lvl] |
已授权 |
给予状态效果 |
/clear <player> [item] |
!clear <player> [item] |
已授权 |
清空物品栏 |
/difficulty <level> |
!difficulty <level> |
已授权 |
和平/简单/普通/困难 |
/gamerule <rule> [value] |
!gamerule <rule> [value] |
已授权 |
设置或查询游戏规则 |
/spawnpoint <player> [x y z] |
!spawnpoint <player> [x y z] |
已授权 |
设置出生点 |
/setworldspawn [x y z] |
!setworldspawn [x y z] |
已授权 |
设置世界出生点 |
/defaultgamemode <mode> |
!defaultgamemode <mode> |
已授权 |
默认游戏模式 |
/sudo <player> <command> |
!sudo <player> <command> |
已授权 |
以玩家身份执行命令 |
游戏内命令:/viperbridge reload(重载配置)、/viperbridge status、/viperbridge discord reconnect、/viperbridge link <code>(所有玩家均可使用,无需 OP 权限)。
配置
首次启动后编辑 world/viperbridge/viperbridge.json(在游戏中通过 /viperbridge reload 重载)。
| 字段 |
类型 |
默认值 |
说明 |
discordBotToken |
string |
"" |
来自开发者门户的 Discord 机器人令牌。必填。 |
discordGuildId |
string |
"" |
Discord 服务器 ID。启用即时斜杠命令注册和角色功能。 |
channels.chatRelayChannelId |
string |
"" |
聊天中继 + 前缀命令频道。 |
channels.consoleForwardChannelId |
string |
"" |
服务器控制台输出频道。 |
channels.liveStatusChannelId |
string |
"" |
显示实时玩家数量的频道。 |
webApi.enabled |
boolean |
false |
启用 REST API。 |
webApi.port |
number |
8080 |
REST API 端口。 |
webApi.apiSecretToken |
string |
"" |
REST API 认证的 Bearer 令牌。 |
forwardConsole |
boolean |
true |
控制台转发的总开关。 |
privacyMode |
boolean |
false |
完全隐藏 IP,阻止离线玩家的坐标/物品栏查询,隐藏 REST API 中的 IP。 |
directRoleSync.syncEnabled |
boolean |
false |
将 Discord 角色同步到 Minecraft 队伍。 |
directRoleSync.mappings |
object |
{} |
Discord 角色 ID 到 MC 队伍的映射。 |
commandPrefix |
string |
"!" |
文本命令的前缀。 |
enableDiscordCommands |
boolean |
true |
Discord 命令的总开关。 |
allowedRoles |
string[] |
[] |
允许使用命令的全局 Discord 角色 ID。 |
allowedUsers |
string[] |
[] |
允许使用命令的全局 Discord 用户 ID。 |
botActivityText |
string |
"online players" |
机器人状态文本(支持 %count%、%max% 占位符)。 |
linkCodeExpiryMinutes |
number |
10 |
链接代码的有效时长(分钟)。 |
commandPermissions.<cmd>.enabled |
boolean |
true |
单个命令的启用/禁用开关。 |
commandPermissions.<cmd>.roles |
string[] |
[] |
允许使用该命令的 Discord 角色 ID。 |
commandPermissions.<cmd>.users |
string[] |
[] |
允许使用该命令的 Discord 用户 ID。 |
commandPermissions.<cmd>.players |
string[] |
[] |
允许的 Minecraft 用户名(通过已绑定的账户匹配)。 |
commandPermissions.<cmd>.minPermission |
string |
"NONE" |
Discord 端斜杠命令的可见性权限:NONE、KICK_MEMBERS、BAN_MEMBERS、MODERATE_MEMBERS、MANAGE_SERVER、ADMINISTRATOR。 |
commandPermissions.<cmd>.open |
boolean |
false |
任何人都可以使用该命令(link 命令默认开放)。 |
每个命令的检查按以下顺序执行:open,然后 players(绑定的 MC 用户名),然后命令特定的 roles/users,最后是全局回退规则。被拒绝的请求会收到仅对请求者可见的私有错误提示。
注意:1.21.x 版本构建使用数字形式的频道/服务器 ID,并额外包含一个 discordInviteLink 字段;其他内容完全相同。
隐私模式
设置 "privacyMode": true 以锁定模组:Discord 输出中的所有 IP(包括控制台和玩家查询)将被完全隐藏而非仅用 spoiler 掩码处理,REST API 的 IP 字段返回 "hidden",且 coords/inventory 将拒绝查询离线玩家(在线玩家仍可查看)。公共聊天中继和公告不受影响。
REST API
认证头:Authorization: Bearer <apiSecretToken>。
| 方法 |
端点 |
认证要求 |
说明 |
| GET |
/api/health |
可选 |
状态、玩家数量、游戏刻数 |
| GET |
/api/players |
必需 |
所有在线玩家及其统计信息 |
| GET |
/api/player/{name} |
必需 |
单个玩家信息 |
| POST |
/api/command |
必需 |
运行命令:{"command": "say hello"} |
安装
- 在服务器上安装 Fabric Loader(1.21.x 需 0.16.x+,26.x 需 0.17.x+)和 Fabric API。
- 下载与你的 Minecraft 版本(1.21.x、26.1.x、26.2.x 或 26.3)匹配的 JAR 文件,并将其放入服务器的
mods 文件夹中。
- 启动服务器一次以生成
world/viperbridge/viperbridge.json 配置文件,然后停止服务器。
- 编辑配置文件:设置
discordBotToken、channels 下的频道 ID 以及命令权限。
- 在 Discord 开发者门户中启用 MESSAGE CONTENT INTENT 和 SERVER MEMBERS INTENT,然后邀请机器人加入服务器。
- 重启服务器。
Discord Viper (ViperBridge)
ViperBridge is a high-performance, server-side only bidirectional gateway bridging Minecraft, Discord, and REST APIs. No client mods required - vanilla players connect normally.
What the mod does
Chat relay - Two-way chat between a Discord channel and in-game chat, plus rich embed alerts for joins, leaves, deaths (with the real death reason), advancements (real announcements only, no recipe spam), and server start/stop.
45 Discord commands - Every command works as a native slash /command and as a !prefix command. All slash replies are private (ephemeral): only the person who ran the command sees the answer.
Moderation system - Kick, ban, IP-ban, timed tempbans with automatic pardon (survives restarts), server-side mutes, numbered warnings, pardons, kick-all, and ban/whitelist lists. Mutes, warnings, and tempbans persist in viperbridge_punishments.json.
Player lookups - Online players read live; offline players read their saved player data: coordinates, slot-accurate inventory grids, cracked-vs-premium profile checks with skin renders, and last-seen times.
Per-command permissions - Each command has its own Discord roles/users/Minecraft-player allowlist, on/off switch, and Discord client visibility flag. /help only lists commands the requester may use.
Account linking - Players link Discord and Minecraft accounts with a one-time code (/link in Discord, /viperbridge link <code> in game). Links power per-player permissions and work with cracked (offline-mode) accounts.
Extras - Console forwarding to Discord in ~1000-character chunks with IPs spoiler-masked, live player-count channel, bot presence, and a bearer-token REST API (health, players, player info, remote commands).
Command list
| Slash |
Prefix |
Default access |
Description |
/help |
!help |
Authorized |
Show only the commands you may use |
/players |
!players |
Authorized |
List online players with ping |
/player <name> |
!player <name> |
Authorized |
Health, hunger, XP, gamemode, IP, inventory |
/coords <name> |
!coords <name> |
Authorized |
Dimension + XYZ, online or from saved data |
/inventory <name> |
!inventory <name> |
Authorized |
Slot-accurate grid: armor, offhand, hotbar, main |
/profile <name> |
!profile <name> |
Authorized |
Cracked/premium check, skin avatar, link status |
/skin <name> |
!skin <name> |
Authorized |
Full-body skin render |
/link <mcname> |
!link <mcname> |
Everyone |
Start linking, code delivered by DM |
/unlink |
!unlink |
Authorized |
Remove your account link |
/kick <name> [reason] |
!kick <name> [reason] |
Authorized |
Kick a player |
/ban <name> [reason] |
!ban <name> [reason] |
Authorized |
Ban a player |
/ipban <name> [reason] |
!ipban <name> [reason] |
Authorized |
IP-ban a player |
/tempban <name> <dur> [reason] |
!tempban <name> <dur> [reason] |
Authorized |
Timed ban, auto-pardon (30s/10m/2h/7d) |
/mute <name> [dur] |
!mute <name> [dur] |
Authorized |
Block chat + commands (empty = forever) |
/unmute <name> |
!unmute <name> |
Authorized |
Remove a mute |
/mutes |
!mutes |
Authorized |
Muted players with remaining time |
/warn <name> [reason] |
!warn <name> [reason] |
Authorized |
Numbered warning, player notified in game |
/warnings <name> |
!warnings <name> |
Authorized |
Show a player's warnings |
/clearwarns <name> |
!clearwarns <name> |
Authorized |
Clear a player's warnings |
/pardon <name> |
!pardon <name> |
Authorized |
Unban a player |
/pardonip <ip> |
!pardonip <ip> |
Authorized |
Unban an IP address |
/kickall [reason] |
!kickall [reason] |
Authorized |
Kick every online player |
/banlist |
!banlist |
Authorized |
Banned players with reasons |
/kill <name> |
!kill <name> |
Authorized |
Kill a player (must be online) |
/say <message> |
!say <message> |
Authorized |
Broadcast to all players |
/command <command> |
!cmd <command> |
Authorized |
Execute any Minecraft command |
/stop |
!stop |
Authorized |
Stop the server |
/op <name> |
!op <name> |
Authorized |
Grant operator status |
/deop <name> |
!deop <name> |
Authorized |
Remove operator status |
/whitelist <action> [name] |
!whitelist <action> [name] |
Authorized |
add/remove/on/off/list the whitelist |
/gamemode <mode> [player] |
!gamemode <mode> [player] |
Authorized |
Change gamemode |
/give <player> <item> [count] |
!give <player> <item> [count] |
Authorized |
Give items |
/tp <player> <target> |
!tp <player> <target> |
Authorized |
Teleport to a player or coordinates |
/heal <name> |
!heal <name> |
Authorized |
Restore health (must be online) |
/feed <name> |
!feed <name> |
Authorized |
Restore hunger (must be online) |
/seen <name> |
!seen <name> |
Authorized |
Last-online time (or online now) |
/time <value> |
!time <value> |
Authorized |
day/noon/night/midnight/ticks |
/weather <type> [sec] |
!weather <type> [sec] |
Authorized |
clear/rain/thunder |
/save |
!save |
Authorized |
Save all worlds to disk |
/status |
!status |
Authorized |
Players, uptime, memory, ticks overview |
/uptime |
!uptime |
Authorized |
Server uptime |
/tps |
!tps |
Authorized |
Tick info |
/memory |
!memory |
Authorized |
RAM usage |
/seed |
!seed |
Authorized |
World seed |
/ping |
!ping |
Authorized |
Bot latency |
/effect <player> <effect> [sec] [lvl] |
!effect <player> <effect> [sec] [lvl] |
Authorized |
Give a status effect |
/clear <player> [item] |
!clear <player> [item] |
Authorized |
Clear inventory |
/difficulty <level> |
!difficulty <level> |
Authorized |
peaceful/easy/normal/hard |
/gamerule <rule> [value] |
!gamerule <rule> [value] |
Authorized |
Set or query a gamerule |
/spawnpoint <player> [x y z] |
!spawnpoint <player> [x y z] |
Authorized |
Set spawn point |
/setworldspawn [x y z] |
!setworldspawn [x y z] |
Authorized |
Set world spawn |
/defaultgamemode <mode> |
!defaultgamemode <mode> |
Authorized |
Default gamemode |
/sudo <player> <command> |
!sudo <player> <command> |
Authorized |
Run a command as a player |
In-game commands: /viperbridge reload (reload config), /viperbridge status, /viperbridge discord reconnect, /viperbridge link <code> (usable by every player, no OP needed).
Configuration
Edit world/viperbridge/viperbridge.json after first launch (reload in game with /viperbridge reload).
| Field |
Type |
Default |
Description |
discordBotToken |
string |
"" |
Discord bot token from the Developer Portal. Required. |
discordGuildId |
string |
"" |
Discord server ID. Enables instant slash-command registration and role features. |
channels.chatRelayChannelId |
string |
"" |
Chat relay + prefix-command channel. |
channels.consoleForwardChannelId |
string |
"" |
Server console output channel. |
channels.liveStatusChannelId |
string |
"" |
Channel renamed with the live player count. |
webApi.enabled |
boolean |
false |
Enable the REST API. |
webApi.port |
number |
8080 |
REST API port. |
webApi.apiSecretToken |
string |
"" |
Bearer token for REST API auth. |
forwardConsole |
boolean |
true |
Master switch for console forwarding. |
privacyMode |
boolean |
false |
Full IP redaction, offline coords/inventory blocked, REST IPs hidden. |
directRoleSync.syncEnabled |
boolean |
false |
Sync Discord roles to MC teams. |
directRoleSync.mappings |
object |
{} |
Discord role ID to MC team mappings. |
commandPrefix |
string |
"!" |
Prefix for text commands. |
enableDiscordCommands |
boolean |
true |
Master switch for Discord commands. |
allowedRoles |
string[] |
[] |
Global Discord role IDs allowed to use commands. |
allowedUsers |
string[] |
[] |
Global Discord user IDs allowed to use commands. |
botActivityText |
string |
"online players" |
Bot status text (%count%, %max% placeholders). |
linkCodeExpiryMinutes |
number |
10 |
How long link codes stay valid. |
commandPermissions.<cmd>.enabled |
boolean |
true |
Per-command on/off switch. |
commandPermissions.<cmd>.roles |
string[] |
[] |
Discord role IDs allowed for this command. |
commandPermissions.<cmd>.users |
string[] |
[] |
Discord user IDs allowed for this command. |
commandPermissions.<cmd>.players |
string[] |
[] |
Minecraft usernames allowed (matched via linked accounts). |
commandPermissions.<cmd>.minPermission |
string |
"NONE" |
Discord-side slash visibility: NONE, KICK_MEMBERS, BAN_MEMBERS, MODERATE_MEMBERS, MANAGE_SERVER, ADMINISTRATOR. |
commandPermissions.<cmd>.open |
boolean |
false |
Anyone may use the command (link is open by default). |
Checks run in order per command: open, then players (linked MC name), then command roles/users, then the global fallback. Denied attempts get a private error visible only to the requester.
Note: the 1.21.x build uses numeric channel/guild IDs and an extra discordInviteLink field; everything else is identical.
Privacy mode
Set "privacyMode": true to lock the mod down: every IP in Discord output (console, player lookups) is fully redacted instead of spoiler-masked, REST API IP fields return "hidden", and coords/inventory refuse offline-player lookups (online players still work). Public chat relay and announcements are unaffected.
REST API
Auth header: Authorization: Bearer <apiSecretToken>.
| Method |
Endpoint |
Auth |
Description |
| GET |
/api/health |
Optional |
Status, player count, ticks |
| GET |
/api/players |
Required |
All online players with stats |
| GET |
/api/player/{name} |
Required |
Single player info |
| POST |
/api/command |
Required |
Run a command: {"command": "say hello"} |
Installation
- Install Fabric Loader (0.16.x+ for 1.21.x, 0.17.x+ for 26.x) and Fabric API on your server.
- Download the JAR matching your Minecraft version (1.21.x, 26.1.x, 26.2.x, or 26.3) and drop it into the server
mods folder.
- Start the server once so
world/viperbridge/viperbridge.json is created, then stop it.
- Edit the config: set
discordBotToken, the channel IDs under channels, and command permissions.
- In the Discord Developer Portal, enable MESSAGE CONTENT INTENT and SERVER MEMBERS INTENT, then invite the bot.
- Restart the server.
评论 0
登录后参与评分
还没有评论,来抢沙发吧