mirror of
https://github.com/hexastack/hexabot
synced 2025-04-19 05:45:36 +00:00
Merge pull request #468 from Hexastack/fix/enforce-getMessage-typing
fix: type getMessage()
This commit is contained in:
commit
7b9a2e1977
@ -227,7 +227,7 @@ export default abstract class EventWrapper<
|
||||
*
|
||||
* @returns The received message
|
||||
*/
|
||||
abstract getMessage(): any;
|
||||
abstract getMessage(): StdIncomingMessage;
|
||||
|
||||
/**
|
||||
* Return the text message received
|
||||
|
@ -136,11 +136,13 @@ export class ConversationService extends BaseService<
|
||||
}
|
||||
|
||||
// Handle attachments (location, ...)
|
||||
if (msgType === 'location') {
|
||||
const coordinates = event.getMessage().coordinates;
|
||||
convo.context.user_location = { lat: 0, lon: 0 };
|
||||
convo.context.user_location.lat = parseFloat(coordinates.lat);
|
||||
convo.context.user_location.lon = parseFloat(coordinates.lon);
|
||||
const msg = event.getMessage();
|
||||
if (msgType === 'location' && 'coordinates' in msg) {
|
||||
const coordinates = msg.coordinates;
|
||||
convo.context.user_location = {
|
||||
lat: parseFloat(coordinates.lat.toString()),
|
||||
lon: parseFloat(coordinates.lon.toString()),
|
||||
};
|
||||
} else if (msgType === 'attachments') {
|
||||
// @TODO : deprecated in favor of geolocation msgType
|
||||
const attachments = event.getAttachments();
|
||||
|
Loading…
Reference in New Issue
Block a user