Skip to content

Commit

Permalink
fix: Fixed the return for WPP.contact.getStatus function
Browse files Browse the repository at this point in the history
  • Loading branch information
edgardmessias committed Jun 18, 2022
1 parent 5479679 commit ac02d5a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/contact/functions/getStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import { assertWid } from '../../assert';
import { StatusStore, Wid } from '../../whatsapp';
import { queryExists } from './queryExists';

/**
* Get the current text status
Expand All @@ -31,5 +32,13 @@ import { StatusStore, Wid } from '../../whatsapp';
export async function getStatus(contactId: string | Wid) {
const wid = assertWid(contactId);

return StatusStore.find(wid);
const exists = await queryExists(wid);

if (!exists) {
return null;
}

const model = await StatusStore.find(wid);

return model.status || null;
}

0 comments on commit ac02d5a

Please sign in to comment.