Xujiayao / Discord-MC-Chat

Discord-MC-Chat (DMCC), formerly known as MC-Discord-Chat and MCDiscordChat (MCDC), is a practical and powerful Fabric and Quilt Minecraft <> Discord chat bridge inspired by BRForgers/DisFabric
https://blog.xujiayao.com/posts/4ba0a17a/
MIT License
65 stars 36 forks source link

[Question] How to use custom message? #109

Open jg2002-j opened 1 year ago

jg2002-j commented 1 year ago

Checks

Description

(Sorry if this is duplicate, I wasn't sure if anyone would see the comment I left on the post since it was closed) But I'm not sure how to use the custom message fields in mcdiscordchat.json. I looked at the recommended en_us.json for the existing examples but when I pasted even the exact same messages in the .json file nothing from discord synced over to minecraft chat. I'm a beginner at anything involving coding so is there an easy way to format the incoming chat?

jg2002-j commented 1 year ago

I want to make the chat look similar to this: image

Xujiayao commented 1 year ago

(Sorry if this is duplicate, I wasn't sure if anyone would see the comment I left on the post since it was closed)

Yes, I am notified.

I looked at the recommended en_us.json for the existing examples but when I pasted even the exact same messages in the .json file nothing from discord synced over to minecraft chat.

Do you mean the messages are still the same as before? That is because the JSON files I sent in that issue are the default messages.

I want to make the chat look similar to this: image

Here is a sample config I write for that screenshot:

Useful site: https://www.minecraftjson.com/

mcdiscordchat.json

"customMessage": {
  "unformattedResponseMessage": "",
  "unformattedChatMessage": "> %name%: %message%",
  "unformattedOtherMessage": "",
  "unformattedCommandNotice": "",
  "formattedResponseMessage": "",
  "formattedChatMessage": "[{\"text\":\"> \",\"bold\":false,\"color\":\"blue\"},{\"text\":\"%name%\",\"bold\":false,\"color\":\"aqua\"},{\"text\":\": %message%\",\"bold\":false,\"color\":\"white\"}]",
  "formattedOtherMessage": "",
  "formattedCommandNotice": "",
  "serverStarted": "",
  "serverStopped": "",
  "joinServer": "",
  "leftServer": "",
  "deathMessage": "",
  "advancementTask": "",
  "advancementChallenge": "",
  "advancementGoal": "",
  "highMspt": "",
  "offlineChannelTopic": "",
  "onlineChannelTopic": "",
  "onlineChannelTopicForMultiServer": ""
},
jg2002-j commented 1 year ago

thank you! i'll test that out - is there also a known incompatability with StyledChat mod?

jg2002-j commented 1 year ago

sorry, i guess that was an issue with me incorrectly using the custom messages before - it all works fine now. thank you for the help!

last question: what other placeholders can you use in the custom messages?

jg2002-j commented 1 year ago

also the tellraw generator doesn't generate a string in the same format?

i get /tellraw @p ["",{"text":"> ","bold":true,"color":"blue"},{"text":"%name% ","color":"#7289DA"},{"text":"► ","color":"gray"},{"text":"%message%","color":"gray"}] which doesn't work in the plugin

Xujiayao commented 1 year ago

thank you! i'll test that out - is there also a known incompatability with StyledChat mod

Not sure. I personally do not use StyledChat and Placeholder API, and there is no plan to use them. However, MCDC should be compatible with them since they only modify in-game chat.

what other placeholders can you use in the custom messages?

%server% %name% (username or server nickname, depends on config option) %roleName% %roleColor% %message%

also the tellraw generator doesn't generate a string in the same format? ... which doesn't work in the plugin

/tellraw @p ["",{"text":"> ","bold":true,"color":"blue"},{"text":"%name% ","color":"#7289DA"},{"text":"► ","color":"gray"},{"text":"%message%","color":"gray"}]

should be modified to:

formattedChatMessage: [{"text":"> ","bold":true,"color":"blue"},{"text":"%name% ","color":"#7289DA"},{"text":"► ","color":"gray"},{"text":"%message%","color":"gray"}]

unformattedChatMessage: > %name% ► %message%

jg2002-j commented 1 year ago

thank you!