naruyaizumi
Version:
A WebSockets library for interacting with WhatsApp Web
30 lines (29 loc) • 756 B
JavaScript
import { assertNodeErrorFree } from "../../WABinary/index.js";
import { USyncUser } from "../USyncUser.js";
export class USyncContactProtocol {
constructor() {
this.name = "contact";
}
getQueryElement() {
return {
tag: "contact",
attrs: {},
};
}
getUserElement(user) {
//TODO: Implement type / username fields (not yet supported)
return {
tag: "contact",
attrs: {},
content: user.phone,
};
}
parser(node) {
if (node.tag === "contact") {
assertNodeErrorFree(node);
return node?.attrs?.type === "in";
}
return false;
}
}
//# sourceMappingURL=USyncContactProtocol.js.map