From 39864c468264dfa897c2cc599b0a58e2a2f968e8 Mon Sep 17 00:00:00 2001 From: gekkedev <17025257+gekkedev@users.noreply.github.com> Date: Wed, 6 Nov 2024 12:28:30 +0100 Subject: [PATCH 1/2] fix: chat opening methods accept a Wid param --- src/api/layers/ui.layer.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/api/layers/ui.layer.ts b/src/api/layers/ui.layer.ts index a205a84d0..9121c486f 100644 --- a/src/api/layers/ui.layer.ts +++ b/src/api/layers/ui.layer.ts @@ -18,6 +18,7 @@ import { Page } from 'puppeteer'; import { CreateConfig } from '../../config/create-config'; import { evaluateAndReturn } from '../helpers'; +import { Wid } from '../model'; import { GroupLayer } from './group.layer'; export class UILayer extends GroupLayer { @@ -31,7 +32,7 @@ export class UILayer extends GroupLayer { * @category UI * @param chatId */ - public async openChat(chatId: string) { + public async openChat(chatId: string | Wid) { return evaluateAndReturn( this.page, (chatId: string) => WPP.chat.openChatBottom(chatId), @@ -45,7 +46,7 @@ export class UILayer extends GroupLayer { * @param chatId Chat id * @param messageId Message id (For example: '06D3AB3D0EEB9D077A3F9A3EFF4DD030') */ - public async openChatAt(chatId: string, messageId: string) { + public async openChatAt(chatId: string | Wid, messageId: string) { return evaluateAndReturn( this.page, (chatId: string, messageId) => WPP.chat.openChatAt(chatId, messageId), From 9c30eec8e8ffac8e06c46e3dc028dbc64f5cfafb Mon Sep 17 00:00:00 2001 From: gekkedev <17025257+gekkedev@users.noreply.github.com> Date: Wed, 6 Nov 2024 12:31:48 +0100 Subject: [PATCH 2/2] fix: model return type from wa-js interpreted as any --- src/api/layers/ui.layer.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/api/layers/ui.layer.ts b/src/api/layers/ui.layer.ts index 9121c486f..48110ef63 100644 --- a/src/api/layers/ui.layer.ts +++ b/src/api/layers/ui.layer.ts @@ -18,7 +18,7 @@ import { Page } from 'puppeteer'; import { CreateConfig } from '../../config/create-config'; import { evaluateAndReturn } from '../helpers'; -import { Wid } from '../model'; +import { Wid, Chat } from '../model'; import { GroupLayer } from './group.layer'; export class UILayer extends GroupLayer { @@ -68,7 +68,7 @@ export class UILayer extends GroupLayer { * Return the currently active chat (visually open) * @category UI */ - public getActiveChat() { + public getActiveChat(): Chat { return evaluateAndReturn(this.page, () => WPP.chat.getActiveChat()); } }