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,137 @@
1
+ import { JsonMessageMentionsChannels, JsonMessageMentionsRoles, JsonMessageMentionsUsers, LocalDate, TimeZone, Uploadable, ReturnFormat } from "discord-message-transcript-base";
2
+ import { AttachmentBuilder } from "discord.js";
3
+ import Stream from 'stream';
4
+ export declare const ReturnType: {
5
+ readonly Attachment: "attachment";
6
+ readonly Buffer: "buffer";
7
+ readonly Stream: "stream";
8
+ readonly String: "string";
9
+ readonly Uploadable: "uploadable";
10
+ };
11
+ export type ReturnType = typeof ReturnType[keyof typeof ReturnType];
12
+ export type OutputType<T extends ReturnType> = T extends typeof ReturnType.Buffer ? Buffer : T extends typeof ReturnType.Stream ? Stream : T extends typeof ReturnType.String ? string : T extends typeof ReturnType.Uploadable ? Uploadable : AttachmentBuilder;
13
+ export type CreateTranscriptOptions<T extends ReturnType> = Partial<TranscriptOptions<T>>;
14
+ export type ConvertTranscriptOptions<T extends ReturnType> = Partial<{
15
+ /**
16
+ * The type of the returned value.
17
+ * - ReturnType.Attachment - The transcript content as a `Attachment`
18
+ * - ReturnType.String - The transcript content as a string.
19
+ * - ReturnType.Buffer - The transcript content as a `Buffer`.
20
+ * - ReturnType.Stream - The transcript content as a `Stream`.
21
+ * - ReturnType.Uploadable` - An object with `content`, `contentType` and `fileName`.
22
+ * @default ReturnType.Attachment
23
+ */
24
+ returnType: T;
25
+ /**
26
+ * Whether the generated HTML should be self-contained (CSS and JS in HTML).
27
+ * @default false
28
+ */
29
+ selfContained: boolean;
30
+ /**
31
+ * If you want to include the watermark.
32
+ * @default true
33
+ */
34
+ watermark: boolean;
35
+ }>;
36
+ export interface TranscriptOptions<T extends ReturnType> {
37
+ /**
38
+ * The name of the file to be created.
39
+ * Default depends if is DM or Guild
40
+ */
41
+ fileName: string;
42
+ /**
43
+ * Whether to include attachments in the transcript.
44
+ * @default true
45
+ */
46
+ includeAttachments: boolean;
47
+ /**
48
+ * Whether to include buttons in the transcript.
49
+ * @default true
50
+ */
51
+ includeButtons: boolean;
52
+ /**
53
+ * Whether to include components in the transcript.
54
+ * @default true
55
+ */
56
+ includeComponents: boolean;
57
+ /**
58
+ * Whether to include empty messages in the transcript.
59
+ * @default false
60
+ */
61
+ includeEmpty: boolean;
62
+ /**
63
+ * Whether to include embeds in the transcript.
64
+ * @default true
65
+ */
66
+ includeEmbeds: boolean;
67
+ /**
68
+ * Whether to include polls in the transcript.
69
+ * @default true
70
+ */
71
+ includePolls: boolean;
72
+ /**
73
+ * Whether to include reactions in the transcript.
74
+ * @default true
75
+ */
76
+ includeReactions: boolean;
77
+ /**
78
+ * Whether to include V2 components in the transcript.
79
+ * @default true
80
+ */
81
+ includeV2Components: boolean;
82
+ /**
83
+ * The locale to use for formatting dates.
84
+ * Can be any BCP 47 language tag.
85
+ * @default 'en-GB'
86
+ */
87
+ localDate: LocalDate;
88
+ /**
89
+ * The maximum number of messages to fetch. Set to 0 to fetch all messages.
90
+ * @default 0
91
+ */
92
+ quantity: number;
93
+ /**
94
+ * The format of the returned transcript.
95
+ * - ReturnFormat.HTML - Returns the transcript as HTML
96
+ * - ReturnFormat.JSON - Returns the transcript as JSON
97
+ * @default ReturnFormat.HTML
98
+ */
99
+ returnFormat: ReturnFormat;
100
+ /**
101
+ * The type of the returned value.
102
+ * - ReturnType.Attachment - The transcript content as a `Attachment`
103
+ * - ReturnType.String - The transcript content as a string.
104
+ * - ReturnType.Buffer - The transcript content as a `Buffer`.
105
+ * - ReturnType.Stream - The transcript content as a `Stream`.
106
+ * - ReturnType.Uploadable` - An object with `content`, `contentType` and `fileName`.
107
+ * @default ReturnType.Attachment
108
+ */
109
+ returnType: T;
110
+ /**
111
+ * Whether to save images locally or use remote URLs.
112
+ * @default false
113
+ */
114
+ saveImages: boolean;
115
+ /**
116
+ * Whether the generated HTML should be self-contained.
117
+ * Only matters if `returnFormat` is `HTML`.
118
+ * @default false
119
+ */
120
+ selfContained: boolean;
121
+ /**
122
+ * The timezone to use for formatting dates.
123
+ * Can be any IANA time zone name.
124
+ * @default 'UTC'
125
+ */
126
+ timeZone: TimeZone;
127
+ /**
128
+ * If you want to include the watermark.
129
+ * @default true
130
+ */
131
+ watermark: boolean;
132
+ }
133
+ export interface MapMentions {
134
+ channels: Map<string, JsonMessageMentionsChannels>;
135
+ roles: Map<string, JsonMessageMentionsRoles>;
136
+ users: Map<string, JsonMessageMentionsUsers>;
137
+ }
@@ -0,0 +1,7 @@
1
+ export const ReturnType = {
2
+ Attachment: "attachment",
3
+ Buffer: "buffer",
4
+ Stream: "stream",
5
+ String: "string",
6
+ Uploadable: "uploadable"
7
+ };
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "discord-message-transcript",
3
+ "version": "1.0.0",
4
+ "description": "",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "import": "./dist/index.js",
10
+ "require": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "LICENSE"
17
+ ],
18
+ "scripts": {
19
+ "test": "echo \"Error: no test specified\" && exit 1",
20
+ "build": "tsc"
21
+ },
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/HenriqueMairesse/discord-message-transcript.git"
25
+ },
26
+ "keywords": [],
27
+ "author": "",
28
+ "license": "Apache-2.0",
29
+ "type": "module",
30
+ "bugs": {
31
+ "url": "https://github.com/HenriqueMairesse/discord-message-transcript/issues"
32
+ },
33
+ "homepage": "https://github.com/HenriqueMairesse/discord-message-transcript#readme",
34
+ "devDependencies": {
35
+ "typescript": "^5.9.3",
36
+ "discord.js": "^14.25.1"
37
+ },
38
+ "dependencies": {
39
+ "discord-message-transcript-base": "workspace:*"
40
+ },
41
+ "peerDependencies": {
42
+ "discord.js": ">=14.19.0 <15"
43
+ }
44
+ }
45
+