From 02b174f4f65ceccd751cef6f3cee79706b20cbe7 Mon Sep 17 00:00:00 2001 From: Edgard Date: Sat, 28 May 2022 16:54:16 -0300 Subject: [PATCH] fix: Allow string values for lat and lng for WPP.chat.sendLocationMessage function --- src/chat/functions/sendLocationMessage.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/chat/functions/sendLocationMessage.ts b/src/chat/functions/sendLocationMessage.ts index 466e7032d5..fb9d82fb19 100644 --- a/src/chat/functions/sendLocationMessage.ts +++ b/src/chat/functions/sendLocationMessage.ts @@ -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 */ @@ -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,