Skip to content

Commit a64d2c3

Browse files
committed
chore(Attachments): market support
1 parent b494b1f commit a64d2c3

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/modules/Attachments.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { LINK_PREFIX } from "./functions.js";
77

88
import { Attachment, ParsedAttachments, AttachmentFields } from "../interfaces";
99

10-
const { AUDIO, DOCUMENT, LINK, PHOTO, POLL, VIDEO, ALBUM } = AttachmentType;
10+
const { AUDIO, DOCUMENT, LINK, PHOTO, POLL, VIDEO, ALBUM, MARKET, MARKET_ALBUM } = AttachmentType;
1111

1212
export class Attachments {
1313

@@ -23,7 +23,7 @@ export class Attachments {
2323
const attachmentFields: AttachmentFields = [];
2424

2525
const parsedAttachments = (
26-
attachments.map(({ type, photo, video, link, doc, audio, poll, album, textlive }) => {
26+
attachments.map(({ type, photo, video, link, doc, audio, poll, album, textlive, market }) => {
2727
switch (type) {
2828
case PHOTO: {
2929
const { sizes } = photo;
@@ -90,6 +90,16 @@ export class Attachments {
9090

9191
return `[🖼️ Альбом: ${title}](${LINK_PREFIX}${ALBUM}${owner_id}_${id})`;
9292
}
93+
case MARKET: {
94+
const { owner_id, id, title } = market;
95+
96+
return `[🛍️ Товар: ${title}](${LINK_PREFIX}${MARKET}${owner_id}?w=product${owner_id}_${id})`;
97+
}
98+
case MARKET_ALBUM: {
99+
const { owner_id, id, title } = market;
100+
101+
return `[🛍️ Подборка товаров: ${title}](${LINK_PREFIX}${MARKET}${owner_id}?section=${ALBUM}_${id})`;
102+
}
93103
case "textlive": {
94104
const { textlive_id, title } = textlive;
95105

0 commit comments

Comments
 (0)