mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
Add Discord RPC setup tutorial, Discord Bridge AllowOtherBotMessages config, and enhance integration tests
Co-authored-by: milutinke <441903+milutinke@users.noreply.github.com> Agent-Logs-Url: https://github.com/MCCTeam/Minecraft-Console-Client/sessions/a41f3e83-c88d-4c57-971b-54c380891556
This commit is contained in:
parent
02686de79c
commit
5a9786cb0b
5 changed files with 164 additions and 4 deletions
|
|
@ -58,6 +58,9 @@ namespace MinecraftClient.ChatBots
|
|||
[TomlInlineComment("$ChatBot.DiscordBridge.MessageSendTimeout$")]
|
||||
public int Message_Send_Timeout = 3;
|
||||
|
||||
[TomlInlineComment("$ChatBot.DiscordBridge.AllowOtherBotMessages$")]
|
||||
public bool Allow_Other_Bot_Messages = false;
|
||||
|
||||
[TomlPrecedingComment("$ChatBot.DiscordBridge.Formats$")]
|
||||
public string PrivateMessageFormat = "**[Private Message]** {username}: {message}";
|
||||
public string PublicMessageFormat = "{username}: {message}";
|
||||
|
|
@ -372,7 +375,8 @@ namespace MinecraftClient.ChatBots
|
|||
if (e.Channel.Id != Config.ChannelId)
|
||||
return;
|
||||
|
||||
if (!Config.OwnersIds.Contains(e.Author.Id))
|
||||
// Always ignore own messages to prevent loops
|
||||
if (e.Author.Id == discordBotClient.CurrentUser.Id)
|
||||
return;
|
||||
|
||||
string message = e.Message.Content.Trim();
|
||||
|
|
@ -380,6 +384,17 @@ namespace MinecraftClient.ChatBots
|
|||
if (string.IsNullOrEmpty(message) || string.IsNullOrWhiteSpace(message))
|
||||
return;
|
||||
|
||||
// Relay messages from other bots when configured, but never process commands from them
|
||||
if (e.Author.IsBot)
|
||||
{
|
||||
if (Config.Allow_Other_Bot_Messages && bridgeDirection != BridgeDirection.Discord)
|
||||
SendText(message);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Config.OwnersIds.Contains(e.Author.Id))
|
||||
return;
|
||||
|
||||
if (bridgeDirection == BridgeDirection.Discord)
|
||||
{
|
||||
if (!message.StartsWith(".dscbridge"))
|
||||
|
|
|
|||
|
|
@ -772,7 +772,16 @@ namespace MinecraftClient {
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Automatically farms crops for you (plants, breaks and bonemeals them).
|
||||
/// Looks up a localized string similar to When enabled, messages from other Discord bots in the channel will be relayed to Minecraft chat..
|
||||
/// </summary>
|
||||
internal static string ChatBot_DiscordBridge_AllowOtherBotMessages {
|
||||
get {
|
||||
return ResourceManager.GetString("ChatBot.DiscordBridge.AllowOtherBotMessages", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Automatically farms cropsfor you (plants, breaks and bonemeals them).
|
||||
///Crop types available: Beetroot, Carrot, Melon, Netherwart, Pumpkin, Potato, Wheat.
|
||||
///Usage: "/farmer start" command and "/farmer stop" command.
|
||||
///NOTE: This a newly added bot, it is not perfect and was only tested in 1.19.2, there are some minor issues like not being able to bonemeal carrots/potatoes sometimes.
|
||||
|
|
@ -899,7 +908,9 @@ namespace MinecraftClient {
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Show a Discord Rich Presence status with your current Minecraft session info..
|
||||
/// Looks up a localized string similar to Show a Discord Rich Presence status with your current Minecraft session info.
|
||||
///Setup:
|
||||
///1. Go to https://discord.com/developers/applications and log in with your Discord account. [rest of string was truncated]";.
|
||||
/// </summary>
|
||||
internal static string ChatBot_DiscordRpc {
|
||||
get {
|
||||
|
|
|
|||
|
|
@ -390,6 +390,9 @@ For Discord message formatting, check the following: https://mccteam.github.io/r
|
|||
<data name="ChatBot.DiscordBridge.Token" xml:space="preserve">
|
||||
<value>Your Discord Bot token.</value>
|
||||
</data>
|
||||
<data name="ChatBot.DiscordBridge.AllowOtherBotMessages" xml:space="preserve">
|
||||
<value>When enabled, messages from other Discord bots in the channel will be relayed to Minecraft chat. The bridge always ignores its own messages to prevent loops.</value>
|
||||
</data>
|
||||
<data name="ChatBot.Farmer" xml:space="preserve">
|
||||
<value>Automatically farms crops for you (plants, breaks and bonemeals them).
|
||||
Crop types available: Beetroot, Carrot, Melon, Netherwart, Pumpkin, Potato, Wheat.
|
||||
|
|
@ -829,7 +832,13 @@ If the connection to the Minecraft game server is blocked by the firewall, set E
|
|||
<value>A Chat Bot that collects items on the ground</value>
|
||||
</data>
|
||||
<data name="ChatBot.DiscordRpc" xml:space="preserve">
|
||||
<value>Show a Discord Rich Presence status with your current Minecraft session info.\nRequires a Discord Application ID from https://discord.com/developers/applications\nYou can customize what is shown using placeholders: {server_host}, {server_port}, {username}, {health}, {max_health}, {food}, {dimension}, {gamemode}, {x}, {y}, {z}, {player_count}, {protocol}</value>
|
||||
<value>Show a Discord Rich Presence status with your current Minecraft session info.
|
||||
Setup:
|
||||
1. Go to https://discord.com/developers/applications and log in with your Discord account.
|
||||
2. Click "New Application", give it a name (e.g. "MCC") and confirm.
|
||||
3. On the application page, copy the "Application ID" and paste it in the "ApplicationId" field below.
|
||||
4. (Optional) Go to "Rich Presence" -> "Art Assets" to upload custom images for LargeImageKey/SmallImageKey.
|
||||
Note: This does NOT require a Bot Token, only an Application ID. Discord must be running on the same machine as MCC.</value>
|
||||
</data>
|
||||
<data name="ChatBot.DiscordRpc.ApplicationId" xml:space="preserve">
|
||||
<value>Your Discord Application ID. Create one at https://discord.com/developers/applications</value>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue