🔀 Merge branch 'maxdanilov-telegram-send-location'

This commit is contained in:
Jan Oberhauser 2021-02-21 21:52:05 +01:00
commit a94703804f

View file

@ -230,6 +230,11 @@ export class Telegram implements INodeType {
value: 'sendDocument', value: 'sendDocument',
description: 'Send a document', description: 'Send a document',
}, },
{
name: 'Send Location',
value: 'sendLocation',
description: 'Send a location',
},
{ {
name: 'Send Message', name: 'Send Message',
value: 'sendMessage', value: 'sendMessage',
@ -284,6 +289,7 @@ export class Telegram implements INodeType {
'sendAudio', 'sendAudio',
'sendChatAction', 'sendChatAction',
'sendDocument', 'sendDocument',
'sendLocation',
'sendMessage', 'sendMessage',
'sendMediaGroup', 'sendMediaGroup',
'sendPhoto', 'sendPhoto',
@ -811,6 +817,55 @@ export class Telegram implements INodeType {
}, },
// ----------------------------------
// message:sendLocation
// ----------------------------------
{
displayName: 'Latitude',
name: 'latitude',
type: 'number',
default: 0.0,
typeOptions: {
numberPrecision: 10,
minValue: -90,
maxValue: 90,
},
displayOptions: {
show: {
operation: [
'sendLocation',
],
resource: [
'message',
],
},
},
description: 'Location latitude',
},
{
displayName: 'Longitude',
name: 'longitude',
type: 'number',
typeOptions: {
numberPrecision: 10,
minValue: -180,
maxValue: 180,
},
default: 0.0,
displayOptions: {
show: {
operation: [
'sendLocation',
],
resource: [
'message',
],
},
},
description: 'Location longitude',
},
// ---------------------------------- // ----------------------------------
// message:sendMediaGroup // message:sendMediaGroup
// ---------------------------------- // ----------------------------------
@ -999,7 +1054,7 @@ export class Telegram implements INodeType {
// ---------------------------------- // ----------------------------------
// message:editMessageText/sendAnimation/sendAudio/sendMessage/sendPhoto/sendSticker/sendVideo // message:editMessageText/sendAnimation/sendAudio/sendLocation/sendMessage/sendPhoto/sendSticker/sendVideo
// ---------------------------------- // ----------------------------------
{ {
@ -1015,6 +1070,7 @@ export class Telegram implements INodeType {
'sendSticker', 'sendSticker',
'sendVideo', 'sendVideo',
'sendAudio', 'sendAudio',
'sendLocation',
], ],
resource: [ resource: [
'message', 'message',
@ -1340,6 +1396,7 @@ export class Telegram implements INodeType {
'sendAnimation', 'sendAnimation',
'sendAudio', 'sendAudio',
'sendDocument', 'sendDocument',
'sendLocation',
'sendMessage', 'sendMessage',
'sendMediaGroup', 'sendMediaGroup',
'sendPhoto', 'sendPhoto',
@ -1757,6 +1814,20 @@ export class Telegram implements INodeType {
// Add additional fields and replyMarkup // Add additional fields and replyMarkup
addAdditionalFields.call(this, body, i); addAdditionalFields.call(this, body, i);
} else if (operation === 'sendLocation') {
// ----------------------------------
// message:sendLocation
// ----------------------------------
endpoint = 'sendLocation';
body.chat_id = this.getNodeParameter('chatId', i) as string;
body.latitude = this.getNodeParameter('latitude', i) as string;
body.longitude = this.getNodeParameter('longitude', i) as string;
// Add additional fields and replyMarkup
addAdditionalFields.call(this, body, i);
} else if (operation === 'sendMessage') { } else if (operation === 'sendMessage') {
// ---------------------------------- // ----------------------------------
// message:sendMessage // message:sendMessage