ChatSync - Minecraft 至 Discord 聊天同步
一个适用于 Minecraft 1.21.10 的 Fabric 客户端模组,用于将游戏内聊天消息同步到 Discord 频道。
功能特性
- ? 同步聊天消息和游戏系统消息至 Discord
- ? 支持使用正则表达式进行可配置的消息过滤
- ⚙️ 易于使用的 JSON 配置文件
- ? 通过 Mod Menu 在游戏内配置界面中进行设置
- ? 异步发送 Webhook(不会导致游戏卡顿)
- ? 仅限客户端(可在任何服务器上运行)
安装方法
- 确保你的 Minecraft 1.21.10 已安装 Fabric Loader
- 安装 Mod Menu(可选,但要在游戏内配置则必需)
- 下载 ChatSync 模组的 JAR 文件
- 将其放入
.minecraft/mods 文件夹中
- 启动 Minecraft
配置说明
你可以通过两种方式配置 ChatSync:
选项 1:游戏内配置界面(推荐)
- 安装 Mod Menu
- 在 Minecraft 中进入:Mods → ChatSync → Config
- 输入你的 Discord Webhook URL
- 自定义消息前缀
- 切换启用/禁用状态
- 点击“Done”保存
选项 2:手动配置文件
首次启动时,模组将在 .minecraft/config/chatsync.json 创建配置文件。
设置 Discord Webhook
- 进入你的 Discord 服务器设置
- 导航至 Integrations(集成)→ Webhooks
- 点击“New Webhook”
- 复制 Webhook URL
- 打开
.minecraft/config/chatsync.json
- 将
YOUR_WEBHOOK_URL_HERE 替换为你的实际 Webhook URL
配置文件结构
{
"webhookUrl": "https://discord.com/api/webhooks/YOUR_WEBHOOK_URL_HERE",
"enabled": true,
"messagePrefix": "> ",
"ignoredMessages": [
"^\\[.*\\].*",
"^>.*"
]
}
配置选项
- webhookUrl: 你的 Discord Webhook URL
- enabled: 设置为
false 可临时禁用模组,而无需移除它
- messagePrefix: 添加到每条消息前的文本(默认值:
"> ")
- 使用
"" 表示无前缀
- 示例:
"> ", "[MC] ", "? " 等
- ignoredMessages: 用于忽略特定消息的正则表达式数组
忽略消息示例
ignoredMessages 数组使用正则表达式来过滤不需要的消息:
"ignoredMessages": [
"^\\[.*\\].*", // 忽略以 [方括号] 开头的消息
"^>.*", // 忽略以 > 开头的消息
".*joined the game.*", // 忽略加入游戏消息
".*left the game.*", // 忽略离开游戏消息
"^!.*", // 忽略以 ! 开头的命令
"^/.*" // 忽略以 / 开头的命令
]
工作原理
该模组监听两个 Minecraft 事件:
- Chat Messages: 玩家聊天消息
- Game Messages: 系统消息(死亡、成就等)
当收到消息时,它会:
- 检查模组是否已启用
- 检查 Webhook URL 是否已配置
- 检查消息是否匹配任何忽略模式
- 如果所有检查均通过,则将消息异步发送到 Discord
故障排除
消息未出现在 Discord 中
- 检查配置文件中 Webhook URL 是否正确
- 确保
enabled 设置为 true
- 查看 Minecraft 日志中的错误信息
- 确认你的 Webhook 在 Discord 中仍然有效
部分消息被忽略
检查你的 ignoredMessages 模式——它们使用正则表达式,请确保模式正确无误。
模组未能加载
- 确保你拥有 Fabric Loader 0.18.4 或更高版本
- 确保你拥有 Fabric API 0.138.4+1.21.10 或更高版本
- 查看 Minecraft 日志中的错误信息
许可证
本项目基于 MIT 许可证开源——详情请参阅 LICENSE 文件。
支持
加入我们的 Discord! Discord
ChatSync - Minecraft to Discord Chat Sync
A client-side Fabric mod for Minecraft 1.21.10 that syncs in-game chat messages to a Discord webhook.
Features
- ? Syncs both chat messages and game messages to Discord
- ? Configurable message filtering with regex patterns
- ⚙️ Easy JSON configuration
- ? In-game config screen via Mod Menu
- ? Asynchronous webhook sending (doesn't lag the game)
- ? Client-side only (works on any server)
Installation
- Make sure you have Fabric Loader installed for Minecraft 1.21.10
- Install Mod Menu (optional, but required for in-game config)
- Download the ChatSync mod JAR file
- Place it in your
.minecraft/mods folder
- Launch Minecraft
Configuration
You can configure ChatSync in two ways:
Option 1: In-Game Config Screen (Recommended)
- Install Mod Menu
- In Minecraft, go to: Mods → ChatSync → Config
- Enter your Discord webhook URL
- Customize the message prefix
- Toggle enabled/disabled
- Click "Done" to save
Option 2: Manual Configuration File
On first launch, the mod will create a configuration file at .minecraft/config/chatsync.json
Setting up your Discord Webhook
- Go to your Discord server settings
- Navigate to Integrations → Webhooks
- Click "New Webhook"
- Copy the webhook URL
- Open
.minecraft/config/chatsync.json
- Replace
YOUR_WEBHOOK_URL_HERE with your actual webhook URL
Configuration File Structure
{
"webhookUrl": "https://discord.com/api/webhooks/YOUR_WEBHOOK_URL_HERE",
"enabled": true,
"messagePrefix": "> ",
"ignoredMessages": [
"^\\[.*\\].*",
"^>.*"
]
}
Configuration Options
- webhookUrl: Your Discord webhook URL
- enabled: Set to
false to temporarily disable the mod without removing it
- messagePrefix: Text to prepend to every message (default:
"> ")
- Use
"" for no prefix
- Examples:
"> ", "[MC] ", "? ", etc.
- ignoredMessages: Array of regex patterns for messages to ignore
Ignored Messages Examples
The ignoredMessages array uses regex patterns to filter out unwanted messages:
"ignoredMessages": [
"^\\[.*\\].*", // Ignore messages starting with [brackets]
"^>.*", // Ignore messages starting with >
".*joined the game.*", // Ignore join messages
".*left the game.*", // Ignore leave messages
"^!.*", // Ignore commands starting with !
"^/.*" // Ignore commands starting with /
]
How It Works
The mod listens to two Minecraft events:
- Chat Messages: Player chat messages
- Game Messages: System messages (deaths, achievements, etc.)
When a message is received, it:
- Checks if the mod is enabled
- Checks if the webhook URL is configured
- Checks if the message matches any ignored patterns
- If all checks pass, sends the message to Discord asynchronously
Troubleshooting
Messages aren't appearing in Discord
- Check that your webhook URL is correct in the config file
- Make sure
enabled is set to true
- Check the Minecraft logs for any error messages
- Verify your webhook is still active in Discord
Some messages are being ignored
Check your ignoredMessages patterns - they use regex, so make sure your patterns are correct.
The mod isn't loading
- Ensure you have Fabric Loader 0.18.4 or higher
- Ensure you have Fabric API 0.138.4+1.21.10 or higher
- Check the Minecraft logs for errors
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
Join our discord! Discord
评论 0
登录后参与评分
还没有评论,来抢沙发吧