Skip to content

Commit 5bbcc5a

Browse files
committed
Fix Missing Tooltips (Fixes #16)
1 parent f83d6c9 commit 5bbcc5a

File tree

1 file changed

+32
-25
lines changed

1 file changed

+32
-25
lines changed

converters/chatchat/deluxechat.ts

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -48,32 +48,39 @@ const ChatChatDeluxeChatConverter = new Converter<
4848
(segment) => {
4949
let formattedSegment = dcFormat[segment];
5050

51-
// Add in the click command if it exists
52-
let segmentClick =
53-
dcFormat[(segment + "_click_command") as keyof DeluxeChatFormat];
54-
if (segmentClick && segmentClick !== "") {
55-
formattedSegment =
56-
"<click:run_command:'" +
57-
segmentClick +
58-
"'>" +
59-
formattedSegment +
60-
"</click>";
61-
}
51+
if (formattedSegment) {
6252

63-
// Add in the hover if it exists
64-
let segmentHover: string[] = (<string[]>(
65-
dcFormat[(segment + "_tooltip") as keyof DeluxeChatFormat]
66-
)).filter((s) => s && s !== "");
67-
if (segmentHover && segmentHover.length > 0) {
68-
formattedSegment =
69-
"<hover:show_text:'" +
70-
segmentHover.join("<newline>") +
71-
"'>" +
72-
formattedSegment +
73-
"</hover>";
74-
}
75-
if (formattedSegment !== "") {
76-
ccFormat.parts.push(MiniMessage(formattedSegment));
53+
// Add in the click command if it exists
54+
if (dcFormat[(segment + "_click_command") as keyof DeluxeChatFormat]) {
55+
let segmentClick =
56+
dcFormat[(segment + "_click_command") as keyof DeluxeChatFormat];
57+
if (segmentClick && segmentClick !== "") {
58+
formattedSegment =
59+
"<click:run_command:'" +
60+
segmentClick +
61+
"'>" +
62+
formattedSegment +
63+
"</click>";
64+
}
65+
}
66+
67+
// Add in the hover if it exists
68+
if (dcFormat[(segment + "_tooltip") as keyof DeluxeChatFormat]) {
69+
let segmentHover: string[] = (<string[]>(
70+
dcFormat[(segment + "_tooltip") as keyof DeluxeChatFormat]
71+
)).filter((s) => s && s !== "");
72+
if (segmentHover && segmentHover.length > 0) {
73+
formattedSegment =
74+
"<hover:show_text:'" +
75+
segmentHover.join("<newline>") +
76+
"'>" +
77+
formattedSegment +
78+
"</hover>";
79+
}
80+
}
81+
if (formattedSegment !== "") {
82+
ccFormat.parts.push(MiniMessage(formattedSegment));
83+
}
7784
}
7885
}
7986
);

0 commit comments

Comments
 (0)