Skip to content

Commit

Permalink
fix: Fixed initialization of onPresenceChanged (fix #704)
Browse files Browse the repository at this point in the history
  • Loading branch information
edgardmessias committed Dec 9, 2021
1 parent 608afd8 commit 0470ea8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/lib/wapi/listeners/add-on-presence-changed.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@
* along with WPPConnect. If not, see <https://www.gnu.org/licenses/>.
*/

import { subscribePresence } from '../functions';

export function addOnPresenceChanged() {
window.WAPI.onPresenceChanged = function (callback) {
setTimeout(() => {
WPP.whatsapp.ChatStore.map((c) => c.presence.subscribe());
}, 1000);

WPP.whatsapp.PresenceStore.on('change:chatstate.type', (chatstate) => {
try {
// Search precense model from chatstate
Expand Down

0 comments on commit 0470ea8

Please sign in to comment.