mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-19 20:19:14 +00:00
fix: expose GroupMetadata
WhatsApp Web v2.2045.15+ no longer has this in the store by default
This commit is contained in:
@@ -28,6 +28,7 @@ exports.ExposeStore = (moduleRaidStr) => {
|
|||||||
window.Store.Validators = window.mR.findModule('findLinks')[0];
|
window.Store.Validators = window.mR.findModule('findLinks')[0];
|
||||||
window.Store.WidFactory = window.mR.findModule('createWid')[0];
|
window.Store.WidFactory = window.mR.findModule('createWid')[0];
|
||||||
window.Store.BlockContact = window.mR.findModule('blockContact')[0];
|
window.Store.BlockContact = window.mR.findModule('blockContact')[0];
|
||||||
|
window.Store.GroupMetadata = window.mR.findModule((module) => module.default && module.default.handlePendingInvite)[0].default;
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.LoadUtils = () => {
|
exports.LoadUtils = () => {
|
||||||
@@ -89,7 +90,7 @@ exports.LoadUtils = () => {
|
|||||||
vcardFormattedName: contact.formattedName
|
vcardFormattedName: contact.formattedName
|
||||||
};
|
};
|
||||||
delete options.contactCard;
|
delete options.contactCard;
|
||||||
} else if(options.contactCardList) {
|
} else if (options.contactCardList) {
|
||||||
let contacts = options.contactCardList.map(c => window.Store.Contact.get(c));
|
let contacts = options.contactCardList.map(c => window.Store.Contact.get(c));
|
||||||
let vcards = contacts.map(c => window.Store.VCard.vcardFromContactModel(c));
|
let vcards = contacts.map(c => window.Store.VCard.vcardFromContactModel(c));
|
||||||
vcardOptions = {
|
vcardOptions = {
|
||||||
@@ -98,21 +99,21 @@ exports.LoadUtils = () => {
|
|||||||
body: undefined
|
body: undefined
|
||||||
};
|
};
|
||||||
delete options.contactCardList;
|
delete options.contactCardList;
|
||||||
} else if(options.parseVCards && typeof(content) === 'string' && content.startsWith('BEGIN:VCARD')) {
|
} else if (options.parseVCards && typeof (content) === 'string' && content.startsWith('BEGIN:VCARD')) {
|
||||||
delete options.parseVCards;
|
delete options.parseVCards;
|
||||||
try {
|
try {
|
||||||
const parsed = window.Store.VCard.parseVcard(content);
|
const parsed = window.Store.VCard.parseVcard(content);
|
||||||
if(parsed) {
|
if (parsed) {
|
||||||
vcardOptions = {
|
vcardOptions = {
|
||||||
type: 'vcard',
|
type: 'vcard',
|
||||||
vcardFormattedName: window.Store.VCard.vcardGetNameFromParsed(parsed)
|
vcardFormattedName: window.Store.VCard.vcardGetNameFromParsed(parsed)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
} catch(_) {
|
} catch (_) {
|
||||||
// not a vcard
|
// not a vcard
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.linkPreview) {
|
if (options.linkPreview) {
|
||||||
delete options.linkPreview;
|
delete options.linkPreview;
|
||||||
const link = window.Store.Validators.findLink(content);
|
const link = window.Store.Validators.findLink(content);
|
||||||
@@ -344,17 +345,17 @@ exports.LoadUtils = () => {
|
|||||||
|
|
||||||
window.WWebJS.sendChatstate = async (state, chatId) => {
|
window.WWebJS.sendChatstate = async (state, chatId) => {
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case 'typing':
|
case 'typing':
|
||||||
await window.Store.Wap.sendChatstateComposing(chatId);
|
await window.Store.Wap.sendChatstateComposing(chatId);
|
||||||
break;
|
break;
|
||||||
case 'recording':
|
case 'recording':
|
||||||
await window.Store.Wap.sendChatstateRecording(chatId);
|
await window.Store.Wap.sendChatstateRecording(chatId);
|
||||||
break;
|
break;
|
||||||
case 'stop':
|
case 'stop':
|
||||||
await window.Store.Wap.sendChatstatePaused(chatId);
|
await window.Store.Wap.sendChatstatePaused(chatId);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw 'Invalid chatstate';
|
throw 'Invalid chatstate';
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user