fix: type getMessage()

This commit is contained in:
Mohamed Marrouchi 2024-12-19 14:38:19 +01:00
parent 84f25ecfb1
commit 3d974356d0
2 changed files with 6 additions and 5 deletions

View File

@ -227,7 +227,7 @@ export default abstract class EventWrapper<
* *
* @returns The received message * @returns The received message
*/ */
abstract getMessage(): any; abstract getMessage(): StdIncomingMessage;
/** /**
* Return the text message received * Return the text message received

View File

@ -136,11 +136,12 @@ export class ConversationService extends BaseService<
} }
// Handle attachments (location, ...) // Handle attachments (location, ...)
if (msgType === 'location') { const msg = event.getMessage();
const coordinates = event.getMessage().coordinates; if (msgType === 'location' && 'coordinates' in msg) {
const coordinates = msg.coordinates;
convo.context.user_location = { lat: 0, lon: 0 }; convo.context.user_location = { lat: 0, lon: 0 };
convo.context.user_location.lat = parseFloat(coordinates.lat); convo.context.user_location.lat = parseFloat(coordinates.lat.toString());
convo.context.user_location.lon = parseFloat(coordinates.lon); convo.context.user_location.lon = parseFloat(coordinates.lon.toString());
} else if (msgType === 'attachments') { } else if (msgType === 'attachments') {
// @TODO : deprecated in favor of geolocation msgType // @TODO : deprecated in favor of geolocation msgType
const attachments = event.getAttachments(); const attachments = event.getAttachments();