Velocity Discord
将来自所有服务器的聊天内容桥接到一个 Discord 频道。
功能
- 可配置
- 支持 Webhook、嵌入(embed)或普通文本发送消息
- 机器人状态显示玩家数量
- 列表命令(List command)
- 所有消息支持模板语法
- 显示死亡与进度(Advancement)消息
- 服务器启动/停止消息
- 频道主题(Topic)中显示服务器状态
- 重载命令,可在服务器运行时更改配置
注意 此插件需要 配套的 Velocity 插件 以及 配套的后端模组/插件 以支持进度/死亡消息
安装
- 在此处创建机器人应用
- 转到
Bot选项卡并点击Add bot
- 转到
- 在
Privileged Gateway Intents(特权网关意图)下启用SERVER MEMBERS INTENT和MESSAGE CONTENT INTENT - 复制机器人的 Token,你可能需要先点击
Reset Token - 将插件安装到你的服务器,启动一次服务器,然后再次停止服务器
- 打开位于
plugins/discord/config.toml的插件配置文件 - 在
[discord]部分,将你的 Token 粘贴到TOKEN的位置 - 在
[discord]部分,粘贴你想要使用的频道 ID- 要获取频道 ID,你需要在 Discord 中启用开发者模式
- 打开 Discord 设置,进入
Advanced(高级),然后开启Developer Mode(开发者模式) - 现在右键点击你想要使用的频道,然后点击
Copy ID(复制 ID)
- 设置任何你需要的其他配置选项
- 启动服务器并检查是否正常工作
使用 Webhook
- 在你想要使用的频道中创建一个 Webhook
- 右键点击该频道,点击
Edit Channel(编辑频道),进入Integrations(集成),点击Create Webhook(创建 Webhook) - 复制 Webhook URL
- 右键点击该频道,点击
- 将 Webhook URL 粘贴到配置文件中的
[discord.webhook]下方
用于进度/死亡消息
配置
配置文件生成于 plugins/discord/config.toml。默认配置请参阅 此处
Velocity Discord
Chat from all servers gets bridged with a discord channel
Features
- Configurable
- Webhooks or embeds or normal text for messages
- Player count in bot status
- List command
- Templating syntax for all messages
- Death and Advancement messages shown
- Server start/stop messages
- Server status in channel topic
- Reload command for config changes while the server is running
Note This requires a companion Velocity plugin and companion backend mod/plugin for advancement/death messages
Installation
- Create a bot application here
- Go to the
Bottab and clickAdd bot
- Go to the
- Enable the
SERVER MEMBERS INTENTandMESSAGE CONTENT INTENTunderPrivileged Gateway Intents - Copy the bot's token, you might have to click
Reset Tokenfirst - Install the plugin on your server, start the server once, then stop the server again
- Open the plugin config file at
plugins/discord/config.toml - Under
[discord], paste your token in place ofTOKEN - Under
[discord], paste the channel id you want to use- To get a channel id, you have to enable developer mode in Discord
- Open Discord settings, go to
Advanced, then turn onDeveloper Mode - Now right-click the channel you want to use and click
Copy ID
- Set any additional config options you want
- Start the server and check if it works
For Webhooks
- Create a webhook in the channel you want to use
- Right-click the channel, click
Edit Channel, go toIntegrations, clickCreate Webhook - Copy the webhook URL
- Right-click the channel, click
- Paste the webhook URL under
[discord.webhook]in the config file
For advancements/deaths
- Install the YepLib velocity plugin alongside this plugin
- Install the YepTwo backend mod/plugin on each of your backend servers that you want to receive advancements/deaths from
Configuration
The config file is generated at plugins/discord/config.toml. See here for the default config
下载 Velocity Discord
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Velocity Discord
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Velocity Discord
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Velocity Discord
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Velocity Discord
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Velocity Discord
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Velocity Discord
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
下载 Velocity Discord
需要联机服务器吗?
稳定流畅、一键部署,几分钟即可和朋友联机开服
最低仅需 8 元/月 即可畅快联机
更新内容
- 通过 @chaos-baum 在 实现:将所有用户事件通过 Webhook 发送
- 通过 @Kaludii 在 实现:支持来自 Discord 的游戏内消息中的 Discord 角色前缀
- 通过 @elliotnash 在 实现:添加 Discord 用户名聊天补全功能
- 由 @coolguy284 在 修复:原始 Discord 提及绕过过滤器的漏洞
- 由 @coolguy284 在 修复:服务器 Discord 消息进度覆盖不生效的问题
- 由 @LunaSquee 在 修复:Webhook 配置问题
配置变更
版本升级
- config_version = "1.9"
+ config_version = "2.0"
新增服务器显示名称部分
# 服务器显示名称
# 如果在此列表中未找到服务器,将使用服务器名称(来自 velocity.toml)作为替代
[server_names]
# lobby = "Lobby"
将频道主题配置移至 discord.channel_topic 部分下
# 频道主题配置(如果启用)
+ [discord.channel_topic]
# 频道主题的模板
# 可用占位符:
# {players} - 在线玩家总数
# {player_list} - 玩家列表(格式定义如下)
# {servers} - 服务器数量
# {server_list} - 服务器名称列表
# {hostname} - 服务器主机名
# {port} - 服务器端口
# {motd} - 每日消息 (MOTD)
# {query_port} - 查询端口
# {max_players} - 最大玩家数
# {plugins} - 插件数量
# {plugin_list} - 插件名称列表
# {version} - 服务器版本
# {software} - 软件名称
# {average_ping} - 所有玩家的平均延迟
# {uptime} - 服务器运行时间(小时和分钟)
# {server[SERVERNAME]} - 每个服务器名称和状态的动态占位符(例如 {server[MyServer]}, {server[AnotherServer]}, {server[Lobby]} 等)
- topic = """{players}/{max_players}
+ format = """{players}/{max_players}
{player_list}
{hostname}:{port}
运行时间: {uptime}"""
# 频道主题中 server[SERVERNAME] 占位符的模板
# 可用占位符: {name}, {players}, {max_players}, {motd}, {version}, {protocol}
- topic_server = "{name}: {players}/{max_players}"
+ server = "{name}: {players}/{max_players}"
# 频道主题中服务器离线时的 server[SERVERNAME] 占位符模板
# 可用占位符: {name}
- topic_server_offline = "{name}: Offline"
+ server_offline = "{name}: Offline"
# 可以使用 "" 或 false 禁用以在没有玩家在线时完全隐藏列表
- topic_player_list_no_players_header = "No players online"
+ player_list_no_players_header = "No players online"
# 可以使用 "" 或 false 禁用标头并仅显示玩家列表
- topic_player_list_header = "Players: "
+ player_list_header = "Players: "
# 可用占位符: {username}, {ping}
- topic_player_list_player = "{username}"
+ player_list_player = "{username}"
# 列表中玩家之间的分隔符,\n 可用于换行
- topic_player_list_separator = ", "
+ player_list_separator = ", "
# 主题中显示的最大玩家数
# 设置为 0 以显示所有玩家
- topic_player_list_max_count = 10
+ player_list_max_count = 10
从 Webhook 配置选项中移除 webook_ 前缀
[discord.webhook]
# 用于发送聊天消息的完整 Webhook URL
- webhook_url = ""
+ url = ""
# 获取玩家头像的头像服务完整 URL
# 可用占位符: {uuid}, {username}
avatar_url = "https://visage.surgeplay.com/face/96/{uuid}"
# Webhook 用户名的格式
# 可用占位符: {username}, {server}
- webhook_username = "{username}"
+ username = "{username}"
将聊天消息格式移至独立部分
- [discord.chat]
+ [discord.chat.message]
- message = "{username}: {message}"
+ format = "{username}: {message}"
- message_type = "text"
+ type = "text"
- message_embed_color = ""
+ embed_color = ""
+ [discord.chat.join]
- join_message = "**{username} joined the game**"
+ format = "**{username} joined the game**"
- join_message_type = "text"
+ type = "text"
- join_message_embed_color = "#40bf4f"
+ embed_color = "#40bf4f"
+ [discord.chat.leave]
- leave_message = "**{username} left the game**"
+ format = "**{username} left the game**"
- leave_message_type = "text"
+ type = "text"
- leave_message_embed_color = "#bf4040"
+ embed_color = "#bf4040"
+ [discord.chat.disconnect]
- disconnect_message = "**{username} disconnected**"
+ format = "**{username} disconnected**"
- disconnect_message_type = "text"
+ type = "text"
- disconnect_message_embed_color = "#bf4040"
+ embed_color = "#bf4040"
+ [discord.chat.server_switch]
- server_switch_message = "**{username} moved to {current} from {previous}**"
+ format = "**{username} moved to {current} from {previous}**"
- server_switch_message_type = "text"
+ type = "text"
- server_switch_message_embed_color = "#40bf4f"
+ embed_color = "#40bf4f"
+ [discord.chat.death]
- death_message = "**{death_message}**"
+ format = "**{death_message}**"
- death_message_type = "text"
+ type = "text"
- death_message_embed_color = "#bf4040"
+ embed_color = "#bf4040"
+ [discord.chat.advancement]
- advancement_message = "**{username} has made the advancement __{advancement_title}__**\n_{advancement_description}_"
+ format = "**{username} has made the advancement __{advancement_title}__**\n_{advancement_description}_"
- advancement_message_type = "text"
+ type = "text"
- advancement_message_embed_color = "#40bf4f"
+ embed_color = "#40bf4f"
+ [discord.chat.proxy_start]
- proxy_start_message = "**Proxy started**"
+ format = "**Proxy started**"
- proxy_start_message_type = "text"
+ type = "text"
- proxy_start_message_embed_color = "#40bf4f"
+ embed_color = "#40bf4f"
+ [discord.chat.proxy_stop]
- proxy_stop_message = "**代理已停止**"
+ format = "**代理已停止**"
- proxy_stop_message_type = "text"
+ type = "text"
- proxy_stop_message_embed_color = "#bf4040"
+ embed_color = "#bf4040"
+ [discord.chat.server_start]
- server_start_message = "**{server} 已启动**"
+ format = "**{server} 已启动**"
- server_start_message_type = "text"
+ type = "text"
- server_start_message_embed_color = "#40bf4f"
+ embed_color = "#40bf4f"
+ [discord.chat.server_stop]
- server_stop_message = "**{server} 已停止**"
+ format = "**{server} 已停止**"
- server_stop_message_type = "text"
+ type = "text"
- server_stop_message_embed_color = "#bf4040"
+ embed_color = "#bf4040"
新增插件命令名称配置
[minecraft]
# 游戏内命令
# 不可被服务器覆盖
# 例如:/discord, /discord reload, /discord topic preview
plugin_command = "discord"
新增角色前缀配置
[minecraft]
# ...
- message = "{discord_chunk} {username_chunk}<dark_gray>: <reset>{message} {attachments}"
+ message = "{discord_chunk} {role_prefix} {username_chunk}<dark_gray>: <reset>{message} {attachments}"
# 角色前缀配置
# 格式:"role_id" = "使用 MiniMessage 的前缀格式"
+ [minecraft.role_prefixes]
# "123456789" = "<dark_gray>[</dark_gray><red><b>OWNER</b></red><dark_gray>]</dark_gray>"
# "987654321" = "<dark_gray>[</dark_gray><blue>ADMIN</blue><dark_gray>]</dark_gray>"
# "456789123" = "<dark_gray>[</dark_gray><green>MOD</green><dark_gray>]</dark_gray>"
# "789123456" = "<dark_gray>[</dark_gray><aqua>HELPER</aqua><dark_gray>]</dark_gray>"
新增链接检测与格式化配置
[minecraft]
# ...
# 可用占位符:{url}, {link_color}
# 可通过设置为 "" 或 false 来禁用
links = "<click:open_url:\"{url}\"><hover:show_text:\"点击打开 {url}\"><dark_gray>[</dark_gray><{link_color}>Link<dark_gray>]</hover></click>"
# ...
link_color = "#4abdff"
支持按服务器覆盖大多数配置选项
未覆盖的选项将继承全局配置值。
例如,要为名为 lobby 的服务器覆盖游戏内消息格式以及发送消息的频道:
[override.lobby.minecraft]
message = "不同的格式 {username}: {message}"
[override.lobby.discord]
channel_id = "123456789012345678"
[!NOTE] 配置节(例如
[minecraft]、[discord])需要以override.server_name.为前缀:
[override.lobby.minecraft][override.lobby.discord][override.lobby.discord.chat.message]
新贡献者
- @Kaludii 在 中完成了首次贡献
- @elliotnash 在 中完成了首次贡献
- @coolguy284 在 中完成了首次贡献
- @LunaSquee 在 中完成了首次贡献
完整更新日志:
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
插件
PacketEvents 是一款专为 Minecraft Java 版打造的协议库,旨在简化数据包的处理与传输。
插件
ExyliaPlugins 的库。
插件
通过对话框或铁砧界面帮助你的 Anthme
插件
自定义你的Minecraft头像!
插件
重新定义服务器上的生物运输方式。使用高度可定制的口袋道具,安全地捕获、存储和释放任何实体。
插件
为基于 Spigot/Paper/Folia 的服务器添加对 Vivecraft 的支持
评论 0
登录后参与评分
还没有评论,来抢沙发吧