Skip to content

Commit 33cb64d

Browse files
committed
fix: use extended markdown parsing when webhook
1 parent 9a0b8a9 commit 33cb64d

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

src/generator/renderers/content.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export enum RenderType {
2020
EMBED,
2121
REPLY,
2222
NORMAL,
23+
WEBHOOK,
2324
}
2425

2526
type RenderContentContext = RenderMessageContext & {
@@ -34,7 +35,10 @@ export default async function renderContent(content: string, context: RenderCont
3435
if (context.type === RenderType.REPLY && content.length > 180) content = content.slice(0, 180) + '...';
3536

3637
// parse the markdown
37-
const parsed = parse(content, context.type === RenderType.EMBED ? 'extended' : 'normal');
38+
const parsed = parse(
39+
content,
40+
context.type === RenderType.EMBED || context.type === RenderType.WEBHOOK ? 'extended' : 'normal'
41+
);
3842

3943
// check if the parsed content is only emojis
4044
const isOnlyEmojis = parsed.every(

src/generator/renderers/message.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ export default async function renderMessage(message: Message, context: RenderMes
4646
)}
4747

4848
{/* message content */}
49-
{message.content && (await renderContent(message.content, { ...context, type: RenderType.NORMAL }))}
49+
{message.content &&
50+
(await renderContent(message.content, {
51+
...context,
52+
type: message.webhookId ? RenderType.WEBHOOK : RenderType.NORMAL,
53+
}))}
5054

5155
{/* attachments */}
5256
{await renderAttachments(message, context)}

0 commit comments

Comments
 (0)