Skip to content

Commit

Permalink
fix: Allow string values for lat and lng for WPP.chat.sendLocationMes…
Browse files Browse the repository at this point in the history
…sage function
  • Loading branch information
edgardmessias committed May 28, 2022
1 parent 8657dd1 commit 02b174f
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/chat/functions/sendLocationMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ export interface LocationMessageOptions
/**
* latitude in degrees
*/
lat: number;
lat: number | string;
/**
* longitude in degrees
*/
lng: number;
lng: number | string;
/**
* The full address of place
*/
Expand Down Expand Up @@ -125,6 +125,14 @@ export async function sendLocationMessage(
? `${options.name}\n${options.address}`
: options.name || options.address || '';

if (typeof options.lat === 'string') {
options.lat = parseFloat(options.lat);
}

if (typeof options.lng === 'string') {
options.lng = parseFloat(options.lng);
}

let rawMessage: RawMessage = {
type: 'location',
lat: options.lat,
Expand Down

0 comments on commit 02b174f

Please sign in to comment.