Skip to content

Commit

Permalink
fix: Fixed isStatusV3 error (close #2054)
Browse files Browse the repository at this point in the history
  • Loading branch information
icleitoncosta committed Jul 1, 2024
1 parent 97c2e3e commit dfae74d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/chat/functions/getMessageById.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,10 @@ export async function getMessageById(
let msg = MsgStore.get(msgKey);

if (!msg) {
if (msgKey.remote.isStatusV3()) {
if (
msgKey.remote?.toString()?.includes('status@broadcast') ||
msgKey.remote?.isStatusV3()
) {
msg = StatusV3Store.getMyStatus().msgs.get(msgKey);
} else {
const chat = assertGetChat(msgKey.remote);
Expand Down
7 changes: 6 additions & 1 deletion src/chat/functions/getQuotedMsgKey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,17 @@ export function getQuotedMsgKey(msg: MsgModel): MsgKey {
const remote = msg.quotedRemoteJid ? msg.quotedRemoteJid : msg.id.remote;
const fromMe = getMyUserId()?.equals(msg.quotedParticipant) || false;

const isStatus =
typeof Wid.isStatusV3 === 'function'
? Wid.isStatusV3(remote)
: Wid.isStatus(remote);

const quotedMsgId = new MsgKey({
id: msg.quotedStanzaID,
fromMe: fromMe,
remote: remote,
participant:
Wid.isGroup(msg.from!) || Wid.isGroup(msg.to!) || Wid.isStatusV3(remote)
Wid.isGroup(msg.from!) || Wid.isGroup(msg.to!) || isStatus
? msg.quotedParticipant
: undefined,
});
Expand Down
4 changes: 4 additions & 0 deletions src/whatsapp/misc/Wid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ export declare class Wid {

isStatusV3(): boolean;

isStatus(): boolean;

isUser(): boolean;

isLid(): boolean;
Expand Down Expand Up @@ -97,6 +99,8 @@ export declare class Wid {

static isStatusV3(wid: string | Wid): boolean;

static isStatus(wid: string | Wid): boolean;

static isUser(wid: string | Wid): boolean;

static isLid(wid: string | Wid): boolean;
Expand Down

1 comment on commit dfae74d

@ariona
Copy link

@ariona ariona commented on dfae74d Jul 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error still persist, please check my issue here #2064

Please sign in to comment.