Add sendAnimation functionality to Telegram

This commit is contained in:
Jan Oberhauser 2020-09-04 10:30:49 +02:00
parent 5e0ff8fce7
commit c42ae57dc1

View file

@ -146,6 +146,11 @@ export class Telegram implements INodeType {
value: 'editMessageText', value: 'editMessageText',
description: 'Edit a text message', description: 'Edit a text message',
}, },
{
name: 'Send Animation',
value: 'sendAnimation',
description: 'Send an animated file',
},
{ {
name: 'Send Audio', name: 'Send Audio',
value: 'sendAudio', value: 'sendAudio',
@ -209,6 +214,7 @@ export class Telegram implements INodeType {
'member', 'member',
'setDescription', 'setDescription',
'setTitle', 'setTitle',
'sendAnimation',
'sendAudio', 'sendAudio',
'sendChatAction', 'sendChatAction',
'sendDocument', 'sendDocument',
@ -513,6 +519,29 @@ export class Telegram implements INodeType {
// ----------------------------------
// message:sendAnimation
// ----------------------------------
{
displayName: 'Animation',
name: 'file',
type: 'string',
default: '',
displayOptions: {
show: {
operation: [
'sendAnimation'
],
resource: [
'message',
],
},
},
description: 'Animation to send. Pass a file_id to send an animation that exists on the Telegram servers (recommended)<br />or pass an HTTP URL for Telegram to get an animation from the Internet.',
},
// ---------------------------------- // ----------------------------------
// message:sendAudio // message:sendAudio
// ---------------------------------- // ----------------------------------
@ -811,7 +840,7 @@ export class Telegram implements INodeType {
// ---------------------------------- // ----------------------------------
// message:editMessageText/sendAudio/sendMessage/sendPhoto/sendSticker/sendVideo // message:editMessageText/sendAnimation/sendAudio/sendMessage/sendPhoto/sendSticker/sendVideo
// ---------------------------------- // ----------------------------------
{ {
@ -820,6 +849,7 @@ export class Telegram implements INodeType {
displayOptions: { displayOptions: {
show: { show: {
operation: [ operation: [
'sendAnimation',
'sendDocument', 'sendDocument',
'sendMessage', 'sendMessage',
'sendPhoto', 'sendPhoto',
@ -1147,6 +1177,7 @@ export class Telegram implements INodeType {
show: { show: {
operation: [ operation: [
'editMessageText', 'editMessageText',
'sendAnimation',
'sendDocument', 'sendDocument',
'sendMessage', 'sendMessage',
'sendMediaGroup', 'sendMediaGroup',
@ -1171,6 +1202,7 @@ export class Telegram implements INodeType {
displayOptions: { displayOptions: {
show: { show: {
'/operation': [ '/operation': [
'sendAnimation',
'sendAudio', 'sendAudio',
'sendDocument', 'sendDocument',
'sendPhoto', 'sendPhoto',
@ -1220,6 +1252,7 @@ export class Telegram implements INodeType {
displayOptions: { displayOptions: {
show: { show: {
'/operation': [ '/operation': [
'sendAnimation',
'sendAudio', 'sendAudio',
'sendVideo', 'sendVideo',
], ],
@ -1238,6 +1271,7 @@ export class Telegram implements INodeType {
displayOptions: { displayOptions: {
show: { show: {
'/operation': [ '/operation': [
'sendAnimation',
'sendVideo', 'sendVideo',
], ],
}, },
@ -1263,6 +1297,7 @@ export class Telegram implements INodeType {
show: { show: {
'/operation': [ '/operation': [
'editMessageText', 'editMessageText',
'sendAnimation',
'sendAudio', 'sendAudio',
'sendMessage', 'sendMessage',
'sendPhoto', 'sendPhoto',
@ -1325,6 +1360,7 @@ export class Telegram implements INodeType {
displayOptions: { displayOptions: {
show: { show: {
'/operation': [ '/operation': [
'sendAnimation',
'sendAudio', 'sendAudio',
'sendDocument', 'sendDocument',
'sendVideo', 'sendVideo',
@ -1344,6 +1380,7 @@ export class Telegram implements INodeType {
displayOptions: { displayOptions: {
show: { show: {
'/operation': [ '/operation': [
'sendAnimation',
'sendVideo', 'sendVideo',
], ],
}, },
@ -1469,6 +1506,21 @@ 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 === 'sendAnimation') {
// ----------------------------------
// message:sendAnimation
// ----------------------------------
endpoint = 'sendAnimation';
body.chat_id = this.getNodeParameter('chatId', i) as string;
body.animation = this.getNodeParameter('file', i) as string;
// Add additional fields and replyMarkup
addAdditionalFields.call(this, body, i);
} else if (operation === 'sendAudio') { } else if (operation === 'sendAudio') {
// ---------------------------------- // ----------------------------------
// message:sendAudio // message:sendAudio