discord-message-transcript-base 1.3.2-dev.0.49 → 1.3.2-dev.1.50
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/dist/.tsbuildinfo +1 -1
- package/dist/core/markdown.d.ts +1 -1
- package/dist/core/output.d.ts +2 -1
- package/dist/core/output.js +1 -1
- package/dist/core/sanitizer.d.ts +1 -1
- package/dist/index.d.ts +5 -6
- package/dist/index.js +6 -8
- package/dist/internalIndex.d.ts +4 -0
- package/dist/internalIndex.js +4 -0
- package/dist/renderers/html/html.d.ts +1 -1
- package/dist/renderers/html/html.js +9 -9
- package/dist/types/internal/index.d.ts +7 -0
- package/dist/types/internal/index.js +7 -0
- package/dist/types/internal/message/components.d.ts +252 -0
- package/dist/types/internal/message/components.js +1 -0
- package/dist/types/internal/message/componentsV2.d.ts +138 -0
- package/dist/types/internal/message/componentsV2.js +1 -0
- package/dist/types/internal/message/enum.d.ts +41 -0
- package/dist/types/{types.js → internal/message/enum.js} +6 -52
- package/dist/types/internal/message/messageItens.d.ts +149 -0
- package/dist/types/internal/message/messageItens.js +1 -0
- package/dist/types/internal/parse.d.ts +53 -0
- package/dist/types/internal/parse.js +7 -0
- package/dist/types/internal/return.d.ts +17 -0
- package/dist/types/internal/return.js +13 -0
- package/dist/types/internal/transcript.d.ts +91 -0
- package/dist/types/internal/transcript.js +1 -0
- package/dist/types/internal/util.d.ts +51 -0
- package/dist/types/internal/util.js +1 -0
- package/dist/types/public/index.d.ts +2 -0
- package/dist/types/public/index.js +2 -0
- package/dist/types/public/return.d.ts +25 -0
- package/dist/types/public/return.js +21 -0
- package/dist/types/public/transcript.d.ts +25 -0
- package/dist/types/public/transcript.js +1 -0
- package/package.json +6 -2
- package/dist/types/types.d.ts +0 -824
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An enum-like object for the possible transcript formats.
|
|
3
|
+
*/
|
|
4
|
+
export declare const ReturnFormat: {
|
|
5
|
+
/**
|
|
6
|
+
* JSON format.
|
|
7
|
+
*/
|
|
8
|
+
readonly JSON: "JSON";
|
|
9
|
+
/**
|
|
10
|
+
* HTML format.
|
|
11
|
+
*/
|
|
12
|
+
readonly HTML: "HTML";
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* A type representing the possible values of `ReturnFormat`.
|
|
16
|
+
*/
|
|
17
|
+
export type ReturnFormat = typeof ReturnFormat[keyof typeof ReturnFormat];
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { ReturnFormat } from "./return.js";
|
|
2
|
+
import { LocalDate, TimeZone } from "./util.js";
|
|
3
|
+
import { ReturnType } from "../public/return.js";
|
|
4
|
+
/**
|
|
5
|
+
* Base options for creating a transcript.
|
|
6
|
+
*/
|
|
7
|
+
export interface TranscriptOptionsBase {
|
|
8
|
+
/**
|
|
9
|
+
* The name of the generated file.
|
|
10
|
+
*/
|
|
11
|
+
fileName: string;
|
|
12
|
+
/**
|
|
13
|
+
* Disable all warnings to keep console output clean.
|
|
14
|
+
* ⚠️ Can hide issues like unsafe URLs or fallback usage.
|
|
15
|
+
* @default false
|
|
16
|
+
*/
|
|
17
|
+
disableWarnings: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Whether to include attachments.
|
|
20
|
+
*/
|
|
21
|
+
includeAttachments: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Whether to include buttons.
|
|
24
|
+
*/
|
|
25
|
+
includeButtons: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Whether to include other components (like select menus).
|
|
28
|
+
*/
|
|
29
|
+
includeComponents: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Whether to include empty messages.
|
|
32
|
+
*/
|
|
33
|
+
includeEmpty: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Whether to include embeds.
|
|
36
|
+
*/
|
|
37
|
+
includeEmbeds: boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Whether to include polls.
|
|
40
|
+
*/
|
|
41
|
+
includePolls: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Whether to include reactions.
|
|
44
|
+
*/
|
|
45
|
+
includeReactions: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Whether to include V2 components.
|
|
48
|
+
*/
|
|
49
|
+
includeV2Components: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* The locale for date formatting.
|
|
52
|
+
*/
|
|
53
|
+
localDate: LocalDate;
|
|
54
|
+
/**
|
|
55
|
+
* The number of messages to include.
|
|
56
|
+
*/
|
|
57
|
+
quantity: number;
|
|
58
|
+
/**
|
|
59
|
+
* The format of the transcript (HTML or JSON).
|
|
60
|
+
*/
|
|
61
|
+
returnFormat: ReturnFormat;
|
|
62
|
+
/**
|
|
63
|
+
* The type of the returned value (buffer, string, etc.).
|
|
64
|
+
*/
|
|
65
|
+
returnType: ReturnType;
|
|
66
|
+
/**
|
|
67
|
+
* Enables safe mode, blocking potentially unsafe URLs and content.
|
|
68
|
+
* Prevents suspicious links, images, or HTML from being included in the final transcript.
|
|
69
|
+
*
|
|
70
|
+
* ⚠️ Disabling may allow unsafe content to appear in the transcript.
|
|
71
|
+
* @default true
|
|
72
|
+
*/
|
|
73
|
+
safeMode: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Whether to save images as base64.
|
|
76
|
+
* Only saves images with less than 25mb for safety - 25mb is a good security size to an image
|
|
77
|
+
*/
|
|
78
|
+
saveImages: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Whether to generate a self-contained HTML file.
|
|
81
|
+
*/
|
|
82
|
+
selfContained: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* The timezone for date formatting.
|
|
85
|
+
*/
|
|
86
|
+
timeZone: TimeZone;
|
|
87
|
+
/**
|
|
88
|
+
* Whether to include the watermark.
|
|
89
|
+
*/
|
|
90
|
+
watermark: boolean;
|
|
91
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { JsonMessageMentionsChannels, JsonMessageMentionsRoles, JsonMessageMentionsUsers } from "./message/messageItens.js";
|
|
2
|
+
/**
|
|
3
|
+
* A hexColor type
|
|
4
|
+
*/
|
|
5
|
+
export type hexColor = `#${string}`;
|
|
6
|
+
/**
|
|
7
|
+
* A union of all possible timestamp styles for formatting dates and times in Discord.
|
|
8
|
+
*/
|
|
9
|
+
export type StyleTimeStampKey = "t" | "T" | "d" | "D" | "f" | "F";
|
|
10
|
+
/**
|
|
11
|
+
* Represents a BCP 47 language tag for date/time formatting.
|
|
12
|
+
*/
|
|
13
|
+
export type LocalDate = 'ar-EG' | 'ar-SA' | 'bn-BD' | 'bn-IN' | 'cs-CZ' | 'da-DK' | 'de-AT' | 'de-CH' | 'de-DE' | 'el-GR' | 'en-AU' | 'en-CA' | 'en-GB' | 'en-IN' | 'en-US' | 'es-AR' | 'es-CO' | 'es-ES' | 'es-MX' | 'fa-IR' | 'fi-FI' | 'fr-BE' | 'fr-CA' | 'fr-FR' | 'he-IL' | 'hi-IN' | 'hu-HU' | 'id-ID' | 'it-IT' | 'ja-JP' | 'ko-KR' | 'ms-MY' | 'nl-BE' | 'nl-NL' | 'no-NO' | 'pl-PL' | 'pt-BR' | 'pt-PT' | 'ro-RO' | 'ru-RU' | 'sv-SE' | 'th-TH' | 'tr-TR' | 'uk-UA' | 'ur-PK' | 'vi-VN' | 'zh-CN' | 'zh-HK' | 'zh-TW' | (string & {});
|
|
14
|
+
/**
|
|
15
|
+
* Represents an IANA time zone name for date/time formatting.
|
|
16
|
+
*/
|
|
17
|
+
export type TimeZone = 'Africa/Cairo' | 'Africa/Johannesburg' | 'Africa/Lagos' | 'America/Argentina/Buenos_Aires' | 'America/Bogota' | 'America/Los_Angeles' | 'America/Mexico_City' | 'America/New_York' | 'America/Sao_Paulo' | 'America/Toronto' | 'America/Vancouver' | 'Asia/Bangkok' | 'Asia/Dhaka' | 'Asia/Dubai' | 'Asia/Ho_Chi_Minh' | 'Asia/Hong_Kong' | 'Asia/Istanbul' | 'Asia/Jakarta' | 'Asia/Jerusalem' | 'Asia/Karachi' | 'Asia/Kolkata' | 'Asia/Kuala_Lumpur' | 'Asia/Manila' | 'Asia/Riyadh' | 'Asia/Seoul' | 'Asia/Shanghai' | 'Asia/Taipei' | 'Asia/Tehran' | 'Asia/Tokyo' | 'Australia/Melbourne' | 'Australia/Perth' | 'Australia/Sydney' | 'Europe/Amsterdam' | 'Europe/Athens' | 'Europe/Berlin' | 'Europe/Brussels' | 'Europe/Budapest' | 'Europe/Copenhagen' | 'Europe/Helsinki' | 'Europe/Kyiv' | 'Europe/Lisbon' | 'Europe/London' | 'Europe/Madrid' | 'Europe/Moscow' | 'Europe/Oslo' | 'Europe/Paris' | 'Europe/Prague' | 'Europe/Rome' | 'Europe/Stockholm' | 'Europe/Warsaw' | 'Pacific/Auckland' | 'UTC' | (string & {});
|
|
18
|
+
/**
|
|
19
|
+
* Structure containing arrays of all mentions found in the transcript.
|
|
20
|
+
*/
|
|
21
|
+
export interface ArrayMentions {
|
|
22
|
+
/**
|
|
23
|
+
* An array of mentioned channels.
|
|
24
|
+
*/
|
|
25
|
+
channels: JsonMessageMentionsChannels[];
|
|
26
|
+
/**
|
|
27
|
+
* An array of mentioned roles.
|
|
28
|
+
*/
|
|
29
|
+
roles: JsonMessageMentionsRoles[];
|
|
30
|
+
/**
|
|
31
|
+
* An array of mentioned users.
|
|
32
|
+
*/
|
|
33
|
+
users: JsonMessageMentionsUsers[];
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Represents an object that can be uploaded.
|
|
37
|
+
*/
|
|
38
|
+
export interface Uploadable {
|
|
39
|
+
/**
|
|
40
|
+
* The content to be uploaded.
|
|
41
|
+
*/
|
|
42
|
+
content: string;
|
|
43
|
+
/**
|
|
44
|
+
* The MIME type of the content.
|
|
45
|
+
*/
|
|
46
|
+
contentType: "application/json" | "text/html";
|
|
47
|
+
/**
|
|
48
|
+
* The name of the file.
|
|
49
|
+
*/
|
|
50
|
+
fileName: string;
|
|
51
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An enum-like object for the possible return types, excluding 'attachment'.
|
|
3
|
+
*/
|
|
4
|
+
export declare const ReturnType: {
|
|
5
|
+
/**
|
|
6
|
+
* Returns a `Buffer`.
|
|
7
|
+
*/
|
|
8
|
+
readonly Buffer: "buffer";
|
|
9
|
+
/**
|
|
10
|
+
* Returns a `Stream.Readable`.
|
|
11
|
+
*/
|
|
12
|
+
readonly Stream: "stream";
|
|
13
|
+
/**
|
|
14
|
+
* Returns a `string`.
|
|
15
|
+
*/
|
|
16
|
+
readonly String: "string";
|
|
17
|
+
/**
|
|
18
|
+
* Returns an `Uploadable` object.
|
|
19
|
+
*/
|
|
20
|
+
readonly Uploadable: "uploadable";
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* A type representing the possible values of `ReturnTypeBase`.
|
|
24
|
+
*/
|
|
25
|
+
export type ReturnType = typeof ReturnType[keyof typeof ReturnType];
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* An enum-like object for the possible return types, excluding 'attachment'.
|
|
3
|
+
*/
|
|
4
|
+
export const ReturnType = {
|
|
5
|
+
/**
|
|
6
|
+
* Returns a `Buffer`.
|
|
7
|
+
*/
|
|
8
|
+
Buffer: "buffer",
|
|
9
|
+
/**
|
|
10
|
+
* Returns a `Stream.Readable`.
|
|
11
|
+
*/
|
|
12
|
+
Stream: "stream",
|
|
13
|
+
/**
|
|
14
|
+
* Returns a `string`.
|
|
15
|
+
*/
|
|
16
|
+
String: "string",
|
|
17
|
+
/**
|
|
18
|
+
* Returns an `Uploadable` object.
|
|
19
|
+
*/
|
|
20
|
+
Uploadable: "uploadable"
|
|
21
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ReturnType } from "./return.js";
|
|
2
|
+
/**
|
|
3
|
+
* Options for converting a JSON transcript to HTML.
|
|
4
|
+
*/
|
|
5
|
+
export type ConvertTranscriptOptions<T extends ReturnType> = Partial<{
|
|
6
|
+
/**
|
|
7
|
+
* The desired output type for the transcript.
|
|
8
|
+
* - ReturnType.String - The transcript content as a string.
|
|
9
|
+
* - ReturnType.Buffer - The transcript content as a `Buffer`.
|
|
10
|
+
* - ReturnType.Stream - The transcript content as a `Stream`.
|
|
11
|
+
* - ReturnType.Uploadable` - An object with `content`, `contentType` and `fileName`.
|
|
12
|
+
* @default ReturnType.String
|
|
13
|
+
*/
|
|
14
|
+
returnType: T;
|
|
15
|
+
/**
|
|
16
|
+
* Whether the generated HTML should be self-contained (CSS and JS in HTML).
|
|
17
|
+
* @default false
|
|
18
|
+
*/
|
|
19
|
+
selfContained: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* If you want to include the watermark.
|
|
22
|
+
* @default true
|
|
23
|
+
*/
|
|
24
|
+
watermark: boolean;
|
|
25
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "discord-message-transcript-base",
|
|
3
|
-
"version": "1.3.2-dev.
|
|
3
|
+
"version": "1.3.2-dev.1.50",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
".": {
|
|
9
9
|
"types": "./dist/index.d.ts",
|
|
10
10
|
"import": "./dist/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./internal": {
|
|
13
|
+
"types": "./dist/internalIndex.d.ts",
|
|
14
|
+
"import": "./dist/internalIndex.js"
|
|
11
15
|
}
|
|
12
16
|
},
|
|
13
17
|
"files": [
|
|
@@ -33,6 +37,6 @@
|
|
|
33
37
|
},
|
|
34
38
|
"scripts": {
|
|
35
39
|
"clean": "rimraf dist",
|
|
36
|
-
"build": "pnpm run clean && node scripts/updateHashTranscript.js && tsc -
|
|
40
|
+
"build": "pnpm run clean && node scripts/updateHashTranscript.js && tsc && tsc-alias && node scripts/copy.js"
|
|
37
41
|
}
|
|
38
42
|
}
|