discord-message-transcript 1.0.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.
Files changed (44) hide show
  1. package/LICENSE +201 -0
  2. package/dist/core/clientManager.d.ts +3 -0
  3. package/dist/core/clientManager.js +9 -0
  4. package/dist/core/componentHelpers.d.ts +3 -0
  5. package/dist/core/componentHelpers.js +175 -0
  6. package/dist/core/componentToJson.d.ts +3 -0
  7. package/dist/core/componentToJson.js +174 -0
  8. package/dist/core/error.d.ts +3 -0
  9. package/dist/core/error.js +7 -0
  10. package/dist/core/fetchMessages.d.ts +7 -0
  11. package/dist/core/fetchMessages.js +169 -0
  12. package/dist/core/getMentions.d.ts +3 -0
  13. package/dist/core/getMentions.js +99 -0
  14. package/dist/core/imageToBase64.d.ts +1 -0
  15. package/dist/core/imageToBase64.js +30 -0
  16. package/dist/core/mappers.d.ts +8 -0
  17. package/dist/core/mappers.js +101 -0
  18. package/dist/core/markdown.d.ts +2 -0
  19. package/dist/core/markdown.js +175 -0
  20. package/dist/core/output.d.ts +4 -0
  21. package/dist/core/output.js +28 -0
  22. package/dist/index.d.ts +24 -0
  23. package/dist/index.js +120 -0
  24. package/dist/renderers/html/clientRenderer.d.ts +0 -0
  25. package/dist/renderers/html/clientRenderer.js +73 -0
  26. package/dist/renderers/html/css.d.ts +11 -0
  27. package/dist/renderers/html/css.js +663 -0
  28. package/dist/renderers/html/html copy.d.ts +19 -0
  29. package/dist/renderers/html/html copy.js +371 -0
  30. package/dist/renderers/html/html-backup.d.ts +19 -0
  31. package/dist/renderers/html/html-backup.js +371 -0
  32. package/dist/renderers/html/html.d.ts +19 -0
  33. package/dist/renderers/html/html.js +415 -0
  34. package/dist/renderers/html/html2.d.ts +8 -0
  35. package/dist/renderers/html/html2.js +233 -0
  36. package/dist/renderers/html/js.d.ts +4 -0
  37. package/dist/renderers/html/js.js +174 -0
  38. package/dist/renderers/json/json.d.ts +16 -0
  39. package/dist/renderers/json/json.js +55 -0
  40. package/dist/types/types copy.d.ts +284 -0
  41. package/dist/types/types copy.js +35 -0
  42. package/dist/types/types.d.ts +137 -0
  43. package/dist/types/types.js +7 -0
  44. package/package.json +45 -0
@@ -0,0 +1,663 @@
1
+ export const DEFAULT_CSS = `
2
+ body {
3
+ background-color: #313338;
4
+ color: #dbdee1;
5
+ font-family: "Whitney", "Helvetica Neue", Helvetica, Arial, sans-serif;
6
+ margin: 0;
7
+ padding: 0;
8
+ width: 100%;
9
+ }
10
+ header {
11
+ height: fit-content;
12
+ border-bottom: 2px solid black;
13
+ margin-top: 2rem;
14
+ padding-left: 2rem;
15
+ padding-bottom: 1rem;
16
+ display: flex;
17
+ flex-direction: column;
18
+ display: flex;
19
+ flex-direction: row;
20
+ }
21
+ a {
22
+ text-decoration: none;
23
+ color: #1E90FF;
24
+ }
25
+ p {
26
+ margin: 0;
27
+ }
28
+ h4 {
29
+ margin: 0;
30
+ }
31
+ code {
32
+ border: 1px solid #202225;
33
+ border-radius: 0.25rem;
34
+ }
35
+ blockquote {
36
+ margin: 0.5rem 0;
37
+ border-left: 0.25rem solid #4f545c;
38
+ padding: 0.4rem 0.6rem;
39
+ border-radius: 0.25rem;
40
+ color: #9f9fa6;
41
+ }
42
+ .line {
43
+ display: flex;
44
+ align-items: baseline;
45
+ gap: 0.5rem
46
+ }
47
+ .badge {
48
+ background-color: #5865f2;
49
+ color: white;
50
+ font-weight: 600;
51
+ font-size: 80%;
52
+ padding: 0.1rem 0.35rem;
53
+ border-radius: 0.25rem;
54
+ letter-spacing: 0.03rem;
55
+ height: fit-content;
56
+ width: fit-content;
57
+ align-self: flex-start;
58
+ }
59
+ .badgeTag {
60
+ background-color: #747F8D50;
61
+ color: white;
62
+ font-weight: 600;
63
+ font-size: 70%;
64
+ padding: 0.1rem 0.35rem;
65
+ border-radius: 0.25rem;
66
+ letter-spacing: 0.03rem;
67
+ height: fit-content;
68
+ width: fit-content;
69
+ align-self: center;
70
+ }
71
+ .mention {
72
+ background-color: #5664fa41;
73
+ padding: 0.2rem;
74
+ border-radius: 0.25rem;
75
+ transition: background-color 0.2s ease;
76
+ }
77
+ .mention:hover {
78
+ background-color: #5664fa7e;
79
+ }
80
+ `;
81
+ export const MESSAGE_CSS = `
82
+ .messageDiv {
83
+ display: flex;
84
+ flex-direction: column;
85
+ gap: 0.2rem;
86
+ padding: 0.5rem;
87
+ border-radius: 1rem;
88
+ }
89
+ .messageDiv.highlight, .messageDiv:hover {
90
+ background-color: #40434b;
91
+ transition: background-color 0.3s ease-in-out;
92
+ }
93
+ .messageBotton {
94
+ display: flex;
95
+ flex-direction: row;
96
+ gap: 1rem;
97
+ padding: 0.5rem;
98
+ border-radius: 0.25rem;
99
+ }
100
+ .messageImg {
101
+ width: 3.5rem;
102
+ height: 3.5rem;
103
+ border-radius: 50%;
104
+ }
105
+ .messageDivRight {
106
+ display: flex;
107
+ flex-direction: column;
108
+ gap: 0.25rem
109
+ }
110
+ .messageUser {
111
+ display: flex;
112
+ flex-direction: row;
113
+ gap: 0.75rem;
114
+ }
115
+ .messageUsername {
116
+ margin: 0;
117
+ }
118
+ .messageTimeStamp {
119
+ color: #999999;
120
+ font-size: 77.5%;
121
+ align-self: center;
122
+ }
123
+ .messageContent {
124
+ line-height: 1.5;
125
+ }
126
+ .pList {
127
+ white-space: pre-wrap;
128
+ }
129
+ .subtext {
130
+ font-size: 85%;
131
+ color: #808080;
132
+ }
133
+ .spoilerMsg {
134
+ display: inline-block;
135
+ background-color: #202225;
136
+ color: #202225;
137
+ padding: 0 0.2rem;
138
+ border-radius: 0.2rem;
139
+ cursor: pointer;
140
+ transition: background-color 0.1s ease-in-out, color 0.1s ease-in-out;
141
+ }
142
+ .spoilerMsg.revealed {
143
+ background-color: transparent;
144
+ color: inherit;
145
+ }
146
+ .messageReply {
147
+ display: flex;
148
+ align-items: center;
149
+ gap: 0.5rem;
150
+ font-size: 0.8rem;
151
+ color: #b5bac1;
152
+ cursor: pointer;
153
+ margin-left: 2rem;
154
+ }
155
+ .messageReplySvg {
156
+ flex-shrink: 0;
157
+ width: 2.25rem;
158
+ height: 2.25rem;
159
+ color: #b5bac1;
160
+ }
161
+ .messageReplyImg {
162
+ width: 1.75rem;
163
+ height: 1.75rem;
164
+ border-radius: 50%;
165
+ flex-shrink: 0;
166
+ }
167
+ .messageReplyAuthor {
168
+ font-weight: 600;
169
+ color: #dbdee1;
170
+ margin-right: 0.3rem;
171
+ }
172
+ .badgeReply {
173
+ background-color: #5865f2;
174
+ color: white;
175
+ font-weight: 600;
176
+ font-size: 70%;
177
+ padding: 0.1rem 0.3rem;
178
+ border-radius: 0.25rem;
179
+ letter-spacing: 0.03rem;
180
+ height: fit-content;
181
+ align-self: center;
182
+ flex-shrink: 0;
183
+ }
184
+ .messageReplyText {
185
+ flex-grow: 1;
186
+ white-space: nowrap;
187
+ overflow: hidden;
188
+ text-overflow: ellipsis;
189
+ color: #b5bac1;
190
+ font-size: 0.75rem;
191
+ }
192
+ `;
193
+ export const EMBED_CSS = `
194
+ .embed {
195
+ background-color: #2b2d31;
196
+ border: 0.15rem solid #2b2d31;
197
+ border-left: 0.25rem solid;
198
+ border-radius: 0.25rem;
199
+ padding: 0.5rem 0.75rem;
200
+ margin-top: 0.5rem;
201
+ display: flex;
202
+ flex-direction: column;
203
+ gap: 0.5rem;
204
+ max-width: 520px;
205
+ }
206
+ .embed a {
207
+ color: #00aff4;
208
+ text-decoration: none;
209
+ }
210
+ .embed a:hover {
211
+ text-decoration: underline;
212
+ }
213
+ .embedHeader {
214
+ display: flex;
215
+ justify-content: space-between;
216
+ align-items: flex-start;
217
+ gap: 0.5rem;
218
+ }
219
+ .embedHeaderRight {
220
+ display: flex;
221
+ flex-direction: column;
222
+ gap: 0.25rem;
223
+ }
224
+ .embedHeaderRightAuthor {
225
+ display: flex;
226
+ align-items: center;
227
+ gap: 0.5rem;
228
+ font-size: 0.875rem;
229
+ font-weight: 500;
230
+ color: #ffffff;
231
+ }
232
+ .embedHeaderRightAuthorImg {
233
+ width: 1.5rem;
234
+ height: 1.5rem;
235
+ border-radius: 50%;
236
+ }
237
+ .embedHeaderRightAuthorName {
238
+ color: #ffffff;
239
+ font-weight: 500;
240
+ }
241
+ .embedHeaderRightTitle {
242
+ font-size: 1rem;
243
+ font-weight: bold;
244
+ color: #ffffff;
245
+ }
246
+ .embedHeaderThumbnail {
247
+ max-width: 80px;
248
+ max-height: 80px;
249
+ object-fit: contain;
250
+ border-radius: 0.25rem;
251
+ flex-shrink: 0;
252
+ }
253
+ .embedDescription {
254
+ font-size: 0.875rem;
255
+ color: #dcddde;
256
+ }
257
+ .embedFields {
258
+ display: flex;
259
+ flex-wrap: wrap;
260
+ gap: 0.5rem;
261
+ }
262
+ .embedFieldsField {
263
+ flex: 1;
264
+ min-width: 150px;
265
+ }
266
+ .embedFieldsFieldTitle {
267
+ font-size: 0.75rem;
268
+ font-weight: bold;
269
+ color: #ffffff;
270
+ margin-bottom: 0.25rem;
271
+ }
272
+ .embedFieldsFieldValue {
273
+ font-size: 0.875rem;
274
+ color: #dcddde;
275
+ }
276
+ .embedImage {
277
+ margin-top: 0.5rem;
278
+ max-width: 100%;
279
+ height: auto;
280
+ }
281
+ .embedImage img {
282
+ max-width: 100%;
283
+ max-height: 300px;
284
+ object-fit: contain;
285
+ border-radius: 0.25rem;
286
+ }
287
+ .embedFooter {
288
+ display: flex;
289
+ align-items: center;
290
+ gap: 0.5rem;
291
+ font-size: 0.75rem;
292
+ color: #999999;
293
+ margin-top: 0.5rem;
294
+ }
295
+ .embedFooterImg {
296
+ width: 1.25rem;
297
+ height: 1.25rem;
298
+ border-radius: 50%;
299
+ }
300
+ .embedFooterText {
301
+ color: #999999;
302
+ }
303
+ `;
304
+ export const ATTACHMENT_CSS = `
305
+ .attachmentImage, .attachmentVideo {
306
+ max-width: 400px;
307
+ height: auto;
308
+ border-radius: 0.25rem;
309
+ margin-top: 0.5rem;
310
+ }
311
+ .attachmentAudio {
312
+ width: 300px;
313
+ margin-top: 0.5rem;
314
+ }
315
+ .attachmentFile {
316
+ background-color: #2b2d31;
317
+ border: 1px solid #202225;
318
+ border-radius: 0.75rem;
319
+ padding: 0.75rem;
320
+ display: flex;
321
+ align-items: center;
322
+ gap: 0.75rem;
323
+ max-width: 400px;
324
+ margin-top: 0.5rem;
325
+ width: fit-content;
326
+ }
327
+ .attachmentFileIcon {
328
+ width: 2.5rem;
329
+ height: 2.5rem;
330
+ fill: #b9bbbe;
331
+ flex-shrink: 0;
332
+ }
333
+ .attachmentFileInfo {
334
+ display: flex;
335
+ flex-direction: column;
336
+ gap: 0.1rem;
337
+ overflow: hidden;
338
+ flex-grow: 1;
339
+ }
340
+ .attachmentFileName {
341
+ color: #ffffff;
342
+ text-decoration: none;
343
+ white-space: nowrap;
344
+ overflow: hidden;
345
+ text-overflow: ellipsis;
346
+ }
347
+ .attachmentFileSize {
348
+ font-size: 0.75rem;
349
+ color: #72767d;
350
+ }
351
+ .attachmentDownload {
352
+ display: block;
353
+ flex-shrink: 0;
354
+ }
355
+ .attachmentDownloadIcon {
356
+ width: 1.5rem;
357
+ height: 1.5rem;
358
+ fill: #b9bbbe;
359
+ transition: fill 0.2s ease;
360
+ }
361
+ .attachmentDownload:hover .attachmentDownloadIcon {
362
+ fill: #ffffff;
363
+ }
364
+ .spoilerAttachment {
365
+ position: relative;
366
+ display: inline-block;
367
+ border-radius: 0.5rem;
368
+ overflow: hidden;
369
+ cursor: pointer;
370
+ }
371
+ .spoilerAttachment .spoilerAttachmentContent {
372
+ filter: blur(64px);
373
+ pointer-events: none;
374
+ transition: filter 0.2s ease;
375
+ }
376
+ .spoilerAttachment .spoilerAttachmentOverlay {
377
+ position: absolute;
378
+ inset: 0;
379
+ background: rgba(32, 34, 37, 0.85);
380
+ color: #fff;
381
+ font-weight: 600;
382
+ letter-spacing: 0.05em;
383
+ display: flex;
384
+ align-items: center;
385
+ justify-content: center;
386
+ z-index: 2;
387
+ user-select: none;
388
+ }
389
+ .spoilerAttachment.revealed .spoilerAttachmentContent {
390
+ filter: none;
391
+ pointer-events: auto;
392
+ }
393
+ .spoilerAttachment.revealed .spoilerAttachmentOverlay {
394
+ display: none;
395
+ }
396
+ `;
397
+ export const ACTIONROW_CSS = `
398
+ .actionRow {
399
+ display: flex;
400
+ gap: 0.5rem;
401
+ margin-top: 0.5rem;
402
+ }
403
+ `;
404
+ export const BUTTON_CSS = `
405
+ .button {
406
+ display: flex;
407
+ align-items: center;
408
+ gap: 0.5rem;
409
+ padding: 0rem 0.8rem;
410
+ height: 2.5rem;
411
+ border-radius: 0.6rem;
412
+ color: white;
413
+ font-weight: 600;
414
+ cursor: pointer;
415
+ transition: filter 0.2s ease;
416
+ }
417
+ .button:hover {
418
+ filter: brightness(1.1);
419
+ }
420
+ .buttonEmoji {
421
+ font-size: 1.25rem;
422
+ }
423
+ .buttonLabel {
424
+ font-size: 0.875rem;
425
+ }
426
+ .buttonLink {
427
+ display: flex;
428
+ align-items: center;
429
+ gap: 0.5rem;
430
+ color: white;
431
+ font-weight: 600;
432
+ }
433
+ .buttonLinkIcon {
434
+ width: 1.25rem;
435
+ height: 1.25rem;
436
+ }
437
+ `;
438
+ export const COMPONENTS_CSS = `
439
+ .selector {
440
+ width: 100%;
441
+ position: relative;
442
+ }
443
+ .selectorInput {
444
+ background-color: #2b2d31;
445
+ border: 1px solid #202225;
446
+ border-radius: 0.75rem;
447
+ padding: 0.75rem;
448
+ min-width: 17.5rem;
449
+ cursor: pointer;
450
+ user-select: none;
451
+ }
452
+ .selectorInputText {
453
+ color: #808080;
454
+ }
455
+ .selectorOptionMenu {
456
+ display: none;
457
+ position: absolute;
458
+ top: 100%;
459
+ left: 0;
460
+ width: 100%;
461
+ background-color: #2b2d31;
462
+ border: 1px solid #202225;
463
+ border-radius: 1rem;
464
+ margin-top: 0.25rem;
465
+ padding: 0.5rem;
466
+ z-index: 10;
467
+ box-sizing: border-box;
468
+ }
469
+ .selector.active .selectorOptionMenu {
470
+ display: block;
471
+ }
472
+ .selectorOption {
473
+ display: flex;
474
+ align-items: center;
475
+ gap: 0.5rem;
476
+ padding: 0.75rem;
477
+ border-radius: 0.75rem;
478
+ cursor: pointer;
479
+ transition: background-color 0.2s ease;
480
+ }
481
+ .selectorOption:hover {
482
+ background-color: #4f545c;
483
+ }
484
+ .selectorOptionEmoji {
485
+ font-size: 1.25rem;
486
+ }
487
+ .selectorOptionRight {
488
+ display: flex;
489
+ flex-direction: column;
490
+ }
491
+ .selectorOptionTitle {
492
+ font-weight: 500;
493
+ }
494
+ .selectorOptionDesc {
495
+ font-size: 0.75rem;
496
+ color: #808080;
497
+ }
498
+ `;
499
+ export const COMPONENTSV2_CSS = `
500
+ .mediaGallery {
501
+ display: flex;
502
+ flex-wrap: wrap;
503
+ gap: 0.35rem;
504
+ width: 20rem;
505
+ height: 20rem;
506
+ border: 1px solid #202225
507
+ padding: 0.35rem;
508
+ overflow: hidden;
509
+ }
510
+ .mediaGalleryItem {
511
+ flex-grow: 1;
512
+ flex-basis: 6rem;
513
+ min-width: 0;
514
+ display: flex;
515
+ }
516
+ .mediaGalleryImg {
517
+ width: 100%;
518
+ height: 100%;
519
+ object-fit: cover;
520
+ display: block;
521
+ }
522
+ `;
523
+ export const POLL_CSS = `
524
+ .pollDiv {
525
+ background-color: #2b2d31;
526
+ border-radius: 0.5rem;
527
+ padding: 1rem;
528
+ margin-top: 0.5rem;
529
+ max-width: 420px;
530
+ }
531
+ .pollQuestion {
532
+ font-size: 1.1rem;
533
+ font-weight: bold;
534
+ margin-bottom: 1rem;
535
+ display: flex;
536
+ align-items: center;
537
+ gap: 0.5rem;
538
+ }
539
+ .pollAnswers {
540
+ display: flex;
541
+ flex-direction: column;
542
+ gap: 0.5rem;
543
+ }
544
+ .pollAnswer {
545
+ background-color: #3a3c42;
546
+ border-radius: 0.3rem;
547
+ padding: 0.75rem;
548
+ cursor: pointer;
549
+ border: 1px solid transparent;
550
+ transition: border-color 0.2s ease;
551
+ position: relative;
552
+ overflow: hidden;
553
+ }
554
+ .pollAnswer:hover {
555
+ border-color: #4d515a;
556
+ }
557
+ .pollAnswerBar {
558
+ position: absolute;
559
+ top: 0;
560
+ left: 0;
561
+ height: 100%;
562
+ background-color: #5664fa7a;
563
+ border-radius: 0.2rem;
564
+ z-index: 1;
565
+ }
566
+ .pollAnswerContent {
567
+ position: relative;
568
+ z-index: 2;
569
+ display: flex;
570
+ align-items: center;
571
+ justify-content: space-between;
572
+ }
573
+ .pollAnswerDetails {
574
+ display: flex;
575
+ align-items: center;
576
+ gap: 0.5rem;
577
+ }
578
+ .pollAnswerEmoji {
579
+ font-size: 1.25rem;
580
+ }
581
+ .pollAnswerText {
582
+ font-weight: 500;
583
+ }
584
+ .pollAnswerVotes {
585
+ font-size: 0.8rem;
586
+ color: #b5bac1;
587
+ font-weight: bold;
588
+ }
589
+ .pollFooter {
590
+ margin-top: 1rem;
591
+ font-size: 0.75rem;
592
+ color: #949ba4;
593
+ }
594
+ `;
595
+ export const POLL_RESULT_EMBED_CSS = `
596
+ .pollResultEmbed {
597
+ background-color: #2b2d31;
598
+ border-radius: 0.5rem;
599
+ padding: 1rem;
600
+ margin-top: 0.5rem;
601
+ border: 1px solid #3a3c42;
602
+ min-width: 25rem;
603
+ display: flex;
604
+ flex-direction: row;
605
+ justify-content: space-between;
606
+ }
607
+ .pollResultEmbedWinner {
608
+ display: flex;
609
+ align-items: center;
610
+ gap: 0.5rem;
611
+ font-size: 1rem;
612
+ font-weight: 600;
613
+ margin-bottom: 0.4rem;
614
+ }
615
+ .pollResultEmbedCheckmark {
616
+ color: #57f287;
617
+ font-size: 1.1em;
618
+ }
619
+ .pollResultEmbedSubtitle {
620
+ font-size: 0.9rem;
621
+ color: #b5bac1;
622
+ }
623
+ .pollResultEmbedButtonDiv {
624
+ margin-right: 0.5rem;
625
+ margin-left: 1rem;
626
+ align-self: center;
627
+ }
628
+ .pollResultEmbedButton {
629
+ background-color: black;
630
+ color: white;
631
+ padding: 0.5rem 1rem;
632
+ border-radius: 0.3rem;
633
+ text-decoration: none;
634
+ font-weight: 500;
635
+ transition: background-color 0.2s ease;
636
+ cursor: pointer;
637
+ }
638
+ .pollResultEmbedButton:hover {
639
+ filter: brightness(1.1);
640
+ }
641
+ `;
642
+ export const REACTIONS_CSS = `
643
+ .reactionsDiv {
644
+ display: flex;
645
+ flex-wrap: wrap;
646
+ gap: 0.5rem;
647
+ margin-top: 0.5rem;
648
+ }
649
+ .reaction {
650
+ align-items: center;
651
+ background-color: #2b2d31;
652
+ border: 1px solid #3a3c42;
653
+ border-radius: 1rem;
654
+ padding: 0.25rem 0.6rem;
655
+ font-size: 1rem;
656
+ color: #dcddde;
657
+ font-weight: bold;
658
+ cursor: pointer;
659
+ }
660
+ .reaction:hover {
661
+ filter: brightness(1.1);
662
+ }
663
+ `;
@@ -0,0 +1,19 @@
1
+ import { JsonData, JsonDataChannel, JsonDataGuild, JsonMessage, TranscriptOptions } from "../../types/types";
2
+ export declare class Html {
3
+ guild: JsonDataGuild | null;
4
+ channel: JsonDataChannel;
5
+ messages: JsonMessage[];
6
+ options: TranscriptOptions;
7
+ dateFormat: Intl.DateTimeFormat;
8
+ constructor(data: JsonData, options: TranscriptOptions);
9
+ private headerBuilder;
10
+ private messagesBuilder;
11
+ toHTML(): string;
12
+ private embedBuilder;
13
+ private attachmentBuilder;
14
+ private componentBuilder;
15
+ private buttonBuilder;
16
+ private selectorBuilder;
17
+ private spoilerAttachmentBuilder;
18
+ private svgBuilder;
19
+ }