mctg-bridge — Minecraft < - > Telegram 聊天桥接
mctg-bridge 是一款用于 Spigot 和 Paper 服务器的 Minecraft Telegram 桥接插件。它在双向同步 Minecraft 聊天与 Telegram 群组的同时,还包含了服务器管理命令、账号绑定以及可选的插件集成。
预览


功能
与仅做简单中继的插件相比,mctg-bridge 提供了:
- 双向 Telegram 群组 <-> Minecraft 聊天通信。
- 内置的 Telegram 命令,用于查看服务器状态、玩家列表、运行时间、内存、统计数据及排行榜统计。
- 可选的从 Minecraft 到 Telegram 的账号绑定功能。
- 可选的 LoginSecurity 和 InviteSystem 挂钩;仅在安装了对应插件时激活。
- 每个玩家的聊天可见性控制及消息合并。
- Telegram 图片渲染,支持可选的抖动处理(dithering)。
- 可选的 ngrok 支持,可从 Telegram 启动隧道。
- 配置存储在插件文件夹中;无需单独的桥接服务。
要求
- 运行在 Minecraft 1.17–1.21 版本的 Spigot、Paper 或兼容分支。
- Java 17+ 用于构建插件。
- 一个 Telegram 机器人和一个 Telegram 群组。
快速开始
- 下载最新的 JAR 文件。
- 将其放入
plugins/ 目录。
- 启动一次服务器以生成配置文件。
- 通过 @BotFather 创建 Telegram 机器人并禁用隐私模式。
- 将
api_token 添加到 plugins/tg-bridge/config.yml。
- 在你的 Telegram 群组中运行
/attach <code>。
- 重启服务器。
完整详细设置
1. Telegram 设置
- 在 Telegram 中打开 @BotFather。
- 运行
/newbot 并按照提示操作。
- 复制机器人的 API Token。请妥善保管,不要泄露。
- 运行
/setprivacy,选择该机器人,并将隐私设置为 Disabled,以便它能接收群组消息。
- 将机器人添加到目标 Telegram 群组。赋予其读取和发送消息所需的权限。
2. Minecraft 服务器设置
- 从 Releases 下载最新的稳定版 JAR 文件。
- 将其复制到服务器的
plugins/ 目录。
- 启动服务器一次。插件会创建
plugins/tg-bridge/config.yml。
- 将 Token 填入
api_token:
api_token: "123456:replace-with-your-token"
- 重启服务器。控制台会打印出一个临时代码,例如:
[tg-bridge] chat_id is null, use /attach <secretTempCode> to pin one
[tg-bridge] secretTempCode is set to -72683
- 在目标 Telegram 群组中,使用服务器打印的代码发送
/attach -72683。
- 再次重启服务器。桥接已就绪。
切勿公开 api_token 或临时的绑定代码。
使用示例
Telegram 群组命令
/list 在线的 Minecraft 玩家
/ping 检查机器人是否响应
/uptime 显示服务器运行时间
/memory 显示已分配内存
/stats 显示玩家统计数据
/top 显示排行榜统计
/kickme 踢出你绑定的 Minecraft 账号
预览


在安装对应插件后可用:
/invite 邀请某人加入服务器 (InviteSystem)
/removepass 移除你的密码 (LoginSecurity)
/changepass 修改你的密码 (LoginSecurity)
Minecraft 命令
/tg chat show
/tg chat hide
/tg account register
/tg chat hide 隐藏执行者看到的桥接 Telegram 消息。/tg account register 启动 Telegram 账号绑定流程。
设置
编辑 plugins/tg-bridge/config.yml,然后重启服务器。
| 设置项 |
用途 |
api_token |
Telegram 机器人 Token。必填。 |
chat_id |
绑定的 Telegram 群组 ID。由 /attach 自动设置。 |
enable_chat |
启用或禁用 Telegram 到 Minecraft 的聊天。 |
enable_dithering |
为 Telegram 照片启用图像抖动处理。 |
language |
默认注册消息的语言。 |
max_mc_accounts_per_tg |
一个 Telegram 账号最多可绑定的 Minecraft 账号数量。 |
log_status |
控制状态日志记录。 |
ngrok_auth |
/tunnel 使用的 ngrok Auth Token。 |
要使用可选的隧道功能,请将 ngrok auth token 放置在 ngrok_auth 中,然后在 Telegram 中发送 /tunnel。前往 ngrok 获取 Token。
从源码构建
mvn clean install
构建好的插件 JAR 文件将在 target/ 目录下生成。
链接
mctg-bridge — Minecraft < - > Telegram Chat Bridge
MCTG-bridge is a Minecraft Telegram bridge plugin for Spigot and Paper servers. It synchronizes Minecraft chat with a Telegram group in both directions and includes server management commands, account linking, and optional plugin integrations.
Preview


Features
Compared with simple relay-only plugins, MCTG-bridge provides:
- Two-way Telegram group <-> Minecraft chat communication.
- Built-in Telegram commands for server status, players, uptime, memory, statistics, and top statistics.
- Optional account linking from Minecraft to Telegram.
- Optional hooks for LoginSecurity and InviteSystem; they activate only when those plugins are installed.
- Per-player chat visibility and message compaction.
- Telegram image rendering with optional dithering.
- Optional ngrok support for a tunnel started from Telegram.
- Configuration stored in the plugin folder; no separate bridge service is required.
Requirements
- Spigot, Paper, or a compatible fork running Minecraft 1.17–1.21.
- Java 17+ for building the plugin.
- A Telegram bot and a Telegram group.
Quick start
- Download the latest JAR.
- Put it into
plugins/.
- Start the server once to generate the config.
- Create a Telegram bot with @BotFather and disable privacy mode.
- Add
api_token to plugins/tg-bridge/config.yml.
- Run
/attach <code> in your Telegram group.
- Restart the server.
Full detailed setup
1. Telegram setup
- Open @BotFather in Telegram.
- Run
/newbot and follow the prompts.
- Copy the bot API token. Keep it private.
- Run
/setprivacy, select the bot, and set privacy to Disabled so it can receive group messages.
- Add the bot to the target Telegram group. Give it the permissions needed to read and send messages.
2. Minecraft server setup
- Download the latest stable JAR from Releases.
- Copy it to the server's
plugins/ directory.
- Start the server once. The plugin creates
plugins/tg-bridge/config.yml.
- Put the token into
api_token:
api_token: "123456:replace-with-your-token"
- Restart the server. The console prints a temporary code, for example:
[tg-bridge] chat_id is null, use /attach <secretTempCode> to pin one
[tg-bridge] secretTempCode is set to -72683
- In the target Telegram group, send
/attach -72683 using the code printed by your server.
- Restart the server again. The bridge is ready.
Never publish api_token or the temporary attach code.
Usage examples
Telegram group commands
/list Online Minecraft players
/ping Check that the bot responds
/uptime Show server uptime
/memory Show allocated memory
/stats Show player statistics
/top Show top statistics
/kickme Kick your linked Minecraft account
Preview


Available when the matching plugin is installed:
/invite Invite a person to the server (InviteSystem)
/removepass Remove your password (LoginSecurity)
/changepass Change your password (LoginSecurity)
Minecraft commands
/tg chat show
/tg chat hide
/tg account register
/tg chat hide hides bridged Telegram messages for the executing player. /tg account register starts the Telegram account-linking flow.
Settings
Edit plugins/tg-bridge/config.yml, then restart the server.
| Setting |
Purpose |
api_token |
Telegram bot token. Required. |
chat_id |
Linked Telegram group. Set automatically by /attach. |
enable_chat |
Enable or disable Telegram-to-Minecraft chat. |
enable_dithering |
Enable image dithering for Telegram photos. |
language |
Default registration-message language. |
max_mc_accounts_per_tg |
Maximum Minecraft accounts linked to one Telegram account. |
log_status |
Control status logging. |
ngrok_auth |
ngrok auth token for /tunnel. |
To use the optional tunnel, place the ngrok auth token in ngrok_auth, then send /tunnel in Telegram. Get the token from ngrok.
Build from source
mvn clean install
The built plugin JAR is produced in target/.
Links
评论 0
登录后参与评分
还没有评论,来抢沙发吧