discord-html-transcripts-fix 1.3.0 → 1.4.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.
|
@@ -195,62 +195,61 @@ async function renderASTNode(node, context) {
|
|
|
195
195
|
const id = node.id;
|
|
196
196
|
if (typeof id === 'string' && /^[a-z][a-z-]*$/.test(id)) {
|
|
197
197
|
const label = GUIDE_LABELS[id] || id;
|
|
198
|
-
return (0, jsx_runtime_1.
|
|
198
|
+
return (0, jsx_runtime_1.jsx)("span", { className: "dht-mention dht-mention--channel", children: '#' + label });
|
|
199
199
|
}
|
|
200
|
-
const channel = await context.callbacks.resolveChannel(id).catch(() => null);
|
|
201
|
-
const name = channel ? (channel.isDMBased() ? 'DM Channel' : channel.name) : `unknown-${id.slice(-6)}`;
|
|
202
|
-
return (0, jsx_runtime_1.
|
|
200
|
+
const channel = await Promise.resolve(context.callbacks.resolveChannel(id)).catch(() => null);
|
|
201
|
+
const name = channel ? (channel.isDMBased() ? 'DM Channel' : channel.name) : `unknown-${(id || '').slice(-6)}`;
|
|
202
|
+
return (0, jsx_runtime_1.jsx)("span", {
|
|
203
203
|
className: "dht-mention dht-mention--channel",
|
|
204
204
|
"data-mention-type": "channel",
|
|
205
205
|
"data-mention-id": id,
|
|
206
|
-
children:
|
|
206
|
+
children: '#' + name
|
|
207
207
|
});
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
case 'role': {
|
|
211
211
|
const id = node.id;
|
|
212
|
-
const role = await context.callbacks.resolveRole(id).catch(() => null);
|
|
213
|
-
const name = role?.name ?? `role-${id.slice(-6)}`;
|
|
212
|
+
const role = await Promise.resolve(context.callbacks.resolveRole(id)).catch(() => null);
|
|
213
|
+
const name = role?.name ?? `role-${(id || '').slice(-6)}`;
|
|
214
214
|
const color = role?.hexColor && role.hexColor !== '#000000' ? (0, utils_1.safeColor)(role.hexColor, undefined) : undefined;
|
|
215
215
|
const bg = color ? hexToRgba(color, 0.18) : undefined;
|
|
216
216
|
const style = color ? { color, backgroundColor: bg, borderColor: hexToRgba(color, 0.45) } : undefined;
|
|
217
|
-
return (0, jsx_runtime_1.
|
|
217
|
+
return (0, jsx_runtime_1.jsx)("span", {
|
|
218
218
|
className: "dht-mention dht-mention--role",
|
|
219
219
|
"data-mention-type": "role",
|
|
220
220
|
"data-mention-id": id,
|
|
221
221
|
style,
|
|
222
|
-
children:
|
|
222
|
+
children: '@' + name
|
|
223
223
|
});
|
|
224
224
|
}
|
|
225
225
|
|
|
226
226
|
case 'user': {
|
|
227
227
|
const id = node.id;
|
|
228
|
-
const user = await context.callbacks.resolveUser(id).catch(() => null);
|
|
229
|
-
const name = user ? (user.displayName ?? user.username ?? `user-${id.slice(-6)}`) : `user-${id.slice(-6)}`;
|
|
230
|
-
return (0, jsx_runtime_1.
|
|
228
|
+
const user = await Promise.resolve(context.callbacks.resolveUser(id)).catch(() => null);
|
|
229
|
+
const name = user ? (user.displayName ?? user.username ?? `user-${(id || '').slice(-6)}`) : `user-${(id || '').slice(-6)}`;
|
|
230
|
+
return (0, jsx_runtime_1.jsx)("span", {
|
|
231
231
|
className: "dht-mention dht-mention--user",
|
|
232
232
|
"data-mention-type": "user",
|
|
233
233
|
"data-mention-id": id,
|
|
234
|
-
children:
|
|
234
|
+
children: '@' + name
|
|
235
235
|
});
|
|
236
236
|
}
|
|
237
237
|
|
|
238
238
|
case 'slashCommand':
|
|
239
239
|
case 'command': {
|
|
240
240
|
const name = node.name || node.content || 'command';
|
|
241
|
-
return (0, jsx_runtime_1.
|
|
241
|
+
return (0, jsx_runtime_1.jsx)("span", { className: "dht-mention dht-mention--command", children: '/' + String(name) });
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
case 'guildNavigation': {
|
|
245
|
-
// discord-markdown-parser emits this for <id:guide> etc.
|
|
246
245
|
const id = node.id || node.content || 'guide';
|
|
247
246
|
const label = GUIDE_LABELS[id] || id;
|
|
248
|
-
return (0, jsx_runtime_1.
|
|
247
|
+
return (0, jsx_runtime_1.jsx)("span", { className: "dht-mention dht-mention--channel", children: '#' + label });
|
|
249
248
|
}
|
|
250
249
|
|
|
251
250
|
case 'here':
|
|
252
251
|
case 'everyone':
|
|
253
|
-
return (0, jsx_runtime_1.
|
|
252
|
+
return (0, jsx_runtime_1.jsx)("span", { className: "dht-mention dht-mention--role dht-mention--highlight", children: '@' + type });
|
|
254
253
|
|
|
255
254
|
case 'codeBlock':
|
|
256
255
|
if (context.type !== RenderType.REPLY) {
|
|
@@ -137,13 +137,6 @@ async function DiscordMessage({ message, context }) {
|
|
|
137
137
|
// Build a comma-separated badge list for additional flag rendering
|
|
138
138
|
const slashCmdLine = renderSlashCommandLine(message, context);
|
|
139
139
|
|
|
140
|
-
// Resolve author profile data for Skyra slot attributes — without these the
|
|
141
|
-
// <discord-message> web component falls back to a generic display
|
|
142
|
-
const authorMember = message.member;
|
|
143
|
-
const authorDisplay = authorMember?.nickname ?? message.author?.displayName ?? message.author?.username;
|
|
144
|
-
const authorAvatar = authorMember?.displayAvatarURL?.({ size: 64 }) ?? message.author?.displayAvatarURL?.({ size: 64 });
|
|
145
|
-
const authorRoleHex = authorMember?.displayHexColor && authorMember.displayHexColor !== '#000000' ? authorMember.displayHexColor : undefined;
|
|
146
|
-
|
|
147
140
|
return ((0, jsx_runtime_1.jsxs)("discord-message", {
|
|
148
141
|
id: `m-${message.id}`,
|
|
149
142
|
timestamp: message.createdAt,
|
|
@@ -151,11 +144,6 @@ async function DiscordMessage({ message, context }) {
|
|
|
151
144
|
server: (isCrossGuildReply || isCrosspost || isCrossposted) ? true : undefined,
|
|
152
145
|
highlight: message.mentions.everyone || pinned,
|
|
153
146
|
profile: message.author.id,
|
|
154
|
-
author: authorDisplay,
|
|
155
|
-
avatar: authorAvatar,
|
|
156
|
-
roleColor: authorRoleHex,
|
|
157
|
-
bot: message.author?.bot && !message.webhookId ? true : undefined,
|
|
158
|
-
verified: verifiedBot ? true : undefined,
|
|
159
147
|
className: pinned ? 'dht-msg dht-msg-pinned' : 'dht-msg',
|
|
160
148
|
"data-author-id": message.author.id,
|
|
161
149
|
"data-author-name": authorName,
|
package/dist/static/client.js
CHANGED
|
@@ -472,7 +472,13 @@ exports.markdownStyles = `
|
|
|
472
472
|
.dht-hit--active{background:rgba(255,140,0,.85);color:#000}
|
|
473
473
|
/* Body fallback when web components fail to load from CDN */
|
|
474
474
|
body{background:#313338;color:#dbdee1;font-family:"gg sans","Helvetica Neue",Helvetica,Arial,sans-serif}
|
|
475
|
-
discord-messages{background:#313338}
|
|
475
|
+
discord-messages{background:#313338;display:block}
|
|
476
|
+
/* CRITICAL: ensure message hosts are block-level. Without this, two consecutive
|
|
477
|
+
messages collapse onto the same line in some browser states. */
|
|
478
|
+
discord-message,discord-system-message{display:block;position:relative}
|
|
479
|
+
/* Fallback layout when @skyra Web Components fail to register (offline viewer). */
|
|
480
|
+
discord-message:not(:defined),discord-system-message:not(:defined){padding:6px 16px 6px 16px;min-height:32px;color:#dbdee1;font-size:14px;border-top:1px solid rgba(255,255,255,0.04);margin-top:0}
|
|
481
|
+
discord-message:not(:defined)::before{content:attr(profile);display:block;font-weight:600;color:#fff;font-size:13px;margin-bottom:2px;opacity:.7}
|
|
476
482
|
/* Date separator divider — more visible */
|
|
477
483
|
.dht-date-sep::before,.dht-date-sep::after{background:rgba(255,255,255,.1)}
|
|
478
484
|
/* Reduce motion */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "discord-html-transcripts-fix",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "A nicely formatted html transcript generator for discord.js. Bugfix fork with support for the latest discord.js and Components v2.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|