feat: pin/unpin messages (#2692)
* feat: add Message.pin and Message.unpin methods * feat: added usage example * docs: clarifications
This commit is contained in:
parent
2100853727
commit
8d683a668b
4 changed files with 56 additions and 1 deletions
|
|
@ -58,6 +58,7 @@ exports.ExposeStore = (moduleRaidStr) => {
|
|||
window.Store.LidUtils = window.mR.findModule('getCurrentLid')[0];
|
||||
window.Store.WidToJid = window.mR.findModule('widToUserJid')[0];
|
||||
window.Store.JidToWid = window.mR.findModule('userJidToUserWid')[0];
|
||||
window.Store.pinUnpinMsg = window.mR.findModule('sendPinInChatMsg')[0].sendPinInChatMsg;
|
||||
|
||||
/* eslint-disable no-undef, no-cond-assign */
|
||||
window.Store.QueryExist = ((m = window.mR.findModule('queryExists')[0]) ? m.queryExists : window.mR.findModule('queryExist')[0].queryWidExists);
|
||||
|
|
@ -1083,4 +1084,12 @@ exports.LoadUtils = () => {
|
|||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
window.WWebJS.pinUnpinMsgAction = async (msgId, action, duration) => {
|
||||
const message = window.Store.Msg.get(msgId);
|
||||
if (!message) return false;
|
||||
const response = await window.Store.pinUnpinMsg(message, action, duration);
|
||||
if (response.messageSendResult === 'OK') return true;
|
||||
return false;
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue