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.
- package/LICENSE +201 -0
- package/dist/core/clientManager.d.ts +3 -0
- package/dist/core/clientManager.js +9 -0
- package/dist/core/componentHelpers.d.ts +3 -0
- package/dist/core/componentHelpers.js +175 -0
- package/dist/core/componentToJson.d.ts +3 -0
- package/dist/core/componentToJson.js +174 -0
- package/dist/core/error.d.ts +3 -0
- package/dist/core/error.js +7 -0
- package/dist/core/fetchMessages.d.ts +7 -0
- package/dist/core/fetchMessages.js +169 -0
- package/dist/core/getMentions.d.ts +3 -0
- package/dist/core/getMentions.js +99 -0
- package/dist/core/imageToBase64.d.ts +1 -0
- package/dist/core/imageToBase64.js +30 -0
- package/dist/core/mappers.d.ts +8 -0
- package/dist/core/mappers.js +101 -0
- package/dist/core/markdown.d.ts +2 -0
- package/dist/core/markdown.js +175 -0
- package/dist/core/output.d.ts +4 -0
- package/dist/core/output.js +28 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +120 -0
- package/dist/renderers/html/clientRenderer.d.ts +0 -0
- package/dist/renderers/html/clientRenderer.js +73 -0
- package/dist/renderers/html/css.d.ts +11 -0
- package/dist/renderers/html/css.js +663 -0
- package/dist/renderers/html/html copy.d.ts +19 -0
- package/dist/renderers/html/html copy.js +371 -0
- package/dist/renderers/html/html-backup.d.ts +19 -0
- package/dist/renderers/html/html-backup.js +371 -0
- package/dist/renderers/html/html.d.ts +19 -0
- package/dist/renderers/html/html.js +415 -0
- package/dist/renderers/html/html2.d.ts +8 -0
- package/dist/renderers/html/html2.js +233 -0
- package/dist/renderers/html/js.d.ts +4 -0
- package/dist/renderers/html/js.js +174 -0
- package/dist/renderers/json/json.d.ts +16 -0
- package/dist/renderers/json/json.js +55 -0
- package/dist/types/types copy.d.ts +284 -0
- package/dist/types/types copy.js +35 -0
- package/dist/types/types.d.ts +137 -0
- package/dist/types/types.js +7 -0
- package/package.json +45 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
export function script(options) {
|
|
2
|
+
return `
|
|
3
|
+
document.addEventListener('DOMContentLoaded', () => {
|
|
4
|
+
const transcriptDataElement = document.getElementById('authorData');
|
|
5
|
+
if (!transcriptDataElement) {
|
|
6
|
+
console.error('Missing author data element.');
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const data = JSON.parse(transcriptDataElement.textContent);
|
|
11
|
+
const authorMap = new Map((data.authors || []).map(author => [author.id, author]));
|
|
12
|
+
|
|
13
|
+
document.querySelectorAll('.messageDiv[data-author-id]').forEach(messageDiv => {
|
|
14
|
+
const authorId = messageDiv.dataset.authorId;
|
|
15
|
+
const author = authorMap.get(authorId);
|
|
16
|
+
|
|
17
|
+
if (!author) return;
|
|
18
|
+
|
|
19
|
+
const avatarImg = messageDiv.querySelector('.messageImg');
|
|
20
|
+
if (avatarImg) avatarImg.src = author.avatarURL;
|
|
21
|
+
|
|
22
|
+
const username = messageDiv.querySelector('.messageUsername');
|
|
23
|
+
if (username) {
|
|
24
|
+
username.textContent = author.member?.displayName ?? author.displayName;
|
|
25
|
+
username.style.color = author.member?.displayHexColor ?? '#dbdee1';
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const badgesDiv = messageDiv.querySelector('.badges');
|
|
29
|
+
if (badgesDiv) {
|
|
30
|
+
badgesDiv.innerHTML = '';
|
|
31
|
+
if (author.bot) {
|
|
32
|
+
const badge = document.createElement('p');
|
|
33
|
+
badge.className = 'badge';
|
|
34
|
+
badge.textContent = 'APP';
|
|
35
|
+
badgesDiv.appendChild(badge);
|
|
36
|
+
}
|
|
37
|
+
if (author.system) {
|
|
38
|
+
const badge = document.createElement('p');
|
|
39
|
+
badge.className = 'badge';
|
|
40
|
+
badge.textContent = 'SYSTEM';
|
|
41
|
+
badgesDiv.appendChild(badge);
|
|
42
|
+
}
|
|
43
|
+
if (author.guildTag) {
|
|
44
|
+
const badge = document.createElement('p');
|
|
45
|
+
badge.className = 'badgeTag';
|
|
46
|
+
badge.textContent = author.guildTag;
|
|
47
|
+
badgesDiv.appendChild(badge);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
document.querySelectorAll('.messageReply[data-id]').forEach(replyDiv => {
|
|
53
|
+
const repliedToId = replyDiv.dataset.id;
|
|
54
|
+
if (!repliedToId) return;
|
|
55
|
+
|
|
56
|
+
const repliedToMessageDiv = document.getElementById(repliedToId);
|
|
57
|
+
if (!repliedToMessageDiv) return;
|
|
58
|
+
|
|
59
|
+
const repliedToAuthorId = repliedToMessageDiv.dataset.authorId;
|
|
60
|
+
const repliedToAuthor = authorMap.get(repliedToAuthorId);
|
|
61
|
+
|
|
62
|
+
if (repliedToAuthor) {
|
|
63
|
+
const replyImg = replyDiv.querySelector('.messageReplyImg');
|
|
64
|
+
if (replyImg) replyImg.src = repliedToAuthor.avatarURL;
|
|
65
|
+
|
|
66
|
+
const replyBadgesDiv = replyDiv.querySelector('.replyBadges');
|
|
67
|
+
if (replyBadgesDiv) {
|
|
68
|
+
replyBadgesDiv.innerHTML = '';
|
|
69
|
+
if (repliedToAuthor.bot) {
|
|
70
|
+
const badge = document.createElement('p');
|
|
71
|
+
badge.className = 'badge';
|
|
72
|
+
badge.textContent = 'APP';
|
|
73
|
+
replyBadgesDiv.appendChild(badge);
|
|
74
|
+
}
|
|
75
|
+
if (repliedToAuthor.system) {
|
|
76
|
+
const badge = document.createElement('p');
|
|
77
|
+
badge.className = 'badge';
|
|
78
|
+
badge.textContent = 'SYSTEM';
|
|
79
|
+
replyBadgesDiv.appendChild(badge);
|
|
80
|
+
}
|
|
81
|
+
if (repliedToAuthor.guildTag) {
|
|
82
|
+
const badge = document.createElement('p');
|
|
83
|
+
badge.className = 'badgeTag';
|
|
84
|
+
badge.textContent = repliedToAuthor.guildTag;
|
|
85
|
+
replyBadgesDiv.appendChild(badge);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const replyTextDiv = replyDiv.querySelector('.messageReplyText');
|
|
91
|
+
if (replyTextDiv) {
|
|
92
|
+
const originalContent = repliedToMessageDiv.querySelector('.messageContent');
|
|
93
|
+
if (originalContent) {
|
|
94
|
+
let content = originalContent.textContent || '';
|
|
95
|
+
if (content.length > 100) {
|
|
96
|
+
content = content.substring(0, 100).trim() + '...';
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const authorName = repliedToAuthor?.member?.displayName ?? repliedToAuthor?.displayName ?? 'Unknown';
|
|
100
|
+
const authorColor = repliedToAuthor?.member?.displayHexColor ?? 'inherit';
|
|
101
|
+
|
|
102
|
+
const authorNameSpan = \`<span style="color: \${authorColor};">\${authorName}</span>\`;
|
|
103
|
+
replyTextDiv.innerHTML = authorNameSpan + " " + content;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
document.addEventListener('click', function (event) {
|
|
109
|
+
const spoiler = event.target.closest('.spoilerMsg, .spoilerAttachment');
|
|
110
|
+
if (spoiler && !spoiler.classList.contains('revealed')) {
|
|
111
|
+
event.preventDefault();
|
|
112
|
+
event.stopPropagation();
|
|
113
|
+
spoiler.classList.add('revealed');
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const replyDiv = event.target.closest('.messageReply');
|
|
117
|
+
if (replyDiv) {
|
|
118
|
+
event.preventDefault();
|
|
119
|
+
const messageId = replyDiv.dataset.id;
|
|
120
|
+
if (!messageId) return;
|
|
121
|
+
|
|
122
|
+
const message = document.getElementById(messageId);
|
|
123
|
+
if (message) {
|
|
124
|
+
message.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
|
125
|
+
message.classList.add('highlight');
|
|
126
|
+
setTimeout(() => {
|
|
127
|
+
message.classList.remove('highlight');
|
|
128
|
+
}, 1500);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
${options.includeComponents ? SELECTOR_JS : ""}
|
|
133
|
+
|
|
134
|
+
${options.includePolls ? POLL_JS : ""}
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
if (window.hljs) {
|
|
138
|
+
hljs.highlightAll();
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
`;
|
|
142
|
+
}
|
|
143
|
+
export const POLL_JS = `
|
|
144
|
+
const pollDiv = event.target.closest('.pollResultEmbedButton');
|
|
145
|
+
if (pollDiv) {
|
|
146
|
+
event.preventDefault();
|
|
147
|
+
const messageId = pollDiv.dataset.id;
|
|
148
|
+
if (!messageId || messageId == "") return;
|
|
149
|
+
const message = document.getElementById(messageId);
|
|
150
|
+
|
|
151
|
+
if (message) {
|
|
152
|
+
message.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
|
153
|
+
message.classList.add('highlight');
|
|
154
|
+
setTimeout(() => {
|
|
155
|
+
message.classList.remove('highlight');
|
|
156
|
+
}, 1500);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
`;
|
|
160
|
+
export const SELECTOR_JS = `
|
|
161
|
+
const selectorInput = event.target.closest('.selectorInput');
|
|
162
|
+
document.querySelectorAll('.selector').forEach(selector => {
|
|
163
|
+
if (!selector.contains(event.target)) {
|
|
164
|
+
selector.classList.remove('active');
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
if (selectorInput) {
|
|
169
|
+
const selector = selectorInput.closest('.selector');
|
|
170
|
+
if (selector) {
|
|
171
|
+
selector.classList.toggle('active');
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
`;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Guild, TextBasedChannel } from "discord.js";
|
|
2
|
+
import { ArrayMentions, JsonAuthor, JsonMessage, TranscriptOptionsBase, JsonData } from "discord-message-transcript-base";
|
|
3
|
+
export declare class Json {
|
|
4
|
+
guild: Guild | null;
|
|
5
|
+
channel: TextBasedChannel;
|
|
6
|
+
authors: JsonAuthor[];
|
|
7
|
+
messages: JsonMessage[];
|
|
8
|
+
options: TranscriptOptionsBase;
|
|
9
|
+
mentions: ArrayMentions;
|
|
10
|
+
constructor(guild: Guild | null, channel: TextBasedChannel, options: TranscriptOptionsBase);
|
|
11
|
+
addMessages(messages: JsonMessage[]): void;
|
|
12
|
+
sliceMessages(size: number): void;
|
|
13
|
+
setAuthors(authors: JsonAuthor[]): void;
|
|
14
|
+
setMentions(mentions: ArrayMentions): void;
|
|
15
|
+
toJson(): Promise<JsonData>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { BaseGuildTextChannel, DMChannel } from "discord.js";
|
|
2
|
+
export class Json {
|
|
3
|
+
guild;
|
|
4
|
+
channel;
|
|
5
|
+
authors;
|
|
6
|
+
messages;
|
|
7
|
+
options;
|
|
8
|
+
mentions;
|
|
9
|
+
constructor(guild, channel, options) {
|
|
10
|
+
this.guild = guild;
|
|
11
|
+
this.channel = channel;
|
|
12
|
+
this.messages = [];
|
|
13
|
+
this.options = options;
|
|
14
|
+
this.authors = [];
|
|
15
|
+
this.mentions = { channels: [], roles: [], users: [] };
|
|
16
|
+
}
|
|
17
|
+
addMessages(messages) {
|
|
18
|
+
this.messages.push(...messages);
|
|
19
|
+
}
|
|
20
|
+
sliceMessages(size) {
|
|
21
|
+
if (size > this.messages.length || size == 0) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
this.messages = this.messages.slice(0, size - 1);
|
|
25
|
+
}
|
|
26
|
+
setAuthors(authors) {
|
|
27
|
+
this.authors = authors;
|
|
28
|
+
}
|
|
29
|
+
setMentions(mentions) {
|
|
30
|
+
this.mentions = mentions;
|
|
31
|
+
}
|
|
32
|
+
async toJson() {
|
|
33
|
+
const channel = await this.channel.fetch();
|
|
34
|
+
const guild = !channel.isDMBased() ? this.guild : null;
|
|
35
|
+
const guildJson = !guild ? null : {
|
|
36
|
+
name: guild.name,
|
|
37
|
+
id: guild.id,
|
|
38
|
+
icon: guild.iconURL(),
|
|
39
|
+
};
|
|
40
|
+
return {
|
|
41
|
+
options: this.options,
|
|
42
|
+
guild: guildJson,
|
|
43
|
+
channel: {
|
|
44
|
+
name: channel instanceof DMChannel ? channel.recipient?.displayName ?? "DM" : channel.isDMBased() ? channel.name ?? channel.recipients.join(", ") : channel.name,
|
|
45
|
+
parent: channel.isDMBased() ? null : (channel.parent ? { name: channel.parent.name, id: channel.parent.id } : null),
|
|
46
|
+
topic: (channel instanceof BaseGuildTextChannel) ? channel.topic : null,
|
|
47
|
+
id: channel.id,
|
|
48
|
+
img: channel instanceof DMChannel ? channel.recipient?.displayAvatarURL() ?? "cdn.discordapp.com/embed/avatars/4.png" : channel.isDMBased() ? channel.iconURL() ?? (await channel.fetchOwner()).displayAvatarURL() : null,
|
|
49
|
+
},
|
|
50
|
+
authors: this.authors,
|
|
51
|
+
messages: this.messages.reverse(),
|
|
52
|
+
mentions: this.mentions
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
export type ReturnFormat = "HTML" | "JSON";
|
|
2
|
+
export type ReturnType = "string" | "attachment" | "uploadable" | "stream" | "buffer";
|
|
3
|
+
export type StyleTimeStampKey = "t" | "T" | "d" | "D" | "f" | "F";
|
|
4
|
+
export interface CreateTranscriptOptions {
|
|
5
|
+
fileName?: string;
|
|
6
|
+
includeAttachments?: boolean;
|
|
7
|
+
includeButtons?: boolean;
|
|
8
|
+
includeComponents?: boolean;
|
|
9
|
+
includeEmpty?: boolean;
|
|
10
|
+
includeEmbeds?: boolean;
|
|
11
|
+
includePolls?: boolean;
|
|
12
|
+
includeReactions?: boolean;
|
|
13
|
+
includeV2Components?: boolean;
|
|
14
|
+
localDate?: Locale;
|
|
15
|
+
quantity?: number;
|
|
16
|
+
returnFormat?: ReturnFormat;
|
|
17
|
+
returnType?: ReturnType;
|
|
18
|
+
saveImages?: boolean;
|
|
19
|
+
timeZone?: TimeZone;
|
|
20
|
+
}
|
|
21
|
+
export interface TranscriptOptions {
|
|
22
|
+
fileName: string;
|
|
23
|
+
includeAttachments: boolean;
|
|
24
|
+
includeButtons: boolean;
|
|
25
|
+
includeComponents: boolean;
|
|
26
|
+
includeEmpty: boolean;
|
|
27
|
+
includeEmbeds: boolean;
|
|
28
|
+
includePolls: boolean;
|
|
29
|
+
includeReactions: boolean;
|
|
30
|
+
includeV2Components: boolean;
|
|
31
|
+
localDate: Locale;
|
|
32
|
+
quantity: number;
|
|
33
|
+
returnFormat: ReturnFormat;
|
|
34
|
+
returnType: ReturnType;
|
|
35
|
+
saveImages: boolean;
|
|
36
|
+
timeZone: TimeZone;
|
|
37
|
+
}
|
|
38
|
+
export interface Uploadable {
|
|
39
|
+
content: string;
|
|
40
|
+
contentType: "application/json" | "text/html";
|
|
41
|
+
fileName: string;
|
|
42
|
+
}
|
|
43
|
+
export interface JsonMessage {
|
|
44
|
+
attachments: JsonAttachment[];
|
|
45
|
+
authorId: string;
|
|
46
|
+
components: JsonTopLevelComponent[];
|
|
47
|
+
content: string;
|
|
48
|
+
createdTimestamp: number;
|
|
49
|
+
embeds: JsonEmbed[];
|
|
50
|
+
id: string;
|
|
51
|
+
mentions: JsonMessageMentions;
|
|
52
|
+
poll: JsonPoll | null;
|
|
53
|
+
reactions: JsonReaction[];
|
|
54
|
+
references: {
|
|
55
|
+
messageId: string | null;
|
|
56
|
+
} | null;
|
|
57
|
+
system: boolean;
|
|
58
|
+
}
|
|
59
|
+
export interface JsonReaction {
|
|
60
|
+
count: number;
|
|
61
|
+
emoji: string;
|
|
62
|
+
}
|
|
63
|
+
export interface JsonPoll {
|
|
64
|
+
answers: JsonPollAnswer[];
|
|
65
|
+
expiry: number | null;
|
|
66
|
+
isFinalized: boolean;
|
|
67
|
+
question: string;
|
|
68
|
+
}
|
|
69
|
+
export interface JsonPollAnswer {
|
|
70
|
+
count: number;
|
|
71
|
+
emoji: {
|
|
72
|
+
id: string | null;
|
|
73
|
+
name: string | null;
|
|
74
|
+
animated: boolean;
|
|
75
|
+
} | null;
|
|
76
|
+
id: number;
|
|
77
|
+
text: string;
|
|
78
|
+
}
|
|
79
|
+
export interface JsonAttachment {
|
|
80
|
+
contentType: string | null;
|
|
81
|
+
name: string;
|
|
82
|
+
size: number;
|
|
83
|
+
spoiler: boolean;
|
|
84
|
+
url: string;
|
|
85
|
+
}
|
|
86
|
+
export interface JsonEmbed {
|
|
87
|
+
author: {
|
|
88
|
+
name: string;
|
|
89
|
+
url: string | null;
|
|
90
|
+
iconURL: string | null;
|
|
91
|
+
} | null;
|
|
92
|
+
description: string | null;
|
|
93
|
+
fields: {
|
|
94
|
+
inline: boolean | null;
|
|
95
|
+
name: string;
|
|
96
|
+
value: string;
|
|
97
|
+
}[];
|
|
98
|
+
footer: {
|
|
99
|
+
iconURL: string | null;
|
|
100
|
+
text: string;
|
|
101
|
+
} | null;
|
|
102
|
+
hexColor: string | null;
|
|
103
|
+
image: {
|
|
104
|
+
url: string;
|
|
105
|
+
} | null;
|
|
106
|
+
thumbnail: {
|
|
107
|
+
url: string;
|
|
108
|
+
} | null;
|
|
109
|
+
timestamp: string | null;
|
|
110
|
+
title: string | null;
|
|
111
|
+
type: string;
|
|
112
|
+
url: string | null;
|
|
113
|
+
}
|
|
114
|
+
export interface JsonMessageMentions {
|
|
115
|
+
channels: {
|
|
116
|
+
id: string;
|
|
117
|
+
name: string | null;
|
|
118
|
+
}[];
|
|
119
|
+
everyone: boolean;
|
|
120
|
+
roles: {
|
|
121
|
+
id: string;
|
|
122
|
+
name: string;
|
|
123
|
+
color: string;
|
|
124
|
+
}[];
|
|
125
|
+
users: {
|
|
126
|
+
id: string;
|
|
127
|
+
name: string;
|
|
128
|
+
color: string | null;
|
|
129
|
+
}[];
|
|
130
|
+
}
|
|
131
|
+
export type JsonTopLevelComponent = JsonActionRow | JsonButtonComponent | JsonSelectMenu | JsonV2Component;
|
|
132
|
+
export interface JsonActionRow {
|
|
133
|
+
components: (JsonButtonComponent | JsonSelectMenu)[];
|
|
134
|
+
type: JsonComponentType.ActionRow;
|
|
135
|
+
}
|
|
136
|
+
export interface JsonButtonComponent {
|
|
137
|
+
disabled: boolean;
|
|
138
|
+
emoji: {
|
|
139
|
+
id: string | null;
|
|
140
|
+
name: string | null;
|
|
141
|
+
animated: boolean;
|
|
142
|
+
} | null;
|
|
143
|
+
label: string | null;
|
|
144
|
+
style: JsonButtonStyle;
|
|
145
|
+
type: JsonComponentType.Button;
|
|
146
|
+
url: string | null;
|
|
147
|
+
}
|
|
148
|
+
export type JsonSelectMenu = JsonSelectMenuOthers | JsonSelectMenuString;
|
|
149
|
+
interface JsonSelectMenuOthers {
|
|
150
|
+
disabled: boolean;
|
|
151
|
+
placeholder: string | null;
|
|
152
|
+
type: JsonComponentType.UserSelect | JsonComponentType.RoleSelect | JsonComponentType.MentionableSelect | JsonComponentType.ChannelSelect;
|
|
153
|
+
}
|
|
154
|
+
interface JsonSelectMenuString {
|
|
155
|
+
disabled: boolean;
|
|
156
|
+
options: JsonSelectOption[];
|
|
157
|
+
placeholder: string | null;
|
|
158
|
+
type: JsonComponentType.StringSelect;
|
|
159
|
+
}
|
|
160
|
+
export interface JsonSelectOption {
|
|
161
|
+
description: string | null;
|
|
162
|
+
emoji: {
|
|
163
|
+
id: string | null;
|
|
164
|
+
name: string | null;
|
|
165
|
+
animated: boolean;
|
|
166
|
+
} | null;
|
|
167
|
+
label: string;
|
|
168
|
+
}
|
|
169
|
+
export type JsonV2Component = JsonContainerComponent | JsonFileComponent | JsonMediaGalleryComponent | JsonSectionComponent | JsonSeparatorComponent | JsonTextDisplayComponent | JsonThumbnailComponent;
|
|
170
|
+
export type JsonComponentInContainer = JsonActionRow | JsonFileComponent | JsonMediaGalleryComponent | JsonSectionComponent | JsonSeparatorComponent | JsonTextDisplayComponent;
|
|
171
|
+
export interface JsonContainerComponent {
|
|
172
|
+
components: JsonComponentInContainer[];
|
|
173
|
+
hexAccentColor: string | null;
|
|
174
|
+
spoiler: boolean;
|
|
175
|
+
type: JsonComponentType.Container;
|
|
176
|
+
}
|
|
177
|
+
export interface JsonFileComponent {
|
|
178
|
+
fileName: string | null;
|
|
179
|
+
size: number;
|
|
180
|
+
spoiler: boolean;
|
|
181
|
+
type: JsonComponentType.File;
|
|
182
|
+
url: string;
|
|
183
|
+
}
|
|
184
|
+
export interface JsonMediaGalleryComponent {
|
|
185
|
+
items: {
|
|
186
|
+
media: {
|
|
187
|
+
url: string;
|
|
188
|
+
};
|
|
189
|
+
spoiler: boolean;
|
|
190
|
+
}[];
|
|
191
|
+
type: JsonComponentType.MediaGallery;
|
|
192
|
+
}
|
|
193
|
+
export interface JsonSectionComponent {
|
|
194
|
+
accessory: JsonButtonComponent | JsonThumbnailComponent;
|
|
195
|
+
components: JsonTextDisplayComponent[];
|
|
196
|
+
type: JsonComponentType.Section;
|
|
197
|
+
}
|
|
198
|
+
export interface JsonSeparatorComponent {
|
|
199
|
+
divider: boolean;
|
|
200
|
+
spacing: JsonSeparatorSpacingSize | null;
|
|
201
|
+
type: JsonComponentType.Separator;
|
|
202
|
+
}
|
|
203
|
+
export interface JsonTextDisplayComponent {
|
|
204
|
+
content: string;
|
|
205
|
+
type: JsonComponentType.TextDisplay;
|
|
206
|
+
}
|
|
207
|
+
export interface JsonThumbnailComponent {
|
|
208
|
+
media: {
|
|
209
|
+
url: string;
|
|
210
|
+
};
|
|
211
|
+
spoiler: boolean;
|
|
212
|
+
type: JsonComponentType.Thumbnail;
|
|
213
|
+
}
|
|
214
|
+
export interface JsonData {
|
|
215
|
+
authors: JsonAuthor[];
|
|
216
|
+
channel: JsonDataChannel;
|
|
217
|
+
guild: JsonDataGuild | null;
|
|
218
|
+
messages: JsonMessage[];
|
|
219
|
+
options: TranscriptOptions;
|
|
220
|
+
}
|
|
221
|
+
export interface JsonAuthor {
|
|
222
|
+
avatarURL: string;
|
|
223
|
+
bot: boolean;
|
|
224
|
+
displayName: string;
|
|
225
|
+
guildTag: string | null;
|
|
226
|
+
id: string;
|
|
227
|
+
member: {
|
|
228
|
+
displayHexColor: string;
|
|
229
|
+
displayName: string;
|
|
230
|
+
} | null;
|
|
231
|
+
system: boolean;
|
|
232
|
+
}
|
|
233
|
+
export interface JsonDataGuild {
|
|
234
|
+
icon: string | null;
|
|
235
|
+
id: string;
|
|
236
|
+
name: string;
|
|
237
|
+
}
|
|
238
|
+
export interface JsonDataChannel {
|
|
239
|
+
id: string;
|
|
240
|
+
img: string | null;
|
|
241
|
+
name: string;
|
|
242
|
+
parent: {
|
|
243
|
+
name: string;
|
|
244
|
+
id: string;
|
|
245
|
+
} | null;
|
|
246
|
+
topic: string | null;
|
|
247
|
+
}
|
|
248
|
+
export type Locale = CommonLocales | (string & {});
|
|
249
|
+
export type TimeZone = CommonTimeZones | (string & {});
|
|
250
|
+
type CommonLocales = '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';
|
|
251
|
+
type CommonTimeZones = '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';
|
|
252
|
+
export declare enum JsonComponentType {
|
|
253
|
+
ActionRow = 1,
|
|
254
|
+
Button = 2,
|
|
255
|
+
StringSelect = 3,
|
|
256
|
+
TextInput = 4,
|
|
257
|
+
UserSelect = 5,
|
|
258
|
+
RoleSelect = 6,
|
|
259
|
+
MentionableSelect = 7,
|
|
260
|
+
ChannelSelect = 8,
|
|
261
|
+
Section = 9,
|
|
262
|
+
TextDisplay = 10,
|
|
263
|
+
Thumbnail = 11,
|
|
264
|
+
MediaGallery = 12,
|
|
265
|
+
File = 13,
|
|
266
|
+
Separator = 14,
|
|
267
|
+
ContentInventoryEntry = 16,
|
|
268
|
+
Container = 17,
|
|
269
|
+
Label = 18,
|
|
270
|
+
FileUpload = 19
|
|
271
|
+
}
|
|
272
|
+
export declare enum JsonSeparatorSpacingSize {
|
|
273
|
+
Small = 1,
|
|
274
|
+
Large = 2
|
|
275
|
+
}
|
|
276
|
+
export declare enum JsonButtonStyle {
|
|
277
|
+
Primary = 1,
|
|
278
|
+
Secondary = 2,
|
|
279
|
+
Success = 3,
|
|
280
|
+
Danger = 4,
|
|
281
|
+
Link = 5,
|
|
282
|
+
Premium = 6
|
|
283
|
+
}
|
|
284
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export var JsonComponentType;
|
|
2
|
+
(function (JsonComponentType) {
|
|
3
|
+
JsonComponentType[JsonComponentType["ActionRow"] = 1] = "ActionRow";
|
|
4
|
+
JsonComponentType[JsonComponentType["Button"] = 2] = "Button";
|
|
5
|
+
JsonComponentType[JsonComponentType["StringSelect"] = 3] = "StringSelect";
|
|
6
|
+
JsonComponentType[JsonComponentType["TextInput"] = 4] = "TextInput";
|
|
7
|
+
JsonComponentType[JsonComponentType["UserSelect"] = 5] = "UserSelect";
|
|
8
|
+
JsonComponentType[JsonComponentType["RoleSelect"] = 6] = "RoleSelect";
|
|
9
|
+
JsonComponentType[JsonComponentType["MentionableSelect"] = 7] = "MentionableSelect";
|
|
10
|
+
JsonComponentType[JsonComponentType["ChannelSelect"] = 8] = "ChannelSelect";
|
|
11
|
+
JsonComponentType[JsonComponentType["Section"] = 9] = "Section";
|
|
12
|
+
JsonComponentType[JsonComponentType["TextDisplay"] = 10] = "TextDisplay";
|
|
13
|
+
JsonComponentType[JsonComponentType["Thumbnail"] = 11] = "Thumbnail";
|
|
14
|
+
JsonComponentType[JsonComponentType["MediaGallery"] = 12] = "MediaGallery";
|
|
15
|
+
JsonComponentType[JsonComponentType["File"] = 13] = "File";
|
|
16
|
+
JsonComponentType[JsonComponentType["Separator"] = 14] = "Separator";
|
|
17
|
+
JsonComponentType[JsonComponentType["ContentInventoryEntry"] = 16] = "ContentInventoryEntry";
|
|
18
|
+
JsonComponentType[JsonComponentType["Container"] = 17] = "Container";
|
|
19
|
+
JsonComponentType[JsonComponentType["Label"] = 18] = "Label";
|
|
20
|
+
JsonComponentType[JsonComponentType["FileUpload"] = 19] = "FileUpload";
|
|
21
|
+
})(JsonComponentType || (JsonComponentType = {}));
|
|
22
|
+
export var JsonSeparatorSpacingSize;
|
|
23
|
+
(function (JsonSeparatorSpacingSize) {
|
|
24
|
+
JsonSeparatorSpacingSize[JsonSeparatorSpacingSize["Small"] = 1] = "Small";
|
|
25
|
+
JsonSeparatorSpacingSize[JsonSeparatorSpacingSize["Large"] = 2] = "Large";
|
|
26
|
+
})(JsonSeparatorSpacingSize || (JsonSeparatorSpacingSize = {}));
|
|
27
|
+
export var JsonButtonStyle;
|
|
28
|
+
(function (JsonButtonStyle) {
|
|
29
|
+
JsonButtonStyle[JsonButtonStyle["Primary"] = 1] = "Primary";
|
|
30
|
+
JsonButtonStyle[JsonButtonStyle["Secondary"] = 2] = "Secondary";
|
|
31
|
+
JsonButtonStyle[JsonButtonStyle["Success"] = 3] = "Success";
|
|
32
|
+
JsonButtonStyle[JsonButtonStyle["Danger"] = 4] = "Danger";
|
|
33
|
+
JsonButtonStyle[JsonButtonStyle["Link"] = 5] = "Link";
|
|
34
|
+
JsonButtonStyle[JsonButtonStyle["Premium"] = 6] = "Premium";
|
|
35
|
+
})(JsonButtonStyle || (JsonButtonStyle = {}));
|