Skip to content

Commit

Permalink
fix: Fixed send location (close #961)
Browse files Browse the repository at this point in the history
  • Loading branch information
icleitoncosta committed Nov 2, 2022
1 parent 5ed97e4 commit f05e86d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/controller/messageController.js
Expand Up @@ -160,12 +160,12 @@ export async function sendLinkPreview(req, res) {
}

export async function sendLocation(req, res) {
const { phone, lat, lng, title } = req.body;
const { phone, lat, lng, title, address } = req.body;

try {
let results = [];
for (const contato of phone) {
results.push(await req.client.sendLocation(contato, lat, lng, title));
results.push(await req.client.sendLocation(contato, { lat: lat, lng: lng, address: address, name: title }));
}

if (results.length === 0) return res.status(400).json('Error sending message');
Expand Down
3 changes: 2 additions & 1 deletion src/swagger.json
Expand Up @@ -6573,7 +6573,8 @@
"phone": "556593077171",
"lat": -15.60612977568185,
"lng": -56.058632011951005,
"title": "latitude 0 long 0"
"title": "WPP Connect",
"address": "Rua Brasil, 0, Centro, Rio de Janeiro - RJ"
}
}
},
Expand Down

0 comments on commit f05e86d

Please sign in to comment.