Skip to content
This repository has been archived by the owner on Apr 19, 2022. It is now read-only.

Commit

Permalink
Add support for blocks as attachments
Browse files Browse the repository at this point in the history
  • Loading branch information
twouters committed Mar 9, 2022
1 parent f9b68ef commit b8076fc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/slackmessageparser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,9 @@ export class SlackMessageParser {
const url = escapeHtml(attachment.image_url);
result.formatted_body += `Image: <a href="${url}">${url}</a><br>`;
}
if (attachment.blocks && attachment.blocks.length > 0) {
result.formatted_body += await this.blocksParser.parseBlocks(opts, attachment.blocks);
}
const footerParts: string[] = [];
const footerPartsHtml: string[] = [];
if (attachment.footer) {
Expand Down
1 change: 1 addition & 0 deletions src/slacktypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export type AllBlocks = KnownBlock | ISlackBlockRichText | ISlackRichTextSection
| ISlackBlockTeam | ISlackBlockCall;

export interface ISlackMessageAttachment extends MessageAttachment {
blocks?: AllBlocks[];
author_id?: string;
}

Expand Down

0 comments on commit b8076fc

Please sign in to comment.