Skip to content

Commit

Permalink
feat: removing library, and fixing future functions
Browse files Browse the repository at this point in the history
  • Loading branch information
jonalan7 committed May 12, 2023
1 parent ad6575b commit 863e959
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 251 deletions.
271 changes: 55 additions & 216 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@
"dependencies": {
"@typescript-eslint/eslint-plugin": "^5.48.2",
"@typescript-eslint/parser": "^5.44.0",
"@wppconnect/wa-js": "^2.19.1",
"atob": "^2.1.2",
"axios": "^1.2.0",
"boxen": "^5.1.1",
Expand All @@ -125,7 +124,7 @@
"futoin-hkdf": "^1.5.1",
"i": "^0.3.7",
"latest-lib": "^0.2.1",
"latest-version": "^5.1.0",
"latest-version": "^7.0.0",
"mime-types": "^2.1.35",
"ora": "^6.1.2",
"puppeteer": "^20.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/lib/wapi/functions/add-participant.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export async function addParticipant(groupId, contactsId) {
}

try {
await window.Store.Participants.addParticipants(chat, contactsId);
await Store.Participants.addParticipants(chat, contactsId);
return true;
} catch {
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/wapi/functions/delete-messages-all.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export async function deleteMessagesAll(chatId, messageArray, onlyLocal) {
return WPP.chat.deleteMessage(chatId, messageArray, true, onlyLocal);
//return WAPI.chat.deleteMessage(chatId, messageArray, true, onlyLocal);
}
2 changes: 1 addition & 1 deletion src/lib/wapi/functions/delete-messages-me.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export async function deleteMessagesMe(chatId, messageArray, revoke) {
return WPP.chat.deleteMessage(chatId, messageArray, true, revoke);
//return WAPI.chat.deleteMessage(chatId, messageArray, true, revoke);
}
11 changes: 5 additions & 6 deletions src/lib/wapi/functions/get-group-participant-ids.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
export async function getGroupParticipantIDs(groupId, done) {
const output = Promise.resolve(WPP.group.getParticipants(groupId)).then(
(participants) => participants.map((p) => p.toJSON())
);

if (done !== undefined) done(output);
return output;
// const output = Promise.resolve(WAPI.group.getParticipants(groupId)).then(
// (participants) => participants.map((p) => p.toJSON())
// );
// if (done !== undefined) done(output);
// return output;
}
11 changes: 5 additions & 6 deletions src/lib/wapi/functions/get-group-participants.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
export async function _getGroupParticipants(id, done) {
const output = Promise.resolve(WPP.group.getParticipants(id)).then(
(participants) => participants.map((p) => p.toJSON())
);

if (done !== undefined) done(output);
return output;
// const output = Promise.resolve(WAPI.group.getParticipants(id)).then(
// (participants) => participants.map((p) => p.toJSON())
// );
// if (done !== undefined) done(output);
// return output;
}
16 changes: 1 addition & 15 deletions src/lib/wapi/globals.d.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
// * Credits for WPPConnect Team
// * Author: <Edgard Messias>
// * wppconnect-team/wa-js
// * https://github.com/wppconnect-team/wa-js
import type * as wajs from '@wppconnect/wa-js';

declare global {
interface Window {
WPP: typeof wajs;
}
const WPP: typeof wajs;
}

declare global {
declare module global {
interface Window {
Store: any;
}
}
//*******************************************
1 change: 0 additions & 1 deletion src/lib/wapi/listeners/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export { initNewMessagesListener } from './init-listeners';
export { addNewMessagesListener } from './add-new-messages';
export { allNewMessagesListener } from './add-all-new-messages';
export { addOnStateChange, addOnStreamChange } from './add-on-state-change';
export { addOnNewAcks } from './add-on-new-ack';
export { addOnLiveLocation } from './add-on-live-location';
Expand Down
2 changes: 0 additions & 2 deletions src/lib/wapi/wapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ import {
addOnNewAcks,
addOnParticipantsChange,
addOnStateChange,
allNewMessagesListener,
initNewMessagesListener,
addOnStreamChange,
addonFilePicThumb,
Expand Down Expand Up @@ -537,7 +536,6 @@ if (typeof window.WAPI === 'undefined') {
};

addNewMessagesListener();
//allNewMessagesListener();

addonUnreadMessage();
addonFilePicThumb();
Expand Down

0 comments on commit 863e959

Please sign in to comment.