Hello, how use this function? Any example please. Thanks.
in neededonbejcts add this
{ id: "AddAndSendMsgToChat", conditions: (module) => (module.addAndSendMsgToChat) ? module.addAndSendMsgToChat : null },
and change function to
window.WAPI.sendVCard = async function (chatId, vcard) {
var chat = Store.Chat.get(chatId);
var tempMsg = Object.create(Store.Msg.models.filter(msg => msg.__x_isSentByMe)[0]);
var newId = window.WAPI.getNewMessageId(chatId);
var extend = {
ack : 0,
id : newId,
local : !0,
self : "out",
t : parseInt(new Date().getTime() / 1000),
to : chatId,
isNewMsg: !0,
};
if (Array.isArray(vcard)) {
Object.assign(extend, {
type : "multi_vcard",
vcardList: vcard
});
delete extend.body;
} else {
Object.assign(extend, {
type : "vcard",
subtype: vcard.displayName,
body : vcard.vcard
});
Hello, how use this function? Any example please. Thanks.
in neededonbejcts add this { id: "AddAndSendMsgToChat", conditions: (module) => (module.addAndSendMsgToChat) ? module.addAndSendMsgToChat : null },
and change function to
window.WAPI.sendVCard = async function (chatId, vcard) { var chat = Store.Chat.get(chatId); var tempMsg = Object.create(Store.Msg.models.filter(msg => msg.__x_isSentByMe)[0]); var newId = window.WAPI.getNewMessageId(chatId);
var extend = { ack : 0, id : newId, local : !0, self : "out", t : parseInt(new Date().getTime() / 1000), to : chatId, isNewMsg: !0, };
if (Array.isArray(vcard)) { Object.assign(extend, { type : "multi_vcard", vcardList: vcard });
} else { Object.assign(extend, { type : "vcard", subtype: vcard.displayName, body : vcard.vcard });
}
Object.assign(tempMsg, extend);
await Promise.all(Store.AddAndSendMsgToChat(chat, tempMsg)) };