Skip to content

Commit

Permalink
feat: new functions
Browse files Browse the repository at this point in the history
  • Loading branch information
jonalan7 committed Jun 10, 2021
1 parent 3396e10 commit 6721144
Show file tree
Hide file tree
Showing 13 changed files with 279 additions and 213 deletions.
6 changes: 3 additions & 3 deletions src/api/layers/controls.layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class ControlsLayer extends UILayer {
*/
public async unblockContact(contactId: string) {
return this.page.evaluate(
(contactId) => WAPI.unblockContact(contactId),
(contactId: string) => WAPI.unblockContact(contactId),
contactId
);
}
Expand All @@ -34,7 +34,7 @@ export class ControlsLayer extends UILayer {
*/
public async blockContact(contactId: string) {
return this.page.evaluate(
(contactId) => WAPI.blockContact(contactId),
(contactId: string) => WAPI.blockContact(contactId),
contactId
);
}
Expand All @@ -46,7 +46,7 @@ export class ControlsLayer extends UILayer {
*/
public async markUnseenMessage(contactId: string) {
return this.page.evaluate(
(contactId) => WAPI.markUnseenMessage(contactId),
(contactId: string) => WAPI.markUnseenMessage(contactId),
contactId
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/api/layers/retriever.layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ export class RetrieverLayer extends SenderLayer {
*/
public async loadEarlierMessages(contactId: string) {
return this.page.evaluate(
(contactId) => WAPI.loadEarlierMessages(contactId),
(contactId: string) => WAPI.loadEarlierMessages(contactId),
contactId
);
}
Expand All @@ -242,7 +242,7 @@ export class RetrieverLayer extends SenderLayer {
*/
public async getStatus(contactId: string) {
return this.page.evaluate(
(contactId) => WAPI.getStatus(contactId),
(contactId: string) => WAPI.getStatus(contactId),
contactId
);
}
Expand Down
9 changes: 5 additions & 4 deletions src/api/layers/sender.layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,12 @@ export class SenderLayer extends ListenerLayer {
* @param to chat id: xxxxx@us.c
* @param content text message
* @param idMessage add id message
* @param passId new id
*/
public async sendText(
to: string,
content: string,
idMessage?: string
passId?: any
): Promise<Object> {
return new Promise(async (resolve, reject) => {
const typeFunction = 'sendText';
Expand All @@ -241,10 +242,10 @@ export class SenderLayer extends ListenerLayer {
return reject(validating);
}
const result = await this.page.evaluate(
({ to, content }) => {
return WAPI.sendMessage(to, content, undefined, idMessage);
({ to, content, passId }) => {
return WAPI.sendMessage(to, content, undefined, passId);
},
{ to, content }
{ to, content, passId }
);
if (result['erro'] == true) {
return reject(result);
Expand Down
Loading

0 comments on commit 6721144

Please sign in to comment.