Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: chat opening methods accept a Wid param #2411

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/api/layers/ui.layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import { Page } from 'puppeteer';
import { CreateConfig } from '../../config/create-config';
import { evaluateAndReturn } from '../helpers';
import { Wid, Chat } from '../model';
import { GroupLayer } from './group.layer';

export class UILayer extends GroupLayer {
Expand All @@ -31,7 +32,7 @@
* @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),
Expand All @@ -45,7 +46,7 @@
* @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),
Expand All @@ -67,7 +68,7 @@
* Return the currently active chat (visually open)
* @category UI
*/
public getActiveChat() {
public getActiveChat(): Chat {
return evaluateAndReturn(this.page, () => WPP.chat.getActiveChat());

Check failure on line 72 in src/api/layers/ui.layer.ts

View workflow job for this annotation

GitHub Actions / lint

Type 'Promise<ChatModel>' is missing the following properties from type 'Chat': id, pendingMsgs, lastReceivedKey, t, and 23 more.

Check failure on line 72 in src/api/layers/ui.layer.ts

View workflow job for this annotation

GitHub Actions / lint

Type 'Promise<ChatModel>' is missing the following properties from type 'Chat': id, pendingMsgs, lastReceivedKey, t, and 23 more.

Check failure on line 72 in src/api/layers/ui.layer.ts

View workflow job for this annotation

GitHub Actions / build

Type 'Promise<ChatModel>' is missing the following properties from type 'Chat': id, pendingMsgs, lastReceivedKey, t, and 23 more.

Check failure on line 72 in src/api/layers/ui.layer.ts

View workflow job for this annotation

GitHub Actions / build

Type 'Promise<ChatModel>' is missing the following properties from type 'Chat': id, pendingMsgs, lastReceivedKey, t, and 23 more.
}
}
Loading