feat: Send and receive location
This commit is contained in:
parent
4b1768450f
commit
7b229a39a4
2 changed files with 66 additions and 3 deletions
|
|
@ -51,7 +51,9 @@ exports.MessageTypes = {
|
|||
IMAGE: 'image',
|
||||
VIDEO: 'video',
|
||||
DOCUMENT: 'document',
|
||||
STICKER: 'sticker'
|
||||
STICKER: 'sticker',
|
||||
LOCATION: 'location',
|
||||
REDACTED: 'redacted'
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ exports.ExposeStore = (moduleRaidStr) => {
|
|||
exports.LoadUtils = () => {
|
||||
window.WWebJS = {};
|
||||
|
||||
window.WWebJS.sendMessage = async (chat, content, options) => {
|
||||
window.WWebJS.sendMessage = async (chat, content, options={}) => {
|
||||
let attOptions = {};
|
||||
if (options.attachment) {
|
||||
attOptions = await window.WWebJS.processMediaData(options.attachment);
|
||||
|
|
@ -39,6 +39,17 @@ exports.LoadUtils = () => {
|
|||
}
|
||||
delete options.quotedMessageId;
|
||||
}
|
||||
|
||||
let locationOptions = {};
|
||||
if (options.location) {
|
||||
locationOptions = {
|
||||
type: 'location',
|
||||
loc: options.location.description,
|
||||
lat: options.location.latitude,
|
||||
lng: options.location.longitude
|
||||
};
|
||||
delete options.location;
|
||||
}
|
||||
|
||||
const newMsgId = new window.Store.MsgKey({
|
||||
from: window.Store.Conn.me,
|
||||
|
|
@ -58,6 +69,7 @@ exports.LoadUtils = () => {
|
|||
t: parseInt(new Date().getTime() / 1000),
|
||||
isNewMsg: true,
|
||||
type: 'chat',
|
||||
...locationOptions,
|
||||
...attOptions,
|
||||
...quotedMsgOptions
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue