discord-html-transcripts-fix 1.1.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +86 -78
- package/dist/downloader/images.js +71 -85
- package/dist/generator/index.js +231 -43
- package/dist/generator/renderers/attachment.js +27 -36
- package/dist/generator/renderers/components/Container.js +42 -14
- package/dist/generator/renderers/components/Media Gallery.js +24 -18
- package/dist/generator/renderers/components/Spacing.js +18 -6
- package/dist/generator/renderers/components/section/Section.js +13 -3
- package/dist/generator/renderers/components/section/SectionAccessory.js +8 -7
- package/dist/generator/renderers/components/section/SectionContent.js +9 -4
- package/dist/generator/renderers/components.js +7 -2
- package/dist/generator/renderers/content.js +254 -76
- package/dist/generator/renderers/embed.js +79 -34
- package/dist/generator/renderers/message.js +358 -52
- package/dist/generator/renderers/reply.js +59 -40
- package/dist/generator/renderers/systemMessage.js +182 -68
- package/dist/generator/transcript.js +42 -56
- package/dist/index.js +81 -84
- package/dist/static/client.js +675 -202
- package/dist/types.js +1 -0
- package/dist/utils/buildProfiles.js +70 -60
- package/dist/utils/utils.js +73 -26
- package/package.json +1 -1
|
@@ -6,94 +6,198 @@ exports.JoinMessage = JoinMessage;
|
|
|
6
6
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
7
|
const discord_js_1 = require("discord.js");
|
|
8
8
|
const utils_1 = require("../../utils/utils");
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
|
|
10
|
+
function t(context, key, fallback) {
|
|
11
|
+
const dict = context?.i18n?.[context?.lang] || context?.i18n?.en || {};
|
|
12
|
+
return dict[key] || fallback || key;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
async function SystemMessage({ message, context }) {
|
|
16
|
+
const author = message.author;
|
|
17
|
+
const authorName = author?.displayName ?? author?.username ?? 'Unknown';
|
|
18
|
+
const color = message.member?.roles?.color?.hexColor;
|
|
19
|
+
const ctx = context || {};
|
|
20
|
+
|
|
11
21
|
switch (message.type) {
|
|
12
22
|
case discord_js_1.MessageType.RecipientAdd:
|
|
13
23
|
case discord_js_1.MessageType.UserJoin:
|
|
14
|
-
return ((0, jsx_runtime_1.jsx)("discord-system-message", { id: `m-${message.id}`, type: "join", children: (0, jsx_runtime_1.jsx)(JoinMessage, { member: message.member, fallbackUser: message.
|
|
15
|
-
|
|
16
|
-
|
|
24
|
+
return ((0, jsx_runtime_1.jsx)("discord-system-message", { id: `m-${message.id}`, type: "join", children: (0, jsx_runtime_1.jsx)(JoinMessage, { member: message.member, fallbackUser: author, seed: message.id, context: ctx }) }, message.id));
|
|
25
|
+
|
|
26
|
+
case discord_js_1.MessageType.ChannelPinnedMessage: {
|
|
27
|
+
const refId = message.reference?.messageId;
|
|
28
|
+
return ((0, jsx_runtime_1.jsxs)("discord-system-message", { id: `m-${message.id}`, type: "pin", children: [
|
|
29
|
+
(0, jsx_runtime_1.jsx)(Highlight, { color, children: authorName }),
|
|
30
|
+
' ',
|
|
31
|
+
(0, jsx_runtime_1.jsx)("span", { "data-i18n": "pinned", children: t(ctx, 'pinned', 'pinned a message to this channel.') }),
|
|
32
|
+
refId ? (0, jsx_runtime_1.jsx)("i", { "data-goto": refId, className: "dht-jump", role: "button", tabIndex: 0, children: " (jump)" }) : null,
|
|
33
|
+
] }, message.id));
|
|
34
|
+
}
|
|
35
|
+
|
|
17
36
|
case discord_js_1.MessageType.GuildBoost:
|
|
18
37
|
case discord_js_1.MessageType.GuildBoostTier1:
|
|
19
38
|
case discord_js_1.MessageType.GuildBoostTier2:
|
|
20
39
|
case discord_js_1.MessageType.GuildBoostTier3:
|
|
21
|
-
return ((0, jsx_runtime_1.jsxs)("discord-system-message", { id: `m-${message.id}`, type: "boost", children: [
|
|
40
|
+
return ((0, jsx_runtime_1.jsxs)("discord-system-message", { id: `m-${message.id}`, type: "boost", children: [
|
|
41
|
+
(0, jsx_runtime_1.jsx)(Highlight, { color, children: authorName }),
|
|
42
|
+
' ',
|
|
43
|
+
(0, jsx_runtime_1.jsx)("span", { "data-i18n": "boosted", children: t(ctx, 'boosted', 'boosted the server!') }),
|
|
44
|
+
] }, message.id));
|
|
45
|
+
|
|
22
46
|
case discord_js_1.MessageType.ThreadStarterMessage:
|
|
23
|
-
return ((0, jsx_runtime_1.jsxs)("discord-system-message", { id: `ms-${message.id}`, type: "thread", children: [(0, jsx_runtime_1.jsx)(Highlight, { color: (_j = (_h = message.member) === null || _h === void 0 ? void 0 : _h.roles.color) === null || _j === void 0 ? void 0 : _j.hexColor, children: (_k = message.author.displayName) !== null && _k !== void 0 ? _k : message.author.username }), ' ', "started a thread: ", (0, jsx_runtime_1.jsx)("i", { "data-goto": (_l = message.reference) === null || _l === void 0 ? void 0 : _l.messageId, children: message.content })] }, message.id));
|
|
24
|
-
case discord_js_1.MessageType.ChannelNameChange: {
|
|
25
|
-
const authorName = message.author.displayName || message.author.username;
|
|
26
|
-
const color = message.member?.roles?.color?.hexColor;
|
|
27
|
-
return ((0, jsx_runtime_1.jsxs)("discord-system-message", { id: `m-${message.id}`, type: "edit", children: [(0, jsx_runtime_1.jsx)(Highlight, { color, children: authorName }), ' ', 'changed the channel name: ', (0, jsx_runtime_1.jsx)("strong", { children: message.content })] }, message.id));
|
|
28
|
-
}
|
|
29
|
-
case discord_js_1.MessageType.ChannelIconChange: {
|
|
30
|
-
const authorName = message.author.displayName || message.author.username;
|
|
31
|
-
const color = message.member?.roles?.color?.hexColor;
|
|
32
|
-
return ((0, jsx_runtime_1.jsxs)("discord-system-message", { id: `m-${message.id}`, type: "edit", children: [(0, jsx_runtime_1.jsx)(Highlight, { color, children: authorName }), ' ', 'changed the channel icon.'] }, message.id));
|
|
33
|
-
}
|
|
34
47
|
case discord_js_1.MessageType.ThreadCreated: {
|
|
35
|
-
const
|
|
36
|
-
const
|
|
37
|
-
return ((0, jsx_runtime_1.jsxs)("discord-system-message", { id: `m-${message.id}`, type: "thread", children: [
|
|
48
|
+
const refId = message.reference?.messageId;
|
|
49
|
+
const label = message.content || 'New thread';
|
|
50
|
+
return ((0, jsx_runtime_1.jsxs)("discord-system-message", { id: `m-${message.id}`, type: "thread", children: [
|
|
51
|
+
(0, jsx_runtime_1.jsx)(Highlight, { color, children: authorName }),
|
|
52
|
+
' ',
|
|
53
|
+
(0, jsx_runtime_1.jsx)("span", { "data-i18n": "threadStarted", children: t(ctx, 'threadStarted', 'started a thread:') }),
|
|
54
|
+
' ',
|
|
55
|
+
refId
|
|
56
|
+
? (0, jsx_runtime_1.jsx)("i", { "data-goto": refId, className: "dht-jump", role: "button", tabIndex: 0, children: label })
|
|
57
|
+
: (0, jsx_runtime_1.jsx)("i", { children: label }),
|
|
58
|
+
] }, message.id));
|
|
38
59
|
}
|
|
60
|
+
|
|
61
|
+
case discord_js_1.MessageType.ChannelNameChange:
|
|
62
|
+
return ((0, jsx_runtime_1.jsxs)("discord-system-message", { id: `m-${message.id}`, type: "edit", children: [
|
|
63
|
+
(0, jsx_runtime_1.jsx)(Highlight, { color, children: authorName }),
|
|
64
|
+
' ',
|
|
65
|
+
(0, jsx_runtime_1.jsx)("span", { "data-i18n": "changedChannelName", children: t(ctx, 'changedChannelName', 'changed the channel name:') }),
|
|
66
|
+
' ',
|
|
67
|
+
(0, jsx_runtime_1.jsx)("strong", { children: message.content }),
|
|
68
|
+
] }, message.id));
|
|
69
|
+
|
|
70
|
+
case discord_js_1.MessageType.ChannelIconChange:
|
|
71
|
+
return ((0, jsx_runtime_1.jsxs)("discord-system-message", { id: `m-${message.id}`, type: "edit", children: [
|
|
72
|
+
(0, jsx_runtime_1.jsx)(Highlight, { color, children: authorName }),
|
|
73
|
+
' ',
|
|
74
|
+
(0, jsx_runtime_1.jsx)("span", { "data-i18n": "changedChannelIcon", children: t(ctx, 'changedChannelIcon', 'changed the channel icon.') }),
|
|
75
|
+
] }, message.id));
|
|
76
|
+
|
|
39
77
|
case discord_js_1.MessageType.ChatInputCommand:
|
|
40
78
|
case discord_js_1.MessageType.ContextMenuCommand: {
|
|
41
|
-
const authorName = message.author.displayName || message.author.username;
|
|
42
|
-
const color = message.member?.roles?.color?.hexColor;
|
|
43
79
|
const cmd = message.interaction?.commandName ? '/' + message.interaction.commandName : 'a command';
|
|
44
|
-
return ((0, jsx_runtime_1.jsxs)("discord-system-message", { id: `m-${message.id}`, type: "call", children: [
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
80
|
+
return ((0, jsx_runtime_1.jsxs)("discord-system-message", { id: `m-${message.id}`, type: "call", children: [
|
|
81
|
+
(0, jsx_runtime_1.jsx)(Highlight, { color, children: authorName }),
|
|
82
|
+
' ',
|
|
83
|
+
(0, jsx_runtime_1.jsx)("span", { "data-i18n": "usedCommand", children: t(ctx, 'usedCommand', 'used') }),
|
|
84
|
+
' ',
|
|
85
|
+
(0, jsx_runtime_1.jsx)("strong", { children: cmd }),
|
|
86
|
+
] }, message.id));
|
|
50
87
|
}
|
|
88
|
+
|
|
89
|
+
case discord_js_1.MessageType.Call:
|
|
90
|
+
return ((0, jsx_runtime_1.jsxs)("discord-system-message", { id: `m-${message.id}`, type: "call", children: [
|
|
91
|
+
(0, jsx_runtime_1.jsx)(Highlight, { color, children: authorName }),
|
|
92
|
+
' ',
|
|
93
|
+
(0, jsx_runtime_1.jsx)("span", { "data-i18n": "startedCall", children: t(ctx, 'startedCall', 'started a call.') }),
|
|
94
|
+
] }, message.id));
|
|
95
|
+
|
|
51
96
|
case discord_js_1.MessageType.ChannelFollowAdd: {
|
|
52
|
-
const
|
|
53
|
-
const
|
|
54
|
-
return ((0, jsx_runtime_1.jsxs)("discord-system-message", { id: `m-${message.id}`, type: "edit", children: [
|
|
97
|
+
const followText = t(ctx, 'addedFollow', 'added {target} to follow this channel.');
|
|
98
|
+
const parts = followText.split('{target}');
|
|
99
|
+
return ((0, jsx_runtime_1.jsxs)("discord-system-message", { id: `m-${message.id}`, type: "edit", children: [
|
|
100
|
+
(0, jsx_runtime_1.jsx)(Highlight, { color, children: authorName }),
|
|
101
|
+
' ',
|
|
102
|
+
parts[0],
|
|
103
|
+
(0, jsx_runtime_1.jsxs)("span", { className: "dht-mention dht-mention--channel", children: ['#', message.content || 'channel'] }),
|
|
104
|
+
parts[1] || '',
|
|
105
|
+
] }, message.id));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
case discord_js_1.MessageType.RecipientRemove:
|
|
109
|
+
return ((0, jsx_runtime_1.jsxs)("discord-system-message", { id: `m-${message.id}`, type: "leave", children: [
|
|
110
|
+
(0, jsx_runtime_1.jsx)(Highlight, { color, children: authorName }),
|
|
111
|
+
' ',
|
|
112
|
+
(0, jsx_runtime_1.jsx)("span", { "data-i18n": "left", children: t(ctx, 'left', 'left.') }),
|
|
113
|
+
] }, message.id));
|
|
114
|
+
|
|
115
|
+
case discord_js_1.MessageType.AutoModerationAction: {
|
|
116
|
+
// Discord packs detail into the first embed: rule_name, matched_keyword, action_type, channel_id
|
|
117
|
+
const e = message.embeds?.[0];
|
|
118
|
+
const fields = Array.isArray(e?.fields) ? e.fields : [];
|
|
119
|
+
const ruleName = fields.find((f) => /rule_name|rule name/i.test(f.name))?.value || e?.title || '';
|
|
120
|
+
const matchedKeyword = fields.find((f) => /matched_keyword|keyword/i.test(f.name))?.value || '';
|
|
121
|
+
const action = fields.find((f) => /action_type|action/i.test(f.name))?.value || '';
|
|
122
|
+
const blocked = e?.description || '';
|
|
123
|
+
const channelId = fields.find((f) => /channel/i.test(f.name))?.value;
|
|
124
|
+
return ((0, jsx_runtime_1.jsxs)("discord-system-message", { id: `m-${message.id}`, type: "boost", children: [
|
|
125
|
+
(0, jsx_runtime_1.jsx)("span", { "data-i18n": "autoModBlocked", children: t(ctx, 'autoModBlocked', 'AutoMod blocked a message.') }),
|
|
126
|
+
ruleName && (0, jsx_runtime_1.jsxs)("span", { className: "dht-automod-rule", children: [' · Rule: ', (0, jsx_runtime_1.jsx)("strong", { children: ruleName })] }),
|
|
127
|
+
action && (0, jsx_runtime_1.jsxs)("span", { className: "dht-automod-rule", children: [' · Action: ', action] }),
|
|
128
|
+
matchedKeyword && (0, jsx_runtime_1.jsxs)("span", { className: "dht-automod-rule", children: [' · Matched: ', (0, jsx_runtime_1.jsx)("code", { children: matchedKeyword })] }),
|
|
129
|
+
blocked && (0, jsx_runtime_1.jsx)("blockquote", { className: "dht-automod-content", children: blocked }),
|
|
130
|
+
channelId && (0, jsx_runtime_1.jsxs)("span", { className: "dht-automod-rule", children: [' · In <#', channelId, '>'] }),
|
|
131
|
+
] }, message.id));
|
|
55
132
|
}
|
|
56
|
-
case discord_js_1.MessageType.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
133
|
+
case discord_js_1.MessageType.StageStart:
|
|
134
|
+
return ((0, jsx_runtime_1.jsxs)("discord-system-message", { id: `m-${message.id}`, type: "call", children: [
|
|
135
|
+
(0, jsx_runtime_1.jsx)(Highlight, { color, children: authorName }),
|
|
136
|
+
' started a stage: ',
|
|
137
|
+
(0, jsx_runtime_1.jsx)("strong", { children: message.content || '' })
|
|
138
|
+
] }, message.id));
|
|
139
|
+
case discord_js_1.MessageType.StageEnd:
|
|
140
|
+
return ((0, jsx_runtime_1.jsxs)("discord-system-message", { id: `m-${message.id}`, type: "leave", children: [
|
|
141
|
+
(0, jsx_runtime_1.jsx)(Highlight, { color, children: authorName }),
|
|
142
|
+
' ended the stage.'
|
|
143
|
+
] }, message.id));
|
|
144
|
+
case discord_js_1.MessageType.StageSpeaker:
|
|
145
|
+
return ((0, jsx_runtime_1.jsxs)("discord-system-message", { id: `m-${message.id}`, type: "call", children: [
|
|
146
|
+
(0, jsx_runtime_1.jsx)(Highlight, { color, children: authorName }),
|
|
147
|
+
' is now a speaker.'
|
|
148
|
+
] }, message.id));
|
|
149
|
+
case discord_js_1.MessageType.StageRaiseHand:
|
|
150
|
+
return ((0, jsx_runtime_1.jsxs)("discord-system-message", { id: `m-${message.id}`, type: "call", children: [
|
|
151
|
+
(0, jsx_runtime_1.jsx)(Highlight, { color, children: authorName }),
|
|
152
|
+
' requested to speak.'
|
|
153
|
+
] }, message.id));
|
|
154
|
+
case discord_js_1.MessageType.StageTopic:
|
|
155
|
+
return ((0, jsx_runtime_1.jsxs)("discord-system-message", { id: `m-${message.id}`, type: "edit", children: [
|
|
156
|
+
(0, jsx_runtime_1.jsx)(Highlight, { color, children: authorName }),
|
|
157
|
+
' changed the stage topic: ',
|
|
158
|
+
(0, jsx_runtime_1.jsx)("strong", { children: message.content || '' })
|
|
159
|
+
] }, message.id));
|
|
160
|
+
case discord_js_1.MessageType.GuildApplicationPremiumSubscription:
|
|
161
|
+
return ((0, jsx_runtime_1.jsxs)("discord-system-message", { id: `m-${message.id}`, type: "boost", children: [
|
|
162
|
+
(0, jsx_runtime_1.jsx)(Highlight, { color, children: authorName }),
|
|
163
|
+
' subscribed ',
|
|
164
|
+
(0, jsx_runtime_1.jsx)("strong", { children: message.applicationId ? `app ${message.applicationId}` : 'an app' }),
|
|
165
|
+
' to this server.'
|
|
166
|
+
] }, message.id));
|
|
167
|
+
|
|
168
|
+
case discord_js_1.MessageType.RoleSubscriptionPurchase: {
|
|
169
|
+
const roleName = message.roleSubscriptionData?.tierName || message.content || 'a role';
|
|
170
|
+
return ((0, jsx_runtime_1.jsxs)("discord-system-message", { id: `m-${message.id}`, type: "boost", children: [
|
|
171
|
+
(0, jsx_runtime_1.jsx)(Highlight, { color, children: authorName }),
|
|
172
|
+
' ',
|
|
173
|
+
t(ctx, 'roleSubPurchased', 'subscribed to {role}!').replace('{role}', roleName),
|
|
174
|
+
] }, message.id));
|
|
60
175
|
}
|
|
61
|
-
|
|
62
|
-
return ((0, jsx_runtime_1.jsx)("discord-system-message", { id: `m-${message.id}`, type: "boost", children: 'AutoMod blocked a message.' }, message.id));
|
|
176
|
+
|
|
63
177
|
case discord_js_1.MessageType.GuildIncidentReportRaid:
|
|
64
178
|
case discord_js_1.MessageType.GuildIncidentReportFalseAlarm:
|
|
65
179
|
case discord_js_1.MessageType.GuildIncidentAlertModeEnabled:
|
|
66
180
|
case discord_js_1.MessageType.GuildIncidentAlertModeDisabled:
|
|
67
|
-
return ((0, jsx_runtime_1.jsx)("discord-system-message", { id: `m-${message.id}`, type: "boost", children: 'Server safety alert.' }, message.id));
|
|
181
|
+
return ((0, jsx_runtime_1.jsx)("discord-system-message", { id: `m-${message.id}`, type: "boost", children: (0, jsx_runtime_1.jsx)("span", { "data-i18n": "serverAlert", children: t(ctx, 'serverAlert', 'Server safety alert.') }) }, message.id));
|
|
182
|
+
|
|
68
183
|
case discord_js_1.MessageType.PollResult:
|
|
69
|
-
return ((0, jsx_runtime_1.jsx)("discord-system-message", { id: `m-${message.id}`, type: "edit", children: 'A poll ended.' }, message.id));
|
|
70
|
-
|
|
184
|
+
return ((0, jsx_runtime_1.jsx)("discord-system-message", { id: `m-${message.id}`, type: "edit", children: (0, jsx_runtime_1.jsx)("span", { "data-i18n": "pollEnded", children: t(ctx, 'pollEnded', 'A poll ended.') }) }, message.id));
|
|
185
|
+
|
|
186
|
+
// These render through the normal pipeline
|
|
71
187
|
case discord_js_1.MessageType.Default:
|
|
72
188
|
case discord_js_1.MessageType.Reply:
|
|
73
189
|
return undefined;
|
|
74
|
-
|
|
75
|
-
case discord_js_1.MessageType.GuildDiscoveryDisqualified:
|
|
76
|
-
case discord_js_1.MessageType.GuildDiscoveryRequalified:
|
|
77
|
-
case discord_js_1.MessageType.GuildDiscoveryGracePeriodInitialWarning:
|
|
78
|
-
case discord_js_1.MessageType.GuildDiscoveryGracePeriodFinalWarning:
|
|
79
|
-
case discord_js_1.MessageType.GuildInviteReminder:
|
|
80
|
-
case discord_js_1.MessageType.RoleSubscriptionPurchase:
|
|
81
|
-
case discord_js_1.MessageType.InteractionPremiumUpsell:
|
|
82
|
-
case discord_js_1.MessageType.StageStart:
|
|
83
|
-
case discord_js_1.MessageType.StageEnd:
|
|
84
|
-
case discord_js_1.MessageType.StageSpeaker:
|
|
85
|
-
case discord_js_1.MessageType.StageRaiseHand:
|
|
86
|
-
case discord_js_1.MessageType.StageTopic:
|
|
87
|
-
case discord_js_1.MessageType.GuildApplicationPremiumSubscription:
|
|
88
|
-
case discord_js_1.MessageType.PurchaseNotification:
|
|
89
|
-
return undefined;
|
|
190
|
+
|
|
90
191
|
default:
|
|
91
192
|
return undefined;
|
|
92
193
|
}
|
|
93
194
|
}
|
|
195
|
+
|
|
94
196
|
function Highlight({ children, color }) {
|
|
95
|
-
|
|
197
|
+
const safe = typeof color === 'string' && /^#[0-9a-fA-F]{3,8}$/.test(color) ? color : 'white';
|
|
198
|
+
return (0, jsx_runtime_1.jsx)("i", { style: { color: safe }, children: children });
|
|
96
199
|
}
|
|
200
|
+
|
|
97
201
|
const allJoinMessages = [
|
|
98
202
|
'{user} just joined the server - glhf!',
|
|
99
203
|
'{user} just joined. Everyone, look busy!',
|
|
@@ -126,24 +230,34 @@ const allJoinMessages = [
|
|
|
126
230
|
"We've been expecting you {user}",
|
|
127
231
|
"It's dangerous to go alone, take {user}!",
|
|
128
232
|
"{user} has joined the server! It's super effective!",
|
|
129
|
-
'Cheers, love! {user} is here!',
|
|
130
233
|
'{user} is here, as the prophecy foretold.',
|
|
131
234
|
"{user} has arrived. Party's over.",
|
|
132
235
|
'Ready player {user}',
|
|
133
236
|
'{user} is here to kick butt and chew bubblegum. And {user} is all out of gum.',
|
|
134
237
|
"Hello. Is it {user} you're looking for?",
|
|
135
238
|
];
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
239
|
+
|
|
240
|
+
// Deterministic — seed off message.id so the message text stays stable across re-renders.
|
|
241
|
+
function pickJoinMessage(seed) {
|
|
242
|
+
if (!seed) return allJoinMessages[0];
|
|
243
|
+
try {
|
|
244
|
+
// Hash snowflake → index. BigInt safe for snowflakes.
|
|
245
|
+
let n = 0;
|
|
246
|
+
for (let i = 0; i < seed.length; i++) n = (n * 31 + seed.charCodeAt(i)) >>> 0;
|
|
247
|
+
return allJoinMessages[n % allJoinMessages.length];
|
|
248
|
+
} catch (_e) {
|
|
249
|
+
return allJoinMessages[0];
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function JoinMessage({ member, fallbackUser, seed, context }) {
|
|
254
|
+
const template = pickJoinMessage(seed);
|
|
255
|
+
return template
|
|
139
256
|
.split('{user}')
|
|
140
|
-
.flatMap((item, i) =>
|
|
141
|
-
var _a, _b, _c;
|
|
142
|
-
return [
|
|
257
|
+
.flatMap((item, i) => [
|
|
143
258
|
item,
|
|
144
|
-
(0, jsx_runtime_1.jsx)(Highlight, { color:
|
|
145
|
-
]
|
|
146
|
-
})
|
|
259
|
+
(0, jsx_runtime_1.jsx)(Highlight, { color: member?.roles?.color?.hexColor, children: member?.nickname ?? fallbackUser.displayName ?? fallbackUser.username }, i),
|
|
260
|
+
])
|
|
147
261
|
.slice(0, -1);
|
|
148
262
|
}
|
|
149
|
-
//# sourceMappingURL=systemMessage.js.map
|
|
263
|
+
//# sourceMappingURL=systemMessage.js.map
|
|
@@ -1,51 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
18
5
|
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
6
|
+
var ownKeys = function(o){ownKeys = Object.getOwnPropertyNames || function (o){var ar=[];for (var k in o) if (Object.prototype.hasOwnProperty.call(o,k)) ar[ar.length]=k;return ar;};return ownKeys(o);};
|
|
7
|
+
return function (mod){if (mod && mod.__esModule) return mod;var result={};if (mod != null) for (var k=ownKeys(mod), i=0; i<k.length; i++) if (k[i] !== "default") Object.defineProperty(result,k[i],{get:function(){return mod[k[i]];}});Object.defineProperty(result,"default",{value:mod,enumerable:true});return result;};
|
|
34
8
|
})();
|
|
35
9
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
36
10
|
var t = {};
|
|
37
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
38
|
-
t[p] = s[p];
|
|
11
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
39
12
|
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
40
13
|
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
41
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
42
|
-
t[p[i]] = s[p[i]];
|
|
14
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
43
15
|
}
|
|
44
16
|
return t;
|
|
45
17
|
};
|
|
46
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
47
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
48
|
-
};
|
|
49
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
19
|
exports.default = DiscordMessages;
|
|
51
20
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
@@ -53,24 +22,41 @@ const discord_js_1 = require("discord.js");
|
|
|
53
22
|
const content_1 = __importStar(require("./renderers/content"));
|
|
54
23
|
const message_1 = __importDefault(require("./renderers/message"));
|
|
55
24
|
const TranscriptHeader_1 = require("./renderers/components/TranscriptHeader");
|
|
56
|
-
|
|
57
|
-
* The core transcript component.
|
|
58
|
-
* Expects window.$discordMessage.profiles to be set for profile information.
|
|
59
|
-
*
|
|
60
|
-
* @param props Messages, channel details, callbacks, etc.
|
|
61
|
-
* @returns
|
|
62
|
-
*/
|
|
25
|
+
|
|
63
26
|
async function DiscordMessages(_a) {
|
|
64
|
-
var _b, _c, _d, _e, _f;
|
|
65
27
|
var { messages, channel, callbacks } = _a, options = __rest(_a, ["messages", "channel", "callbacks"]);
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
28
|
+
const dateSeps = options.dateSeps || [];
|
|
29
|
+
|
|
30
|
+
return ((0, jsx_runtime_1.jsxs)("discord-messages", { style: { minHeight: '100vh' }, children: [
|
|
31
|
+
(0, jsx_runtime_1.jsx)(TranscriptHeader_1.TranscriptHeader, {
|
|
32
|
+
guildName: channel.isDMBased() ? 'Direct Messages' : channel.guild.name,
|
|
33
|
+
guildIcon: channel.isDMBased() ? undefined : (channel.guild.iconURL({ size: 128 }) ?? undefined),
|
|
34
|
+
channelName: channel.isDMBased()
|
|
35
|
+
? channel.type === discord_js_1.ChannelType.DM
|
|
36
|
+
? (channel.recipient?.tag ?? 'Unknown Recipient')
|
|
37
|
+
: 'Unknown Recipient'
|
|
38
|
+
: channel.name,
|
|
39
|
+
children: channel.isThread() ? (`Thread channel in ${channel.parent?.name ?? 'Unknown Channel'}`)
|
|
40
|
+
: channel.isDMBased() ? (`Direct Messages`)
|
|
41
|
+
: channel.isVoiceBased() ? (`Voice Text Channel for ${channel.name}`)
|
|
42
|
+
: channel.type === discord_js_1.ChannelType.GuildCategory ? (`Category Channel`)
|
|
43
|
+
: 'topic' in channel && channel.topic
|
|
44
|
+
? (0, jsx_runtime_1.jsx)(content_1.default, { content: channel.topic, context: Object.assign({ messages, channel, callbacks, type: content_1.RenderType.REPLY }, options) })
|
|
45
|
+
: (`This is the start of #${channel.name} channel.`)
|
|
46
|
+
}),
|
|
47
|
+
messages.map((message, idx) => [
|
|
48
|
+
dateSeps[idx] && (0, jsx_runtime_1.jsx)("div", { className: "dht-date-sep", children: dateSeps[idx] }, `sep-${idx}`),
|
|
49
|
+
(0, jsx_runtime_1.jsx)(message_1.default, { message: message, context: Object.assign({ messages, channel, callbacks }, options) }, message.id)
|
|
50
|
+
]),
|
|
51
|
+
(0, jsx_runtime_1.jsxs)("div", { style: { textAlign: 'center', width: '100%' }, children: [
|
|
52
|
+
options.footerText
|
|
53
|
+
? options.footerText.replaceAll('{number}', messages.length.toString()).replaceAll('{s}', messages.length > 1 ? 's' : '')
|
|
54
|
+
: `Exported ${messages.length} message${messages.length > 1 ? 's' : ''}.`,
|
|
55
|
+
' ',
|
|
56
|
+
options.poweredBy
|
|
57
|
+
? (0, jsx_runtime_1.jsxs)("span", { style: { textAlign: 'center' }, children: ["Powered by ", (0, jsx_runtime_1.jsx)("a", { href: "https://github.com/ItzDerock/discord-html-transcripts", style: { color: 'lightblue' }, children: "discord-html-transcripts" }), "."] })
|
|
58
|
+
: null
|
|
59
|
+
] })
|
|
60
|
+
] }));
|
|
75
61
|
}
|
|
76
|
-
//# sourceMappingURL=transcript.js.map
|
|
62
|
+
//# sourceMappingURL=transcript.js.map
|