版本 4.X.X
有关该模组的旧版本,请查阅 wiki。
此模组将 Minecraft 聊天与 Discord 聊天连接起来。
该模组为 Dimension Access Manager 模组(CurseForge 或 Modrinth)和 More MobGriefing Options 模组(CurseForge 或 Modrinth)添加了 Discord 命令集成。
此模组仅在服务端运行,在客户端无法使用。
想要和朋友一起玩,需要一个服务器?但不知道如何搭建?直接租用一个已配置好的服务器吧!
点击上方的图片,选择一个套餐(建议至少 6 GB),
使用我的代码 agent 可享受首月 25% 的折扣,并与朋友们尽情游玩!
重要提示
- 当分享安装了 Discord Integration 的服务器世界时,请务必删除 "serverconfig" 文件夹中的 "discordintegration-server.toml" 文件,以保护你的机器人令牌。
- 你可以在 Discord 开发者网站 的“Bot”选项卡中重新生成机器人令牌。
支持

尚未发布该模组的 Minecraft 版本不受支持。
你可以在这里找到文本版本的支持列表。
功能
聊天
Minecraft > Discord
Minecraft 聊天中的所有消息都会通过 Discord 机器人发送到 Discord 聊天频道。
额外的死亡消息和进度提示消息也会发送到 Discord。
“say”和“me”命令已被修改,其发送的消息也会同步到 Discord。
服务器启动和停止的消息可以在配置文件中自定义。
Discord > Minecraft
除了来自机器人的消息外,所有消息都会发送到 Minecraft 聊天。
如果在配置中启用,机器人消息也可以发送到 Minecraft 聊天。
为了防止垃圾信息,可以从 Discord 传输到 Minecraft 的消息最大长度可以进行配置。如果消息过长,会在 Discord 聊天中显示错误消息。
作为命令的消息也不会发送到 Minecraft 聊天。
Discord Integration 默认添加了一些命令,自定义命令可以在配置中添加。命令前缀也可以在配置中进行设置。
管理
Discord Integration 的“管理”部分由两部分组成:管理频道和管理角色。
在所有 Discord Integration 命令都可以在管理频道中使用。此外,还会显示关于服务器启动、停止、崩溃以及玩家加入和离开的消息。如果启用了白名单功能,当 Minecraft 和 Discord 账号链接或取消链接,以及 Minecraft 账号被添加到或移除白名单时,会显示额外的消息。
此外,管理频道还可以用于 Minecraft 服务器的管理员和版主之间的对话,这些对话不会显示在 Minecraft 聊天中。
具有管理角色的用户可以使用标记为管理命令的命令来执行操作。
白名单
要使用 Discord Integration 的白名单功能,需要在 server.properties 文件中激活白名单。它有两种机制来确保白名单的安全:角色管理和单链接管理,将在以下部分中描述。当用户离开 Discord 服务器时,他们的链接会自动移除。如果链接不同步(例如因为 Minecraft 服务器离线或 Discord API 出现问题),可以通过重启服务器来解决,这将重新同步链接。
配置文件键 "whitelist.use_role" 用于设置是否启用角色机制,而配置文件键 "whitelist.use_single_linking_management" 用于设置是否启用单链接管理。
用户可以在聊天频道中使用 !link 和 !unlink 命令创建链接。重要提示:必须在配置中启用 !link 和 !unlink 命令后才能使用它们。
仅链接
如果两种机制都禁用,用户只需创建链接即可进入白名单。
角色
如果角色机制启用,用户必须拥有 ID 设置为配置文件键 "whitelist.role_id" 的角色。该角色必须由 Discord 服务器的版主分配。如果使用 "@everyone" 角色,用户只需创建一个链接即可进入白名单。
单链接管理
对于单链接管理,需要设置两个配置值。"whitelist.linking_management_channel_id" 需要设置为显示“链接消息”的频道的 ID。"whitelist.single_linking_management_role_id" 是用于激活或停用链接的角色 ID。可以通过点击消息下方的勾选或“X”反应来简单地激活或停用链接。
在启动时,链接管理频道中的所有链接消息都会更新,由于 Discord API 的限制,每条消息大约需要 1 秒。

角色 + 单个链接管理
Discord 用户必须拥有分配的角色,其 ID 设置为配置变量 whitelist.role_id,并且该链接必须在链接管理频道中激活(详细信息见上一节)。
Minecraft 命令
/discord commands - 显示在 Discord Integration 中配置的可用命令列表及其帮助消息。
/discord gamerules - 显示所有 Minecraft 游戏规则的当前值。
/discord mods - 显示服务器上的所有模组列表。
/discord link <player> [<discordMemberId>] - 创建 Discord 用户与 Minecraft 玩家之间的链接。从 Discord 聊天中只能使用仅包含玩家名称的参数;在 Minecraft 中,只有同时提供玩家名称和 discordMemberId 时才能使用该命令(仅限 op 等级为 3 或更高的玩家)。
/discord unlink <player> [<discordMemberId>] - 删除 Discord 用户与 Minecraft 玩家之间的链接。从 Discord 聊天中只能使用仅包含玩家名称的参数;在 Minecraft 中,只有同时提供玩家名称和 discordMemberId 时才能使用该命令(仅限 op 等级为 3 或更高的玩家)。
默认 Discord 命令
如果在 Discord 聊天中输入以下命令,你将获得来自 Minecraft 服务器的信息。
可以在配置文件中添加自定义命令。
Vanilla Minecraft 命令
!difficulty - 显示服务器的难度设置。
!gamerules - 显示游戏规则及其值。
!help - 显示所有命令及其描述。
!link <Minecraft player name> - 将 Minecraft 玩家与此命令所在的 Discord 用户进行链接。
!mods - 显示服务器上模组的列表。
!online - 显示在线玩家的数量及具体名单。
!seed - 显示当前世界的种子。
!time - 显示服务器上的当前时间。
!tps - 显示服务器的 TPS 统计信息及其维度数据。
!unlink <Minecraft player name> - 通过此命令取消 Minecraft 玩家与该 Discord 用户的链接。
!dimensions - 显示所有维度的访问状态。
!mobgriefing - 显示所有生物相关的破坏选项。
服务器配置
配置文件位于“world”文件夹中的“serverconfig”文件夹内,文件名为 discordintegration-server.toml。世界文件夹的名称在 server.properties 文件中设置。
如何设置 Discord 机器人并获取机器人令牌
首先,您需要登录 Discord 开发者网站。
点击“New Application”(新建应用程序)并为您的应用程序输入一个名称。
进入“Bot tab”(机器人选项卡)。

点击“Reset Token”(重置令牌)以在配置中获取机器人令牌。该令牌仅显示一次,因此请将其直接复制到配置文件中。
启用特权网关意图(Privileged Gateway Intents)
此步骤为必需。 在“Bot tab”(机器人选项卡)中,向下滚动至“Privileged Gateway Intents”(特权网关意图)并启用:
- Server Members Intent(服务器成员意图)- 用于白名单、链接和管理角色
- Message Content Intent(消息内容意图)- 用于读取 Discord 聊天中的消息和命令
点击“Save Changes”(保存更改)。
“Presence Intent”(在线状态意图)不需要启用。
如果未启用这些意图,机器人将无法连接到 Discord,并且服务器日志会显示带有“Disallowed intents”(不允许的意图)的错误(关闭代码 4014)。
要将机器人添加到服务器,请点击“General Information”(常规信息),并将“Client ID”(客户端 ID)添加到以下链接中:
您必须将 YOUR_BOTS_CLIENT_ID 替换为您机器人的客户端 ID。

打开此链接并将机器人添加到您拥有的某个服务器中。
机器人只能看到您允许的频道。 该链接故意不赋予机器人“View Channel”(查看频道)权限,因此它只能看到所有人(@everyone)可见的频道以及您明确允许的频道。如果某些频道并非对所有人可见,请在配置中设置的每个频道(聊天频道、管理频道、链接管理频道)中允许机器人(或其角色)“View Channel”(查看频道)权限:右键单击该频道 > “Edit Channel”(编辑频道)> “Permissions”(权限)。如果没有此权限,机器人将无法在这些频道中读取或发送消息。
您只能将机器人添加到您自己拥有的服务器中。如果您想将机器人添加到您不拥有的服务器中,则必须在“Bot tab”(机器人选项卡)中勾选“Public Bot”(公共机器人)选项,并由服务器所有者将其添加到其 Discord 服务器中。
如何获取公会 ID(Guild ID)
要获取公会 ID,您需要在 Discord 中进入“User Settings”(用户设置)>“Advanced”(高级),并激活“Developer Mode”(开发者模式)。

接下来,您进入机器人将要运行的服务器。
右键单击该服务器名称或图标,然后点击“Copy Server ID”(复制服务器 ID),并将其粘贴到配置文件中。

如何获取频道 ID
要获取频道 ID,您需要在 Discord 中进入“User Settings”(用户设置)>“Advanced”(高级),并激活“Developer Mode”(开发者模式)。

接下来,您进入机器人将要运行的服务器和频道。
右键单击该频道,然后点击“Copy ID”(复制 ID),并将其粘贴到配置文件中。

如何获取角色 ID
要获取角色 ID,您需要在 Discord 中进入“User Settings”(用户设置)>“Advanced”(高级),并激活“Developer Mode”(开发者模式)。

接下来,您进入“Server Settings”(服务器设置)>“Roles”(角色)。
右键单击该角色,然后点击“Copy Role ID”(复制角色 ID),并将其粘贴到配置文件中。

感谢 Muse31 提供的标志。
您可以在非商业整合包中使用此模组而无需事先询问。
您可以在 CurseForge 和 Modrinth 上找到我的更多模组。

Version 4.X.X
For older versions of the mod, check the wiki.
This Mod connects the Minecraft chat with a discord chat.
The Mod adds Discord command integration for the Mods Dimension Access Manager (CurseForge or Modrinth) and More MobGriefing Options (CurseForge or Modrinth).
This Mod only works on the server side and won't work on the client side.
You need a server to play with friends? You don't know how to set up one? Just rent an already configured server!
Click on the picture above, select a plan (with recommended at least 6 GB),
use my code agent to get 25% off your first month and enjoy playing with your friends!
Important Notes
- When sharing a world of a server, where Discord Integration is installed, remember to remove "discordintegration-server.toml" file in the "serverconfig" folder, to protect your bot token.
- You can regenerate the bot token in the Discord Developers Site on the "Bot tab".
Support

Minecraft versions, for which the mod is not released, are not supported.
You can find a text version here.
Features
Chat
Minecraft > Discord
Everything written in the Minecraft chat is added to the Discord chat by a Discord bot.
Additional death messages, advancements messages are sent to Discord.
The "say"- and the "me"-command has been changed and sent their messages to Discord too.
Server started and server stopped messages can be customized in the config.
Discord > Minecraft
Every message except from bots are sent to the Minecraft chat.
Bot messages can be sent to the Minecraft chat, if it is activated in the config.
The max length of messages transmitted from Discord to Minecraft can be configured to prevent spam. An error message is shown in the Discord chat, if the message is too long.
Messages, which are commands, are also not sent to the Minecraft chat.
There are default commands added by Discord Integration, custom commands can be added in the config. The command prefix can be configured in the config too.
Management
The "management" part of Discord Integration consists of two parts, the management channel and the management role.
In the management channel, all Discord Integration commands can be used. Also, messages about server start, stop and crash, player joined and left are shown. If the whitelist feature is activated, additional messages will be shown, if a Minecraft and Discord account are linked or unlinked and if a Minecraft account is added or removed from the whitelist.
Additionally, the management channel can be used for conversations between the moderators and admins of the Minecraft server, which will not be shown in the Minecraft chat.
With the management role commands can be executed that are marked as management commands.
Whitelist
From the whitelist usable by Discord Integration requires the whitelist to be activated in the server.properties file. It has two mechanisms to secure the whitelist, role and single link management, which are described in the following sections. Linkings from users leaving the Discord server will automatically be removed. If the linkings are out of sync, for example because the Minecraft server was offline or the Discord API had issues, this can be solved by restarting the server, which resyncs the linkings.
The config key "whitelist.use_role" is used to set, if the use role mechanism is active, and the config key "whitelist.use_single_linking_management" is used to set, if the single link management is active.
To create linkings users can use the !link and !unlink commands in the chat channel. Important: The !link and !unlink commands have to be enabled in the config, before they can be used.
Only linking
If both mechanisms are deactivated, the user only has to create a linking to get onto the whitelist.
Role
If the role mechanism is active, the user has to have the role whose ID is set to the config key "whitelist.role_id". The role has to be assigned by a moderator of the Discord server. If the "@everyone" role is used, the user just has to create a liking to get onto the whitelist.
Single Link Management
For the Single Link Management two config values have to be set. The "whitelist.linking_management_channel_id" has to have the channel ID set of the channel in which the "Linking Messages" are shown. The "whitelist.single_linking_management_role_id" is the role ID of the role that is needed to activate or deactivate a linking. The linking can be simply activated or deactivated by clicking the tick or "X" reaction below the message.
On startup, all linking messages in the link management channel are updated, this takes about 1 second per message due to Discord API restrictions.

Role + Single Link Management
The Discord user has to have the role assigned, whose ID is set to the config variable "whitelist.role_id" and the link has to be activated in the link management channel (details in the previous section).
Minecraft Commands
/discord commands - shows the list of available commands configured in the Discord Integration with a help message what they do.
/discord gamerules - shows the values of all Minecraft gamerules.
/discord mods - shows a list of all mods in the server.
/discord link <player> [<discordMemberId>] - creates a linking between a Discord user and a Minecraft player. From the Discord chat only the variate with only the player can be user and in Minecraft only with player and discordMemberId the command is usable (Only of players with op level 3 or higher).
/discord unlink <player> [<discordMemberId>] - deletes a linking between a Discord user and a Minecraft player. From the Discord chat only the variate with only the player can be user and in Minecraft only with player and discordMemberId the command is usable (Only of players with op level 3 or higher).
Default Discord Commands
If you type the following commands into the discord chat, you get information from the Minecraft server.
Custom commands can be added in the config.
Commands for Vanilla Minecraft
!difficulty - shows the difficulty of the server.
!gamerules - shows the gamerules and their values.
!help - shows all commands with its description.
!link <Minecraft player name> - links a Minecraft player with the Discord user using this command.
!mods - shows a list of the mods on the server.
!online - shows how many and which players are on the server.
!seed - shows the seed of the active world.
!time - shows the current day time on the server.
!tps - shows the tps statistic of the server, and it's dimensions.
!unlink <Minecraft player name> - unlinks a Minecraft player from the Discord user using this command.
!dimensions - shows the access states of all dimensions.
!mobgriefing - shows all mobgriefing options of the mobs.
Server Config
The config file can be found in the "serverconfig" folder in the "world" folder and is named "discordintegration-server.toml". The name of the world folder is set for servers in the "server.properties" file.
- bot - General bot configuration
- active - Should the Discord Integration be active? Default: false
- bot_token - Token of your Discord bot. Default: "INSERT BOT TOKEN HERE"
- guild_id - Guild/Server ID of the Discord server, where the Discord Integration should operate.
- discord_presence - Discord Presence configuration
- show_discord_presence - Shall a Discord Presence message be shown? Default: false
- message - Message shown in the Discord Presence (activity is always playing). (Available parameters: %online_player_count% = Online Player Count, %max_player_count% = Max Player Count) Default: "Minecraft with %online_player_count% players"
- chat - Chat channel settings
- enabled - Should the Minecraft and Discord chat be linked? Default: false
- channel_id - Channel ID where the Minecraft and Discord chat will be linked.
- use_raw_message_format_discord_to_minecraft - Use raw message format for Discord to Minecraft messages (examples: )? Default: false
- invalid_raw_message_format_for_discord_to_minecraft_error_message - Error message shown in Discord, if the raw message format is malformed JSON. (Available parameters: %username% = Discord username, %nickname% = Discord nickname, %error_message% = Error message, %new_line% = New line) Default: "%username%%new_line%Error: Invalid JSON format for raw message for Discord to Minecraft message.%new_line%%error_message%"
- message_format_discord_to_minecraft - Message format for Discord to Minecraft messages. (Available parameters: %username% = Discord username, %nickname% = Discord nickname, %message% = Message) Default: "[%username%] %message%"
- message_format_minecraft_to_discord - Message format for Minecraft to Discord messages. (Available parameters: %player% = Player name, %message% = Message) Default: "%player% %message%"
- message_format_minecraft_to_discord_me_message - Message format for Minecraft's /me command to Discord messages. (Available parameters: %player% = Player name, %message% = Message) Default: "%player% %message%"
- max_char_count - How long should Discord messages sent to Minecraft chat be at most? If the value is -1, there is no limit to the length. Default: -1
- max_char_count_error_message - Error message shown in Discord, if the message is too long. (Available parameters: %username% = Discord username, %nickname% = Discord nickname, %max_char_count% = Max message length (value of chat.max_char_count), %actual_message_char_count% = Actual length of the send message, %new_line% = New line) Default: "%username%%new_line%Error: Message too long.%new_line%Messages can only be up to %max_char_count% characters long.%new_line%Your message is %actual_message_char_count% characters long."
- transmit_bot_messages - Should messages of other bots be sent to the Minecraft chat? Default: false
- suppress_server_messages - Suppress messages sent from the Minecraft server (for example, with the say command)? Default: false
- messages - Messages shown on Discord in the chat channel
- server_started - Options for the server start message (enabled: true, message: "Server started")
- server_stopped - Options for the server stop message (enabled: true, message: "Server stopped")
- server_crashed - Options for the server crash message (enabled: true, message: "Server crashed")
- player_joined - Options for the player joined message (enabled: true, message with %player%)
- player_left - Options for the player left message (enabled: true, message with %player%)
- player_died - Options for the player died message (enabled: true, message with %player%, %default_message%)
- tamed_mob_died - Options for the tamed mob died message (enabled: true, message with %tamed_mob%, %default_message%)
- player_got_advancement - Options for the player got advancement message (enabled: true, message with %player%, %advancement_title%, %advancement_description%, %new_line%)
- management - Management channel settings
- enabled - Should a management channel be used? Default: false
- channel_id - Channel ID, where the management channel should be.
- role_id - Role ID, which Discord users need to execute management commands
- messages - Messages shown on Discord in the management channel (server_started, server_stopped, server_crashed, player_joined, player_left, linking_created, linking_removed, whitelist_update_with_forced_message_update_start, whitelist_update_with_forced_message_update_finished, player_whitelist_added, player_whitelist_removed)
- whitelist - Settings for whitelist management in Discord
- enabled - Should the whitelist management in Discord be enabled? Default: false
- use_role - Does the user have to have a specific role to be whitelisted? Default: true
- role_id - Role ID of the Discord role, that a user have to have to be whitelisted.
- use_single_linking_management - Does every linking has to be separately activated, before the Minecraft account is being whitelisted? Default: true
- single_linking_management_role_id - Role ID of the Discord role, that a user have to have to activate or deactivate the linkings. Only needed if whitelist.use_single_linking_management is true
- linking_management_channel_id - Channel ID of the channel, where the activation of the linkings are handled.
- command_settings - Command settings
- command_prefix - Command prefix for Discord commands. Default: "!"
- command_normal_user_permission_level - Permission level for Minecraft commands for users, who don't have the management role. Default: 2
- command_management_user_permission_level - Permission level for Minecraft commands for users, who do have the management role. Default: 4
- other_bots_command_prefixes - Command prefixes of other bots. Messages with these prefixes are not sent to the Minecraft chat.
- messages - Command message settings (only_management_command_hint_message, link_created_result_message, link_already_exists_result_message, link_removed_result_message, link_invalid_discord_member_id_error_message, unknown_command_error_message, invalid_permissions_error_message)
- commands - Command mapping from Discord to Minecraft commands (minecraft_command, discord_command, management_command, use_parameters, description, enabled)
How to set up a Discord bot and get the bot token
First you have to log into the Discord Developers Site.
Press "New Application" and enter a name for your application.
Go to the "Bot tab".

Click onto "Reset Token" to get the bot token for the config. The token is only shown once, so copy it directly into the config.
Enable the Privileged Gateway Intents
This step is required. In the "Bot tab", scroll down to "Privileged Gateway Intents" and enable:
- Server Members Intent - needed for the whitelist, the linkings and the management role
- Message Content Intent - needed to read the messages and commands from the Discord chat
Click "Save Changes".
The "Presence Intent" is not needed.
If the intents are not enabled, the bot can't connect to Discord and the server log shows an error with "Disallowed intents" (close code 4014).
To add the bot to a server click on "General Information" and add the "Client ID" into the following link:
You have to replace YOUR_BOTS_CLIENT_ID by the client ID of your bot.

Open this link and add the bot to one of your server.
The bot can only see the channels that you allow. The link intentionally doesn't give the bot the "View Channel" permission, so it only sees the channels, that everyone (@everyone) can see, and the channels you allow explicitly. Allow the bot (or its role) "View Channel" in every channel set in the config (chat channel, management channel, linking management channel), if the channel isn't visible for everyone: right click on the channel > "Edit Channel" > "Permissions". Without it, the bot can't read or send messages in these channels.
You can only add the bot to your own servers. If you want to add the bot to a server, that you don't own, you have to check the "Public Bot" option in the Bot tab and let the server owner add the bot to his/her Discord server.
How to get the guild ID
To get the guild ID, you have to go in Discord into the "User Settings" > "Advanced" and have to activate the "Developer Mode"

Next, you go to the server in which the bot shall operate.
Make a right click on this server name or icon and click "Copy Server ID" and paste it into the config.

How to get the channel ID
To get the channel ID, you have to go in Discord into the "User Settings" > "Advanced" and have to activate the "Developer Mode"

Next, you go to the server and channel in which the bot shall operate.
Make a right click on the channel and click "Copy ID" and paste it into the config.

How to get the role ID
To get the role ID, you have to go in Discord into the "User Settings" > "Advanced" and have to activate the "Developer Mode"

Next, you go to the server in "Server Settings" > "Roles".
Make a right click on the role and click "Copy Role ID" and paste it into the config.

Thanks for the logo to Muse31.
You can use this mod in non-commercial modpacks without asking.
You can find more mods from me on CurseForge and Modrinth.

评论 0
登录后参与评分
还没有评论,来抢沙发吧