@libstermynal/transcript-v2 3.3.2
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/README.md +134 -0
- package/dist/downloader/images.d.ts +36 -0
- package/dist/downloader/images.js +114 -0
- package/dist/downloader/images.js.map +1 -0
- package/dist/generator/index.d.ts +18 -0
- package/dist/generator/index.js +71 -0
- package/dist/generator/index.js.map +1 -0
- package/dist/generator/renderers/attachment.d.ts +21 -0
- package/dist/generator/renderers/attachment.js +67 -0
- package/dist/generator/renderers/attachment.js.map +1 -0
- package/dist/generator/renderers/components/Button.d.ts +9 -0
- package/dist/generator/renderers/components/Button.js +9 -0
- package/dist/generator/renderers/components/Button.js.map +1 -0
- package/dist/generator/renderers/components/Container.d.ts +5 -0
- package/dist/generator/renderers/components/Container.js +19 -0
- package/dist/generator/renderers/components/Container.js.map +1 -0
- package/dist/generator/renderers/components/DiscordHighlightedCode.d.ts +6 -0
- package/dist/generator/renderers/components/DiscordHighlightedCode.js +199 -0
- package/dist/generator/renderers/components/DiscordHighlightedCode.js.map +1 -0
- package/dist/generator/renderers/components/DiscordImage.d.ts +6 -0
- package/dist/generator/renderers/components/DiscordImage.js +21 -0
- package/dist/generator/renderers/components/DiscordImage.js.map +1 -0
- package/dist/generator/renderers/components/Media Gallery.d.ts +5 -0
- package/dist/generator/renderers/components/Media Gallery.js +32 -0
- package/dist/generator/renderers/components/Media Gallery.js.map +1 -0
- package/dist/generator/renderers/components/Select Menu.d.ts +7 -0
- package/dist/generator/renderers/components/Select Menu.js +31 -0
- package/dist/generator/renderers/components/Select Menu.js.map +1 -0
- package/dist/generator/renderers/components/Spacing.d.ts +6 -0
- package/dist/generator/renderers/components/Spacing.js +14 -0
- package/dist/generator/renderers/components/Spacing.js.map +1 -0
- package/dist/generator/renderers/components/Thumbnail.d.ts +4 -0
- package/dist/generator/renderers/components/Thumbnail.js +13 -0
- package/dist/generator/renderers/components/Thumbnail.js.map +1 -0
- package/dist/generator/renderers/components/TranscriptHeader.d.ts +8 -0
- package/dist/generator/renderers/components/TranscriptHeader.js +13 -0
- package/dist/generator/renderers/components/TranscriptHeader.js.map +1 -0
- package/dist/generator/renderers/components/section/Section.d.ts +9 -0
- package/dist/generator/renderers/components/section/Section.js +19 -0
- package/dist/generator/renderers/components/section/Section.js.map +1 -0
- package/dist/generator/renderers/components/section/SectionAccessory.d.ts +6 -0
- package/dist/generator/renderers/components/section/SectionAccessory.js +16 -0
- package/dist/generator/renderers/components/section/SectionAccessory.js.map +1 -0
- package/dist/generator/renderers/components/section/SectionContent.d.ts +6 -0
- package/dist/generator/renderers/components/section/SectionContent.js +12 -0
- package/dist/generator/renderers/components/section/SectionContent.js.map +1 -0
- package/dist/generator/renderers/components/styles.d.ts +21 -0
- package/dist/generator/renderers/components/styles.js +147 -0
- package/dist/generator/renderers/components/styles.js.map +1 -0
- package/dist/generator/renderers/components/utils.d.ts +36 -0
- package/dist/generator/renderers/components/utils.js +98 -0
- package/dist/generator/renderers/components/utils.js.map +1 -0
- package/dist/generator/renderers/components.d.ts +11 -0
- package/dist/generator/renderers/components.js +65 -0
- package/dist/generator/renderers/components.js.map +1 -0
- package/dist/generator/renderers/content.d.ts +31 -0
- package/dist/generator/renderers/content.js +163 -0
- package/dist/generator/renderers/content.js.map +1 -0
- package/dist/generator/renderers/embed.d.ts +11 -0
- package/dist/generator/renderers/embed.js +44 -0
- package/dist/generator/renderers/embed.js.map +1 -0
- package/dist/generator/renderers/message.d.ts +6 -0
- package/dist/generator/renderers/message.js +59 -0
- package/dist/generator/renderers/message.js.map +1 -0
- package/dist/generator/renderers/reply.d.ts +6 -0
- package/dist/generator/renderers/reply.js +53 -0
- package/dist/generator/renderers/reply.js.map +1 -0
- package/dist/generator/renderers/systemMessage.d.ts +13 -0
- package/dist/generator/renderers/systemMessage.js +115 -0
- package/dist/generator/renderers/systemMessage.js.map +1 -0
- package/dist/generator/transcript.d.ts +9 -0
- package/dist/generator/transcript.js +76 -0
- package/dist/generator/transcript.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.js +138 -0
- package/dist/index.js.map +1 -0
- package/dist/static/client.d.ts +3 -0
- package/dist/static/client.js +31 -0
- package/dist/static/client.js.map +1 -0
- package/dist/types.d.ts +68 -0
- package/dist/types.js +17 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/buildProfiles.d.ts +11 -0
- package/dist/utils/buildProfiles.js +42 -0
- package/dist/utils/buildProfiles.js.map +1 -0
- package/dist/utils/embeds.d.ts +2 -0
- package/dist/utils/embeds.js +17 -0
- package/dist/utils/embeds.js.map +1 -0
- package/dist/utils/extend.d.ts +8 -0
- package/dist/utils/extend.js +8 -0
- package/dist/utils/extend.js.map +1 -0
- package/dist/utils/utils.d.ts +15 -0
- package/dist/utils/utils.js +50 -0
- package/dist/utils/utils.js.map +1 -0
- package/package.json +70 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.DiscordEmbed = DiscordEmbed;
|
|
37
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
|
+
const embeds_1 = require("../../utils/embeds");
|
|
39
|
+
const content_1 = __importStar(require("./content"));
|
|
40
|
+
async function DiscordEmbed({ embed, context }) {
|
|
41
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
42
|
+
return ((0, jsx_runtime_1.jsxs)("discord-embed", { "embed-title": (_a = embed.title) !== null && _a !== void 0 ? _a : undefined, slot: "embeds", "author-image": (_c = (_b = embed.author) === null || _b === void 0 ? void 0 : _b.proxyIconURL) !== null && _c !== void 0 ? _c : (_d = embed.author) === null || _d === void 0 ? void 0 : _d.iconURL, "author-name": (_e = embed.author) === null || _e === void 0 ? void 0 : _e.name, "author-url": (_f = embed.author) === null || _f === void 0 ? void 0 : _f.url, color: (_g = embed.hexColor) !== null && _g !== void 0 ? _g : undefined, image: (_j = (_h = embed.image) === null || _h === void 0 ? void 0 : _h.proxyURL) !== null && _j !== void 0 ? _j : (_k = embed.image) === null || _k === void 0 ? void 0 : _k.url, thumbnail: (_m = (_l = embed.thumbnail) === null || _l === void 0 ? void 0 : _l.proxyURL) !== null && _m !== void 0 ? _m : (_o = embed.thumbnail) === null || _o === void 0 ? void 0 : _o.url, url: (_p = embed.url) !== null && _p !== void 0 ? _p : undefined, children: [embed.description && ((0, jsx_runtime_1.jsx)("discord-embed-description", { slot: "description", children: (0, jsx_runtime_1.jsx)(content_1.default, { content: embed.description, context: Object.assign(Object.assign({}, context), { type: content_1.RenderType.EMBED }) }) })), embed.fields.length > 0 && ((0, jsx_runtime_1.jsx)("discord-embed-fields", { slot: "fields", children: embed.fields.map(async (field, id) => ((0, jsx_runtime_1.jsx)("discord-embed-field", { "field-title": field.name, inline: !!field.inline, "inline-index": field.inline ? (0, embeds_1.calculateInlineIndex)(embed.fields, id) : undefined, children: (0, jsx_runtime_1.jsx)(content_1.default, { content: field.value, context: Object.assign(Object.assign({}, context), { type: content_1.RenderType.EMBED }) }) }, `${context.message.id}-e-${context.index}-f-${id}`))) })), embed.footer && ((0, jsx_runtime_1.jsx)("discord-embed-footer", { slot: "footer", footerImage: (_q = embed.footer.proxyIconURL) !== null && _q !== void 0 ? _q : embed.footer.iconURL, timestamp: (_r = embed.timestamp) !== null && _r !== void 0 ? _r : undefined, children: embed.footer.text }))] }, `${context.message.id}-e-${context.index}`));
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=embed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embed.js","sourceRoot":"","sources":["../../../src/generator/renderers/embed.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,oCAiDC;;AAzDD,+CAA0D;AAC1D,qDAAuD;AAOhD,KAAK,UAAU,YAAY,CAAC,EAAE,KAAK,EAAE,OAAO,EAAiD;;IAClG,OAAO,CACL,0DACe,MAAA,KAAK,CAAC,KAAK,mCAAI,SAAS,EACrC,IAAI,EAAC,QAAQ,kBAEC,MAAA,MAAA,KAAK,CAAC,MAAM,0CAAE,YAAY,mCAAI,MAAA,KAAK,CAAC,MAAM,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,CACvB,CAAC,GACmB,CACxB,EAGA,KAAK,CAAC,MAAM,IAAI,CACf,iDACE,IAAI,EAAC,QAAQ,EACb,WAAW,EAAE,MAAA,KAAK,CAAC,MAAM,CAAC,YAAY,mCAAI,KAAK,CAAC,MAAM,CAAC,OAAO,EAC9D,SAAS,EAAE,MAAA,KAAK,CAAC,SAAS,mCAAI,SAAS,YAEtC,KAAK,CAAC,MAAM,CAAC,IAAI,GACG,CACxB,KAzCI,GAAG,OAAO,CAAC,OAAO,CAAC,EAAE,MAAM,OAAO,CAAC,KAAK,EAAE,CA0CjC,CACjB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Message as MessageType } from 'discord.js';
|
|
2
|
+
import type { RenderMessageContext } from '..';
|
|
3
|
+
export default function DiscordMessage({ message, context, }: {
|
|
4
|
+
message: MessageType;
|
|
5
|
+
context: RenderMessageContext;
|
|
6
|
+
}): Promise<import("react/jsx-runtime").JSX.Element>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.default = DiscordMessage;
|
|
40
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
41
|
+
const utils_1 = require("../../utils/utils");
|
|
42
|
+
const attachment_1 = require("./attachment");
|
|
43
|
+
const components_1 = __importDefault(require("./components"));
|
|
44
|
+
const content_1 = __importStar(require("./content"));
|
|
45
|
+
const embed_1 = require("./embed");
|
|
46
|
+
const reply_1 = __importDefault(require("./reply"));
|
|
47
|
+
const systemMessage_1 = __importDefault(require("./systemMessage"));
|
|
48
|
+
async function DiscordMessage({ message, context, }) {
|
|
49
|
+
var _a;
|
|
50
|
+
if (message.system)
|
|
51
|
+
return (0, jsx_runtime_1.jsx)(systemMessage_1.default, { message: message });
|
|
52
|
+
const isCrosspost = message.reference && message.reference.guildId !== ((_a = message.guild) === null || _a === void 0 ? void 0 : _a.id);
|
|
53
|
+
return ((0, jsx_runtime_1.jsxs)("discord-message", { id: `m-${message.id}`, timestamp: message.createdAt, edited: message.editedAt !== null, server: isCrosspost !== null && isCrosspost !== void 0 ? isCrosspost : undefined, highlight: message.mentions.everyone, profile: message.author.id, children: [(0, jsx_runtime_1.jsx)(reply_1.default, { message: message, context: context }), message.interaction && ((0, jsx_runtime_1.jsx)("discord-command", { slot: "reply", profile: message.interaction.user.id, command: '/' + message.interaction.commandName })), message.content && ((0, jsx_runtime_1.jsx)(content_1.default, { content: message.content, context: Object.assign(Object.assign({}, context), { type: message.webhookId ? content_1.RenderType.WEBHOOK : content_1.RenderType.NORMAL }) })), (0, jsx_runtime_1.jsx)(attachment_1.Attachments, { message: message, context: context }), message.embeds.map((embed, id) => ((0, jsx_runtime_1.jsx)(embed_1.DiscordEmbed, { embed: embed, context: Object.assign(Object.assign({}, context), { index: id, message }) }, id))), message.components.length > 0 && ((0, jsx_runtime_1.jsx)("discord-attachments", { slot: "components", children: message.components.map((component, id) => ((0, jsx_runtime_1.jsx)(components_1.default, { id: id, component: component, context: context }, id))) })), message.reactions.cache.size > 0 && ((0, jsx_runtime_1.jsx)("discord-reactions", { slot: "reactions", children: message.reactions.cache.map((reaction, id) => ((0, jsx_runtime_1.jsx)("discord-reaction", { name: reaction.emoji.name, emoji: (0, utils_1.parseDiscordEmoji)(reaction.emoji), count: reaction.count }, `${message.id}r${id}`))) })), message.hasThread && message.thread && ((0, jsx_runtime_1.jsx)("discord-thread", { slot: "thread", name: message.thread.name, cta: message.thread.messageCount
|
|
54
|
+
? `${message.thread.messageCount} Message${message.thread.messageCount > 1 ? 's' : ''}`
|
|
55
|
+
: 'View Thread', children: message.thread.lastMessage ? ((0, jsx_runtime_1.jsx)("discord-thread-message", { profile: message.thread.lastMessage.author.id, children: (0, jsx_runtime_1.jsx)(content_1.default, { content: message.thread.lastMessage.content.length > 128
|
|
56
|
+
? message.thread.lastMessage.content.substring(0, 125) + '...'
|
|
57
|
+
: message.thread.lastMessage.content, context: Object.assign(Object.assign({}, context), { type: content_1.RenderType.REPLY }) }) })) : (`Thread messages not saved.`) }))] }, message.id));
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../../src/generator/renderers/message.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,iCAqGC;;AA7GD,6CAAsD;AACtD,6CAA2C;AAC3C,8DAAwC;AACxC,qDAAuD;AACvD,mCAAuC;AACvC,oDAAmC;AACnC,oEAAmD;AAEpC,KAAK,UAAU,cAAc,CAAC,EAC3C,OAAO,EACP,OAAO,GAIR;;IACC,IAAI,OAAO,CAAC,MAAM;QAAE,OAAO,uBAAC,uBAAoB,IAAC,OAAO,EAAE,OAAO,GAAI,CAAC;IAEtE,MAAM,WAAW,GAAG,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,SAAS,CAAC,OAAO,MAAK,MAAA,OAAO,CAAC,KAAK,0CAAE,EAAE,CAAA,CAAC;IAEzF,OAAO,CACL,6CACE,EAAE,EAAE,KAAK,OAAO,CAAC,EAAE,EAAE,EACrB,SAAS,EAAE,OAAO,CAAC,SAAS,EAE5B,MAAM,EAAE,OAAO,CAAC,QAAQ,KAAK,IAAI,EACjC,MAAM,EAAE,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,SAAS,EAChC,SAAS,EAAE,OAAO,CAAC,QAAQ,CAAC,QAAQ,EACpC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,aAG1B,uBAAC,eAAY,IAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,GAAI,EAGnD,OAAO,CAAC,WAAW,IAAI,CACtB,4CACE,IAAI,EAAC,OAAO,EACZ,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,EACpC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,WAAW,CAAC,WAAW,GAC9C,CACH,EAGA,OAAO,CAAC,OAAO,IAAI,CAClB,u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rB,EAGA,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,MAAM,IAAI,CACtC,2CACE,IAAI,EAAC,QAAQ,EACb,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,EACzB,GAAG,EACD,OAAO,CAAC,MAAM,CAAC,YAAY;oBACzB,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,YAAY,WAAW,OAAO,CAAC,MAAM,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;oBACvF,CAAC,CAAC,aAAa,YAGlB,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,CAAC,CAC5B,mDAAwB,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,YACnE,uBAAC,iBAAc,IACb,OAAO,EACL,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,GAAG,GAAG;4BAC7C,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,KAAK;4BAC9D,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,EAExC,OAAO,kCAAO,OAAO,KAAE,IAAI,EAAE,oBAAU,CAAC,KAAK,MAC7C,GACqB,CAC1B,CAAC,CAAC,CAAC,CACF,4BAA4B,CAC7B,GACc,CAClB,KAnFI,OAAO,CAAC,EAAE,CAoFC,CACnB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Message } from 'discord.js';
|
|
2
|
+
import type { RenderMessageContext } from '..';
|
|
3
|
+
export default function MessageReply({ message, context }: {
|
|
4
|
+
message: Message;
|
|
5
|
+
context: RenderMessageContext;
|
|
6
|
+
}): Promise<import("react/jsx-runtime").JSX.Element | null>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.default = MessageReply;
|
|
37
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
38
|
+
const discord_js_1 = require("discord.js");
|
|
39
|
+
const content_1 = __importStar(require("./content"));
|
|
40
|
+
async function MessageReply({ message, context }) {
|
|
41
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
42
|
+
if (!message.reference)
|
|
43
|
+
return null;
|
|
44
|
+
if (message.reference.guildId !== ((_a = message.guild) === null || _a === void 0 ? void 0 : _a.id))
|
|
45
|
+
return null;
|
|
46
|
+
const referencedMessage = context.messages.find((m) => m.id === message.reference.messageId);
|
|
47
|
+
if (!referencedMessage)
|
|
48
|
+
return (0, jsx_runtime_1.jsx)("discord-reply", { slot: "reply", children: "Message could not be loaded." });
|
|
49
|
+
const isCrossPost = referencedMessage.reference && referencedMessage.reference.guildId !== ((_b = message.guild) === null || _b === void 0 ? void 0 : _b.id);
|
|
50
|
+
const isCommand = referencedMessage.interaction !== null;
|
|
51
|
+
return ((0, jsx_runtime_1.jsx)("discord-reply", { slot: "reply", edited: !isCommand && referencedMessage.editedAt !== null, attachment: referencedMessage.attachments.size > 0, author: (_e = (_d = (_c = referencedMessage.member) === null || _c === void 0 ? void 0 : _c.nickname) !== null && _d !== void 0 ? _d : referencedMessage.author.displayName) !== null && _e !== void 0 ? _e : referencedMessage.author.username, avatar: (_f = referencedMessage.author.avatarURL({ size: 32 })) !== null && _f !== void 0 ? _f : undefined, roleColor: (_h = (_g = referencedMessage.member) === null || _g === void 0 ? void 0 : _g.displayHexColor) !== null && _h !== void 0 ? _h : undefined, bot: !isCrossPost && referencedMessage.author.bot, verified: (_j = referencedMessage.author.flags) === null || _j === void 0 ? void 0 : _j.has(discord_js_1.UserFlags.VerifiedBot), op: ((_l = (_k = message === null || message === void 0 ? void 0 : message.channel) === null || _k === void 0 ? void 0 : _k.isThread) === null || _l === void 0 ? void 0 : _l.call(_k)) && referencedMessage.author.id === ((_m = message === null || message === void 0 ? void 0 : message.channel) === null || _m === void 0 ? void 0 : _m.ownerId), server: isCrossPost !== null && isCrossPost !== void 0 ? isCrossPost : undefined, command: isCommand, children: referencedMessage.content ? ((0, jsx_runtime_1.jsx)("span", { "data-goto": referencedMessage.id, className: "reply-inline", children: (0, jsx_runtime_1.jsx)(content_1.default, { content: referencedMessage.content, context: Object.assign(Object.assign({}, context), { type: content_1.RenderType.REPLY }) }) })) : isCommand ? ((0, jsx_runtime_1.jsx)("em", { "data-goto": referencedMessage.id, children: "Click to see command." })) : ((0, jsx_runtime_1.jsx)("em", { "data-goto": referencedMessage.id, children: "Click to see attachment." })) }));
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=reply.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reply.js","sourceRoot":"","sources":["../../../src/generator/renderers/reply.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,+BAqCC;;AAzCD,2CAAqD;AAErD,qDAAuD;AAExC,KAAK,UAAU,YAAY,CAAC,EAAE,OAAO,EAAE,OAAO,EAAuD;;IAClH,IAAI,CAAC,OAAO,CAAC,SAAS;QAAE,OAAO,IAAI,CAAC;IACpC,IAAI,OAAO,CAAC,SAAS,CAAC,OAAO,MAAK,MAAA,OAAO,CAAC,KAAK,0CAAE,EAAE,CAAA;QAAE,OAAO,IAAI,CAAC;IAEjE,MAAM,iBAAiB,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,OAAO,CAAC,SAAU,CAAC,SAAS,CAAC,CAAC;IAC9F,IAAI,CAAC,iBAAiB;QAAE,OAAO,0CAAe,IAAI,EAAC,OAAO,6CAA6C,CAAC;IAExG,MAAM,WAAW,GAAG,iBAAiB,CAAC,SAAS,IAAI,iBAAiB,CAAC,SAAS,CAAC,OAAO,MAAK,MAAA,OAAO,CAAC,KAAK,0CAAE,EAAE,CAAA,CAAC;IAC7G,MAAM,SAAS,GAAG,iBAAiB,CAAC,WAAW,KAAK,IAAI,CAAC;IAEzD,OAAO,CACL,0CACE,IAAI,EAAC,OA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AC,CACd,4CAAe,iBAAiB,CAAC,EAAE,sCAA4B,CAChE,CAAC,CAAC,CAAC,CACF,4CAAe,iBAAiB,CAAC,EAAE,yCAA+B,CACnE,GACa,CACjB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type GuildMember, type Message, type User } from 'discord.js';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
export default function SystemMessage({ message }: {
|
|
4
|
+
message: Message;
|
|
5
|
+
}): Promise<import("react/jsx-runtime").JSX.Element | undefined>;
|
|
6
|
+
export declare function Highlight({ children, color }: {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
color?: string;
|
|
9
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare function JoinMessage({ member, fallbackUser }: {
|
|
11
|
+
member: GuildMember | null;
|
|
12
|
+
fallbackUser: User;
|
|
13
|
+
}): (string | import("react/jsx-runtime").JSX.Element)[];
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = SystemMessage;
|
|
4
|
+
exports.Highlight = Highlight;
|
|
5
|
+
exports.JoinMessage = JoinMessage;
|
|
6
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
|
+
const discord_js_1 = require("discord.js");
|
|
8
|
+
const utils_1 = require("../../utils/utils");
|
|
9
|
+
async function SystemMessage({ message }) {
|
|
10
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
11
|
+
switch (message.type) {
|
|
12
|
+
case discord_js_1.MessageType.RecipientAdd:
|
|
13
|
+
case discord_js_1.MessageType.UserJoin:
|
|
14
|
+
return ((0, jsx_runtime_1.jsx)("discord-system-message", { id: `m-${message.id}`, type: "join", children: (0, jsx_runtime_1.jsx)(JoinMessage, { member: message.member, fallbackUser: message.author }) }, message.id));
|
|
15
|
+
case discord_js_1.MessageType.ChannelPinnedMessage:
|
|
16
|
+
return ((0, jsx_runtime_1.jsxs)("discord-system-message", { id: `m-${message.id}`, type: "pin", children: [(0, jsx_runtime_1.jsx)(Highlight, { color: (_b = (_a = message.member) === null || _a === void 0 ? void 0 : _a.roles.color) === null || _b === void 0 ? void 0 : _b.hexColor, children: (_c = message.author.displayName) !== null && _c !== void 0 ? _c : message.author.username }), ' ', "pinned ", (0, jsx_runtime_1.jsx)("i", { "data-goto": (_d = message.reference) === null || _d === void 0 ? void 0 : _d.messageId, children: "a message" }), " to this channel.", message.reactions.cache.size > 0 && ((0, jsx_runtime_1.jsx)("discord-reactions", { slot: "reactions", children: message.reactions.cache.map((reaction, id) => ((0, jsx_runtime_1.jsx)("discord-reaction", { name: reaction.emoji.name, emoji: (0, utils_1.parseDiscordEmoji)(reaction.emoji), count: reaction.count }, `${message.id}r${id}`))) }))] }, message.id));
|
|
17
|
+
case discord_js_1.MessageType.GuildBoost:
|
|
18
|
+
case discord_js_1.MessageType.GuildBoostTier1:
|
|
19
|
+
case discord_js_1.MessageType.GuildBoostTier2:
|
|
20
|
+
case discord_js_1.MessageType.GuildBoostTier3:
|
|
21
|
+
return ((0, jsx_runtime_1.jsxs)("discord-system-message", { id: `m-${message.id}`, type: "boost", children: [(0, jsx_runtime_1.jsx)(Highlight, { color: (_f = (_e = message.member) === null || _e === void 0 ? void 0 : _e.roles.color) === null || _f === void 0 ? void 0 : _f.hexColor, children: (_g = message.author.displayName) !== null && _g !== void 0 ? _g : message.author.username }), ' ', "boosted the server!"] }, message.id));
|
|
22
|
+
case discord_js_1.MessageType.ThreadStarterMessage:
|
|
23
|
+
return ((0, jsx_runtime_1.jsxs)("discord-system-message", { id: `ms-${message.id}`, type: "thread", children: [(0, jsx_runtime_1.jsx)(Highlight, { color: (_j = (_h = message.member) === null || _h === void 0 ? void 0 : _h.roles.color) === null || _j === void 0 ? void 0 : _j.hexColor, children: (_k = message.author.displayName) !== null && _k !== void 0 ? _k : message.author.username }), ' ', "started a thread: ", (0, jsx_runtime_1.jsx)("i", { "data-goto": (_l = message.reference) === null || _l === void 0 ? void 0 : _l.messageId, children: message.content })] }, message.id));
|
|
24
|
+
// TODO: implement support for these:
|
|
25
|
+
case discord_js_1.MessageType.Default:
|
|
26
|
+
case discord_js_1.MessageType.RecipientRemove:
|
|
27
|
+
case discord_js_1.MessageType.Call:
|
|
28
|
+
case discord_js_1.MessageType.ChannelNameChange:
|
|
29
|
+
case discord_js_1.MessageType.ChannelIconChange:
|
|
30
|
+
case discord_js_1.MessageType.ChannelFollowAdd:
|
|
31
|
+
case discord_js_1.MessageType.GuildDiscoveryDisqualified:
|
|
32
|
+
case discord_js_1.MessageType.GuildDiscoveryRequalified:
|
|
33
|
+
case discord_js_1.MessageType.GuildDiscoveryGracePeriodInitialWarning:
|
|
34
|
+
case discord_js_1.MessageType.GuildDiscoveryGracePeriodFinalWarning:
|
|
35
|
+
case discord_js_1.MessageType.ThreadCreated:
|
|
36
|
+
case discord_js_1.MessageType.Reply:
|
|
37
|
+
case discord_js_1.MessageType.ChatInputCommand:
|
|
38
|
+
case discord_js_1.MessageType.GuildInviteReminder:
|
|
39
|
+
case discord_js_1.MessageType.ContextMenuCommand:
|
|
40
|
+
case discord_js_1.MessageType.AutoModerationAction:
|
|
41
|
+
case discord_js_1.MessageType.RoleSubscriptionPurchase:
|
|
42
|
+
case discord_js_1.MessageType.InteractionPremiumUpsell:
|
|
43
|
+
case discord_js_1.MessageType.StageStart:
|
|
44
|
+
case discord_js_1.MessageType.StageEnd:
|
|
45
|
+
case discord_js_1.MessageType.StageSpeaker:
|
|
46
|
+
case discord_js_1.MessageType.StageRaiseHand:
|
|
47
|
+
case discord_js_1.MessageType.StageTopic:
|
|
48
|
+
case discord_js_1.MessageType.GuildApplicationPremiumSubscription:
|
|
49
|
+
case discord_js_1.MessageType.GuildIncidentAlertModeEnabled:
|
|
50
|
+
case discord_js_1.MessageType.GuildIncidentAlertModeDisabled:
|
|
51
|
+
case discord_js_1.MessageType.GuildIncidentReportRaid:
|
|
52
|
+
case discord_js_1.MessageType.GuildIncidentReportFalseAlarm:
|
|
53
|
+
case discord_js_1.MessageType.PurchaseNotification:
|
|
54
|
+
case discord_js_1.MessageType.PollResult:
|
|
55
|
+
return undefined;
|
|
56
|
+
default:
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function Highlight({ children, color }) {
|
|
61
|
+
return (0, jsx_runtime_1.jsx)("i", { style: { color: color !== null && color !== void 0 ? color : 'white' }, children: children });
|
|
62
|
+
}
|
|
63
|
+
const allJoinMessages = [
|
|
64
|
+
'{user} just joined the server - glhf!',
|
|
65
|
+
'{user} just joined. Everyone, look busy!',
|
|
66
|
+
'{user} just joined. Can I get a heal?',
|
|
67
|
+
'{user} joined your party.',
|
|
68
|
+
'{user} joined. You must construct additional pylons.',
|
|
69
|
+
'Ermagherd. {user} is here.',
|
|
70
|
+
'Welcome, {user}. Stay awhile and listen.',
|
|
71
|
+
'Welcome, {user}. We were expecting you ( ͡° ͜ʖ ͡°)',
|
|
72
|
+
'Welcome, {user}. We hope you brought pizza.',
|
|
73
|
+
'Welcome {user}. Leave your weapons by the door.',
|
|
74
|
+
'A wild {user} appeared.',
|
|
75
|
+
'Swoooosh. {user} just landed.',
|
|
76
|
+
'Brace yourselves {user} just joined the server.',
|
|
77
|
+
'{user} just joined. Hide your bananas.',
|
|
78
|
+
'{user} just arrived. Seems OP - please nerf.',
|
|
79
|
+
'{user} just slid into the server.',
|
|
80
|
+
'A {user} has spawned in the server.',
|
|
81
|
+
'Big {user} showed up!',
|
|
82
|
+
"Where's {user}? In the server!",
|
|
83
|
+
'{user} hopped into the server. Kangaroo!!',
|
|
84
|
+
'{user} just showed up. Hold my beer.',
|
|
85
|
+
'Challenger approaching - {user} has appeared!',
|
|
86
|
+
"It's a bird! It's a plane! Nevermind, it's just {user}.",
|
|
87
|
+
"It's {user}! Praise the sun! \\\\[T]/",
|
|
88
|
+
'Never gonna give {user} up. Never gonna let {user} down.',
|
|
89
|
+
'Ha! {user} has joined! You activated my trap card!',
|
|
90
|
+
'Cheers, love! {user} is here!',
|
|
91
|
+
'Hey! Listen! {user} has joined!',
|
|
92
|
+
"We've been expecting you {user}",
|
|
93
|
+
"It's dangerous to go alone, take {user}!",
|
|
94
|
+
"{user} has joined the server! It's super effective!",
|
|
95
|
+
'Cheers, love! {user} is here!',
|
|
96
|
+
'{user} is here, as the prophecy foretold.',
|
|
97
|
+
"{user} has arrived. Party's over.",
|
|
98
|
+
'Ready player {user}',
|
|
99
|
+
'{user} is here to kick butt and chew bubblegum. And {user} is all out of gum.',
|
|
100
|
+
"Hello. Is it {user} you're looking for?",
|
|
101
|
+
];
|
|
102
|
+
function JoinMessage({ member, fallbackUser }) {
|
|
103
|
+
const randomMessage = allJoinMessages[Math.floor(Math.random() * allJoinMessages.length)];
|
|
104
|
+
return randomMessage
|
|
105
|
+
.split('{user}')
|
|
106
|
+
.flatMap((item, i) => {
|
|
107
|
+
var _a, _b, _c;
|
|
108
|
+
return [
|
|
109
|
+
item,
|
|
110
|
+
(0, jsx_runtime_1.jsx)(Highlight, { color: (_a = member === null || member === void 0 ? void 0 : member.roles.color) === null || _a === void 0 ? void 0 : _a.hexColor, children: (_c = (_b = member === null || member === void 0 ? void 0 : member.nickname) !== null && _b !== void 0 ? _b : fallbackUser.displayName) !== null && _c !== void 0 ? _c : fallbackUser.username }, i),
|
|
111
|
+
];
|
|
112
|
+
})
|
|
113
|
+
.slice(0, -1);
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=systemMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"systemMessage.js","sourceRoot":"","sources":["../../../src/generator/renderers/systemMessage.tsx"],"names":[],"mappings":";;AAIA,gCA4FC;AAED,8BAEC;AA0CD,kCAYC;;AA1JD,2CAAoF;AAEpF,6CAAsD;AAEvC,KAAK,UAAU,aAAa,CAAC,EAAE,OAAO,EAAwB;;IAC3E,QAAQ,OAAO,CAAC,IA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
|
3
|
+
* The core transcript component.
|
|
4
|
+
* Expects window.$discordMessage.profiles to be set for profile information.
|
|
5
|
+
*
|
|
6
|
+
* @param props Messages, channel details, callbacks, etc.
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
export default function DiscordMessages({ messages, channel, callbacks, ...options }: RenderMessageContext): Promise<import("react/jsx-runtime").JSX.Element>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
36
|
+
var t = {};
|
|
37
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
38
|
+
t[p] = s[p];
|
|
39
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
40
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
41
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
42
|
+
t[p[i]] = s[p[i]];
|
|
43
|
+
}
|
|
44
|
+
return t;
|
|
45
|
+
};
|
|
46
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
47
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
48
|
+
};
|
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
+
exports.default = DiscordMessages;
|
|
51
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
52
|
+
const discord_js_1 = require("discord.js");
|
|
53
|
+
const content_1 = __importStar(require("./renderers/content"));
|
|
54
|
+
const message_1 = __importDefault(require("./renderers/message"));
|
|
55
|
+
const TranscriptHeader_1 = require("./renderers/components/TranscriptHeader");
|
|
56
|
+
/**
|
|
57
|
+
* The core transcript component.
|
|
58
|
+
* Expects window.$discordMessage.profiles to be set for profile information.
|
|
59
|
+
*
|
|
60
|
+
* @param props Messages, channel details, callbacks, etc.
|
|
61
|
+
* @returns
|
|
62
|
+
*/
|
|
63
|
+
async function DiscordMessages(_a) {
|
|
64
|
+
var _b, _c, _d, _e, _f;
|
|
65
|
+
var { messages, channel, callbacks } = _a, options = __rest(_a, ["messages", "channel", "callbacks"]);
|
|
66
|
+
return ((0, jsx_runtime_1.jsxs)("discord-messages", { style: { minHeight: '100vh' }, children: [(0, jsx_runtime_1.jsx)(TranscriptHeader_1.TranscriptHeader, { guildName: channel.isDMBased() ? 'Direct Messages' : channel.guild.name, guildIcon: channel.isDMBased() ? undefined : ((_b = channel.guild.iconURL({ size: 128 })) !== null && _b !== void 0 ? _b : undefined), channelName: channel.isDMBased()
|
|
67
|
+
? channel.type === discord_js_1.ChannelType.DM
|
|
68
|
+
? ((_d = (_c = channel.recipient) === null || _c === void 0 ? void 0 : _c.tag) !== null && _d !== void 0 ? _d : 'Unknown Recipient')
|
|
69
|
+
: 'Unknown Recipient'
|
|
70
|
+
: channel.name, children: channel.isThread() ? (`Thread channel in ${(_f = (_e = channel.parent) === null || _e === void 0 ? void 0 : _e.name) !== null && _f !== void 0 ? _f : 'Unknown Channel'}`) : channel.isDMBased() ? (`Direct Messages`) : channel.isVoiceBased() ? (`Voice Text Channel for ${channel.name}`) : channel.type === discord_js_1.ChannelType.GuildCategory ? (`Category Channel`) : 'topic' in channel && channel.topic ? ((0, jsx_runtime_1.jsx)(content_1.default, { content: channel.topic, context: Object.assign({ messages, channel, callbacks, type: content_1.RenderType.REPLY }, options) })) : (`This is the start of #${channel.name} channel.`) }), messages.map((message) => ((0, jsx_runtime_1.jsx)(message_1.default, { message: message, context: Object.assign({ messages, channel, callbacks }, options) }, message.id))), (0, jsx_runtime_1.jsxs)("div", { style: { textAlign: 'center', width: '100%' }, children: [options.footerText
|
|
71
|
+
? options.footerText
|
|
72
|
+
.replaceAll('{number}', messages.length.toString())
|
|
73
|
+
.replaceAll('{s}', messages.length > 1 ? 's' : '')
|
|
74
|
+
: `Exported ${messages.length} message${messages.length > 1 ? 's' : ''}.`, ' ', options.poweredBy ? ((0, jsx_runtime_1.jsxs)("span", { style: { textAlign: 'center' }, children: ["Powered by", ' ', (0, jsx_runtime_1.jsx)("a", { href: "https://github.com/ItzDerock/discord-html-transcripts", style: { color: 'lightblue' }, children: "discord-html-transcripts" }), "."] })) : null] })] }));
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=transcript.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transcript.js","sourceRoot":"","sources":["../../src/generator/transcript.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,kCAsDC;;AAnED,2CAAyC;AAEzC,+DAAiE;AACjE,kEAAiD;AACjD,8EAA2E;AAE3E;;;;;;GAMG;AACY,KAAK,UAAU,eAAe,CAAC,EAAkE;;QAAlE,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,OAAoC,EAA/B,OAAO,cAA1C,oCAA4C,CAAF;IACtF,OAAO,CACL,8CAAkB,KAAK,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,aAC7C,uBAAC,mCAAgB,IACf,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EACvE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,MAAA,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,mCAAI,SAAS,CAAC,EAChG,WAAW,EACT,OAAO,CAAC,SAAS,EAAE;oBACjB,CAAC,CAAC,OAAO,CAAC,IAAI,KAAK,wBAAW,CAAC,EAAE;wBAC/B,CAAC,CAAC,CAAC,MAAA,MAAA,OAAO,CAAC,SAAS,0CAAE,GAAG,mCAAI,mBAAmB,CAAC;wBACjD,CAAC,CAAC,mBAAmB;oBACvB,CAAC,CAAC,OAAO,CAAC,IAAI,YAGjB,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CACpB,qBAAqB,MAAA,MAAA,OAAO,CAAC,MAAM,0CAAE,IAAI,mCAAI,iBAAiB,EAAE,CACjE,CAAC,CAAC,CAAC,OAAO,CAAC,SA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CAAC,EAAE,GAAG,EAAE,GAAG,EAC/E,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CACnB,kCAAM,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,2BACvB,GAAG,EACd,8BAAG,IAAI,EAAC,uDAAuD,EAAC,KAAK,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,yCAEzF,SAEC,CACR,CAAC,CAAC,CAAC,IAAI,IACJ,IACW,CACpB,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Collection, type Channel, type Message, type TextBasedChannel } from 'discord.js';
|
|
2
|
+
import { ExportReturnType, type CreateTranscriptOptions, type GenerateFromMessagesOptions, type ObjectType } from './types';
|
|
3
|
+
export { default as DiscordMessages } from './generator/transcript';
|
|
4
|
+
export { TranscriptImageDownloader } from './downloader/images';
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @param messages The messages to generate a transcript from
|
|
8
|
+
* @param channel The channel the messages are from (used for header and guild name)
|
|
9
|
+
* @param options The options to use when generating the transcript
|
|
10
|
+
* @returns The generated transcript
|
|
11
|
+
*/
|
|
12
|
+
export declare function generateFromMessages<T extends ExportReturnType = ExportReturnType.Attachment>(messages: Message[] | Collection<string, Message>, channel: Channel, options?: GenerateFromMessagesOptions<T>): Promise<ObjectType<T>>;
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @param channel The channel to create a transcript from
|
|
16
|
+
* @param options The options to use when creating the transcript
|
|
17
|
+
* @returns The generated transcript
|
|
18
|
+
*/
|
|
19
|
+
export declare function createTranscript<T extends ExportReturnType = ExportReturnType.Attachment>(channel: TextBasedChannel, options?: CreateTranscriptOptions<T>): Promise<ObjectType<T>>;
|
|
20
|
+
declare const _default: {
|
|
21
|
+
createTranscript: typeof createTranscript;
|
|
22
|
+
generateFromMessages: typeof generateFromMessages;
|
|
23
|
+
};
|
|
24
|
+
export default _default;
|
|
25
|
+
export * from './types';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/// <reference path="./discord-components.d.ts" />
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
15
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
|
+
};
|
|
17
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.TranscriptImageDownloader = exports.DiscordMessages = void 0;
|
|
22
|
+
exports.generateFromMessages = generateFromMessages;
|
|
23
|
+
exports.createTranscript = createTranscript;
|
|
24
|
+
const discord_js_1 = require("discord.js");
|
|
25
|
+
const generator_1 = __importDefault(require("./generator"));
|
|
26
|
+
const types_1 = require("./types");
|
|
27
|
+
const images_1 = require("./downloader/images");
|
|
28
|
+
// re-exports
|
|
29
|
+
var transcript_1 = require("./generator/transcript");
|
|
30
|
+
Object.defineProperty(exports, "DiscordMessages", { enumerable: true, get: function () { return __importDefault(transcript_1).default; } });
|
|
31
|
+
var images_2 = require("./downloader/images");
|
|
32
|
+
Object.defineProperty(exports, "TranscriptImageDownloader", { enumerable: true, get: function () { return images_2.TranscriptImageDownloader; } });
|
|
33
|
+
// version check
|
|
34
|
+
const versionPrefix = discord_js_1.version.split('.')[0];
|
|
35
|
+
if (versionPrefix !== '14' && versionPrefix !== '15') {
|
|
36
|
+
console.error(`[discord-html-transcripts] Versions v3.x.x of discord-html-transcripts are only compatible with discord.js v14.x.x and v15.x.x, and you are using v${discord_js_1.version}.` +
|
|
37
|
+
` For v13.x.x support, please install discord-html-transcripts v2.x.x using "npm install discord-html-transcripts@^2".`);
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
*
|
|
42
|
+
* @param messages The messages to generate a transcript from
|
|
43
|
+
* @param channel The channel the messages are from (used for header and guild name)
|
|
44
|
+
* @param options The options to use when generating the transcript
|
|
45
|
+
* @returns The generated transcript
|
|
46
|
+
*/
|
|
47
|
+
async function generateFromMessages(messages, channel, options = {}) {
|
|
48
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
49
|
+
// turn messages into an array
|
|
50
|
+
const transformedMessages = messages instanceof discord_js_1.Collection ? Array.from(messages.values()) : messages;
|
|
51
|
+
// figure out how the user wants images saved
|
|
52
|
+
let resolveImageSrc = (_b = (_a = options.callbacks) === null || _a === void 0 ? void 0 : _a.resolveImageSrc) !== null && _b !== void 0 ? _b : ((attachment) => attachment.url);
|
|
53
|
+
if (options.saveImages) {
|
|
54
|
+
if ((_c = options.callbacks) === null || _c === void 0 ? void 0 : _c.resolveImageSrc) {
|
|
55
|
+
console.warn(`[discord-html-transcripts] You have specified both saveImages and resolveImageSrc, please only specify one. resolveImageSrc will be used.`);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
resolveImageSrc = new images_1.TranscriptImageDownloader().build();
|
|
59
|
+
console.log('Using default downloader');
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
// render the messages
|
|
63
|
+
const html = await (0, generator_1.default)({
|
|
64
|
+
messages: transformedMessages,
|
|
65
|
+
channel,
|
|
66
|
+
saveImages: (_d = options.saveImages) !== null && _d !== void 0 ? _d : false,
|
|
67
|
+
callbacks: Object.assign({ resolveImageSrc, resolveChannel: async (id) => channel.client.channels.fetch(id).catch(() => null), resolveUser: async (id) => channel.client.users.fetch(id).catch(() => null), resolveRole: channel.isDMBased() ? () => null : async (id) => { var _a; return (_a = channel.guild) === null || _a === void 0 ? void 0 : _a.roles.fetch(id).catch(() => null); } }, ((_e = options.callbacks) !== null && _e !== void 0 ? _e : {})),
|
|
68
|
+
poweredBy: (_f = options.poweredBy) !== null && _f !== void 0 ? _f : true,
|
|
69
|
+
footerText: (_g = options.footerText) !== null && _g !== void 0 ? _g : 'Exported {number} message{s}.',
|
|
70
|
+
favicon: (_h = options.favicon) !== null && _h !== void 0 ? _h : 'guild',
|
|
71
|
+
hydrate: (_j = options.hydrate) !== null && _j !== void 0 ? _j : false,
|
|
72
|
+
});
|
|
73
|
+
// get the time it took to render the messages
|
|
74
|
+
// const renderTime = process.hrtime(startTime);
|
|
75
|
+
// console.log(
|
|
76
|
+
// `[discord-html-transcripts] Rendered ${transformedMessages.length} messages in ${renderTime[0]}s ${
|
|
77
|
+
// renderTime[1] / 1000000
|
|
78
|
+
// }ms`
|
|
79
|
+
// );
|
|
80
|
+
// return the html in the specified format
|
|
81
|
+
if (options.returnType === types_1.ExportReturnType.Buffer) {
|
|
82
|
+
return Buffer.from(html);
|
|
83
|
+
}
|
|
84
|
+
if (options.returnType === types_1.ExportReturnType.String) {
|
|
85
|
+
return html;
|
|
86
|
+
}
|
|
87
|
+
return new discord_js_1.AttachmentBuilder(Buffer.from(html), {
|
|
88
|
+
name: (_k = options.filename) !== null && _k !== void 0 ? _k : `transcript-${channel.id}.html`,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
*
|
|
93
|
+
* @param channel The channel to create a transcript from
|
|
94
|
+
* @param options The options to use when creating the transcript
|
|
95
|
+
* @returns The generated transcript
|
|
96
|
+
*/
|
|
97
|
+
async function createTranscript(channel, options = {}) {
|
|
98
|
+
// validate type
|
|
99
|
+
if (!channel.isTextBased()) {
|
|
100
|
+
// @ts-expect-error(2339): run-time check
|
|
101
|
+
throw new TypeError(`Provided channel must be text-based, received ${channel.type}`);
|
|
102
|
+
}
|
|
103
|
+
// fetch messages
|
|
104
|
+
let allMessages = [];
|
|
105
|
+
let lastMessageId;
|
|
106
|
+
const { limit, filter } = options;
|
|
107
|
+
const resolvedLimit = typeof limit === 'undefined' || limit === -1 ? Infinity : limit;
|
|
108
|
+
// until there are no more messages, keep fetching
|
|
109
|
+
while (true) {
|
|
110
|
+
// create fetch options
|
|
111
|
+
const fetchLimitOptions = { limit: 100, before: lastMessageId };
|
|
112
|
+
if (!lastMessageId)
|
|
113
|
+
delete fetchLimitOptions.before;
|
|
114
|
+
// fetch messages
|
|
115
|
+
const messages = await channel.messages.fetch(fetchLimitOptions);
|
|
116
|
+
const filteredMessages = typeof filter === 'function' ? messages.filter(filter) : messages;
|
|
117
|
+
// add the messages to the array
|
|
118
|
+
allMessages.push(...filteredMessages.values());
|
|
119
|
+
// Get the last key of 'messages', not 'filteredMessages' because you will be refetching the same messages
|
|
120
|
+
lastMessageId = messages.lastKey();
|
|
121
|
+
// if there are no more messages, break
|
|
122
|
+
if (messages.size < 100)
|
|
123
|
+
break;
|
|
124
|
+
// if the limit has been reached, break
|
|
125
|
+
if (allMessages.length >= resolvedLimit)
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
128
|
+
if (resolvedLimit < allMessages.length)
|
|
129
|
+
allMessages = allMessages.slice(0, limit);
|
|
130
|
+
// generate the transcript
|
|
131
|
+
return generateFromMessages(allMessages.reverse(), channel, options);
|
|
132
|
+
}
|
|
133
|
+
exports.default = {
|
|
134
|
+
createTranscript,
|
|
135
|
+
generateFromMessages,
|
|
136
|
+
};
|
|
137
|
+
__exportStar(require("./types"), exports);
|
|
138
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|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AAQ,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;QACjE,MAAM,gBAAgB,GAAG,OAAO,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;QAE3F,gCAAgC;QAChC,WAAW,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC,MAAM,EAAE,CAAC,CAAC;QAC/C,0GAA0G;QAC1G,aAAa,GAAG,QAAQ,CAAC,OAAO,EAAE,CAAC;QAEnC,uCAAuC;QACvC,IAAI,QAAQ,CAAC,IAAI,GAAG,GAAG;YAAE,MAAM;QAE/B,uCAAuC;QACvC,IAAI,WAAW,CAAC,MAAM,IAAI,aAAa;YAAE,MAAM;IACjD,CAAC;IAED,IAAI,aAAa,GAAG,WAAW,CAAC,MAAM;QAAE,WAAW,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IAElF,0BAA0B;IAC1B,OAAO,oBAAoB,CAAI,WAAW,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;AAC1E,CAAC;AAED,kBAAe;IACb,gBAAgB;IAChB,oBAAoB;CACrB,CAAC;AACF,0CAAwB"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const scrollToMessage = "document.addEventListener(\"click\",t=>{let e=t.target;if(!e)return;let o=e?.getAttribute(\"data-goto\");if(o){let r=document.getElementById(`m-${o}`);r?(r.scrollIntoView({behavior:\"smooth\",block:\"center\"}),r.style.backgroundColor=\"rgba(148, 156, 247, 0.1)\",r.style.transition=\"background-color 0.5s ease\",setTimeout(()=>{r.style.backgroundColor=\"transparent\"},1e3)):console.warn(\"Message ${goto} not found.\")}});";
|
|
2
|
+
export declare const revealSpoiler = "const s=document.querySelectorAll(\".discord-spoiler\");s.forEach(s=>s.addEventListener(\"click\",()=>{if(s.classList.contains(\"discord-spoiler\")){s.classList.remove(\"discord-spoiler\");s.classList.add(\"discord-spoiler--revealed\");}}));";
|
|
3
|
+
export declare const ggSansFont = "@font-face{src:url(https://cdn.jsdelivr.net/gh/Tyrrrz/DiscordFonts@master/ggsans-normal-400.woff2);font-family:\"gg sans\";font-weight:400;font-style:normal}@font-face{src:url(https://cdn.jsdelivr.net/gh/Tyrrrz/DiscordFonts@master/ggsans-normal-500.woff2);font-family:\"gg sans\";font-weight:500;font-style:normal}@font-face{src:url(https://cdn.jsdelivr.net/gh/Tyrrrz/DiscordFonts@master/ggsans-normal-600.woff2);font-family:\"gg sans\";font-weight:600;font-style:normal}@font-face{src:url(https://cdn.jsdelivr.net/gh/Tyrrrz/DiscordFonts@master/ggsans-normal-700.woff2);font-family:\"gg sans\";font-weight:700;font-style:normal}@font-face{src:url(https://cdn.jsdelivr.net/gh/Tyrrrz/DiscordFonts@master/ggsans-normal-800.woff2);font-family:\"gg sans\";font-weight:800;font-style:normal}@font-face{src:url(https://cdn.jsdelivr.net/gh/Tyrrrz/DiscordFonts@master/ggsans-italic-400.woff2);font-family:\"gg sans\";font-weight:400;font-style:italic}@font-face{src:url(https://cdn.jsdelivr.net/gh/Tyrrrz/DiscordFonts@master/ggsans-italic-500.woff2);font-family:\"gg sans\";font-weight:500;font-style:italic}@font-face{src:url(https://cdn.jsdelivr.net/gh/Tyrrrz/DiscordFonts@master/ggsans-italic-600.woff2);font-family:\"gg sans\";font-weight:600;font-style:italic}@font-face{src:url(https://cdn.jsdelivr.net/gh/Tyrrrz/DiscordFonts@master/ggsans-italic-700.woff2);font-family:\"gg sans\";font-weight:700;font-style:italic}@font-face{src:url(https://cdn.jsdelivr.net/gh/Tyrrrz/DiscordFonts@master/ggsans-italic-800.woff2);font-family:\"gg sans\";font-weight:800;font-style:italic}";
|