Skip to content

Commit

Permalink
Fix args.type check for isMessage.
Browse files Browse the repository at this point in the history
Fix logical bug in type guard.
  • Loading branch information
SpacingBat3 committed May 4, 2024
1 parent 4345123 commit 7d25f7c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sources/common/packet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,14 +254,14 @@ export function isMessage<C extends code|undefined=undefined,T extends type|unde
if(argsType !== undefined && typeof (data as Message<"DEEP_LINK",string>).args.params === "object")
switch(argsType) {
case "CHANNEL":
if(!checkRecord(
if(!(checkRecord(
(data as Message<"DEEP_LINK",string>).args.params,
["guildId", "channelId", "search", "fingerprint"] as const,
"string"
) || (data as Message<"DEEP_LINK","CHANNEL">).args.params.channelId !== undefined)
) || (data as Message<"DEEP_LINK","CHANNEL">).args.params.channelId === undefined))
return false;
}

// All is "good enough"
return true;
}
Expand Down

0 comments on commit 7d25f7c

Please sign in to comment.