mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-18 11:39:14 +00:00
feat: Send and receive location
This commit is contained in:
@@ -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
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user