Fix message for message delete event

This commit is contained in:
Xujiayao 2026-03-18 13:06:55 +08:00
parent 31747ed4f4
commit 79615a17af
5 changed files with 9 additions and 3 deletions

View file

@ -7,6 +7,7 @@ import com.xujiayao.discord_mc_chat.network.packets.events.DiscordEventPacket;
import com.xujiayao.discord_mc_chat.network.packets.events.TextSegment;
import com.xujiayao.discord_mc_chat.utils.LogFileUtils;
import com.xujiayao.discord_mc_chat.utils.config.ConfigManager;
import com.xujiayao.discord_mc_chat.utils.i18n.I18nManager;
import net.dv8tion.jda.api.entities.Member;
import net.dv8tion.jda.api.entities.Message;
import net.dv8tion.jda.api.entities.User;
@ -559,7 +560,7 @@ public class DiscordEventHandler extends ListenerAdapter {
CachedMessage cached = messageCache.remove(event.getMessageId());
if (cached == null) {
// No cached info - send a generic delete notification
List<TextSegment> segments = DiscordMessageParser.buildDeleteSegments("Unknown", "white");
List<TextSegment> segments = DiscordMessageParser.buildDeleteSegments(I18nManager.getDmccTranslation("discord.message_parser.unknown_user"), "white");
DiscordEventPacket packet = new DiscordEventPacket(DiscordEventPacket.EventType.DELETE, segments);
logDiscordEventForConsole(packet);
NetworkManager.broadcastToClients(packet);

View file

@ -109,10 +109,13 @@ discord_to_minecraft:
- text: "[Discord] "
bold: true
color: "blue"
- text: "A message sent by "
bold: false
color: "gray"
- text: "{effective_name} "
bold: false
color: "{role_color}"
- text: "deleted this message!"
- text: "has been deleted!"
bold: false
color: "gray"

View file

@ -112,7 +112,7 @@ discord_to_minecraft:
- text: "{effective_name} "
bold: false
color: "{role_color}"
- text: "删除了此消息"
- text: "发送的消息已被删除!"
bold: false
color: "gray"

View file

@ -183,6 +183,7 @@ discord:
reply_failed_detail: "This is expected behavior for reload/shutdown commands."
message_parser:
click_to_open_link: "Click to open link"
unknown_user: "Unknown User"
relative:
past: "{} {} ago"
future: "in {} {}"

View file

@ -183,6 +183,7 @@ discord:
reply_failed_detail: "对于 reload/shutdown 命令,这是预期的行为。"
message_parser:
click_to_open_link: "点击打开链接"
unknown_user: "未知用户"
relative:
past: "{}{}前"
future: "{}{}后"