From f0361b9c2a7b582c4d652bdc4d589d6464411330 Mon Sep 17 00:00:00 2001 From: icleitoncosta Date: Mon, 15 Aug 2022 19:28:56 -0300 Subject: [PATCH] feat: Added client.sendReadStatus function (#673) --- src/api/layers/status.layer.ts | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/api/layers/status.layer.ts b/src/api/layers/status.layer.ts index a1f5c7368..df9ecb3c3 100644 --- a/src/api/layers/status.layer.ts +++ b/src/api/layers/status.layer.ts @@ -17,7 +17,6 @@ import { Page } from 'puppeteer'; import { CreateConfig } from '../../config/create-config'; -import { BusinessLayer } from './business.layer'; import { LabelsLayer } from './labels.layer'; import { evaluateAndReturn, @@ -32,6 +31,7 @@ export class StatusLayer extends LabelsLayer { } /** * Send a image message to status stories + * @category Status * * @example * ```javascript @@ -88,6 +88,7 @@ export class StatusLayer extends LabelsLayer { } /** * Send a video message to status stories + * @category Status * * @example * ```javascript @@ -128,6 +129,7 @@ export class StatusLayer extends LabelsLayer { /** * Send a text to status stories + * @category Status * * @example * ```javascript @@ -144,4 +146,25 @@ export class StatusLayer extends LabelsLayer { { text, options } ); } + + /** + * Mark status as read/seen + * @category Status + * + * @example + * ```javascript + * client.sendReadStatus('[phone_number]@c.us', 'false_status@broadcast_3A169E0FD4BC6E92212F_[]@c.us'); + * ``` + * @param chatId Chat ID of contact + * @param statusId ID of status msg + */ + public async sendReadStatus(chatId: string, statusId: string) { + return await evaluateAndReturn( + this.page, + ({ chatId, statusId }) => { + WPP.status.sendReadStatus(chatId, statusId); + }, + { chatId, statusId } + ); + } }