|
|
|
@ -89,7 +89,17 @@ const waiMsgTypeMapped = {
|
|
|
|
...(msg.msgcontent.context ? { quoted: { key: msg.msgcontent.context.message_id } } : {}),
|
|
|
|
...(msg.msgcontent.context ? { quoted: { key: msg.msgcontent.context.message_id } } : {}),
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
waiContentToDB: msg => {
|
|
|
|
waiContentToDB: msg => {
|
|
|
|
return { text_body: msg.text.body, actionId: msg?.externalId, externalId: (msg?.externalId || '').split('.')?.[0] };
|
|
|
|
return {
|
|
|
|
|
|
|
|
text_body: msg.text.body,
|
|
|
|
|
|
|
|
actionId: msg?.externalId,
|
|
|
|
|
|
|
|
externalId: (msg?.externalId || '').split('.')?.[0],
|
|
|
|
|
|
|
|
...(msg.context
|
|
|
|
|
|
|
|
? {
|
|
|
|
|
|
|
|
context_id: msg.context.id,
|
|
|
|
|
|
|
|
context_from: msg.context.from,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
: {}),
|
|
|
|
|
|
|
|
};
|
|
|
|
},
|
|
|
|
},
|
|
|
|
dataToDB: msg => {
|
|
|
|
dataToDB: msg => {
|
|
|
|
const { msgcontent } = msg;
|
|
|
|
const { msgcontent } = msg;
|
|
|
|
@ -162,22 +172,21 @@ const waiMsgTypeMapped = {
|
|
|
|
dataToDB: msg => mediaMsg.dataToDB(msg),
|
|
|
|
dataToDB: msg => mediaMsg.dataToDB(msg),
|
|
|
|
DbData: msg => mediaMsg.DbData(msg),
|
|
|
|
DbData: msg => mediaMsg.DbData(msg),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
react: {
|
|
|
|
reaction: {
|
|
|
|
type: 'react',
|
|
|
|
type: 'reaction',
|
|
|
|
contentToSend: msg => ({
|
|
|
|
contentToSend: msg => ({
|
|
|
|
// ...msg,
|
|
|
|
// ...msg,
|
|
|
|
to: msg.to,
|
|
|
|
to: msg.to,
|
|
|
|
externalId: msg.actionId,
|
|
|
|
externalId: msg.actionId,
|
|
|
|
react: {
|
|
|
|
reaction: {
|
|
|
|
text: msg.msgcontent.body, // emoji | use an empty string to remove the reaction
|
|
|
|
text: msg.msgcontent.body, // emoji | use an empty string to remove the reaction
|
|
|
|
key: msg.msgcontent.context.message_id,
|
|
|
|
key: msg.msgcontent.context.message_id,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
waiContentToDB: msg => {
|
|
|
|
waiContentToDB: msg => {
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
// todo:
|
|
|
|
reaction_message_id: msg?.reaction?.message_id || '',
|
|
|
|
reaction_message_id: '',
|
|
|
|
reaction_emoji: msg?.reaction?.emoji || '',
|
|
|
|
reaction_emoji: '',
|
|
|
|
|
|
|
|
actionId: msg?.externalId,
|
|
|
|
actionId: msg?.externalId,
|
|
|
|
externalId: (msg?.externalId || '').split('.')?.[0],
|
|
|
|
externalId: (msg?.externalId || '').split('.')?.[0],
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|