diff --git a/packages/nodes-base/nodes/Telegram/Telegram.node.ts b/packages/nodes-base/nodes/Telegram/Telegram.node.ts index 8f5ee6a254..f07cce57e8 100644 --- a/packages/nodes-base/nodes/Telegram/Telegram.node.ts +++ b/packages/nodes-base/nodes/Telegram/Telegram.node.ts @@ -200,6 +200,11 @@ export class Telegram implements INodeType { }, }, options: [ + { + name: 'Delete Chat Message', + value: 'deleteMessage', + description: 'Delete a chat message', + }, { name: 'Edit Message Text', value: 'editMessageText', @@ -210,11 +215,6 @@ export class Telegram implements INodeType { value: 'pinChatMessage', description: 'Pin a chat message', }, - { - name: 'Unpin Chat Message', - value: 'unpinChatMessage', - description: 'Unpin a chat message', - }, { name: 'Send Animation', value: 'sendAnimation', @@ -240,16 +240,16 @@ export class Telegram implements INodeType { value: 'sendLocation', description: 'Send a location', }, - { - name: 'Send Message', - value: 'sendMessage', - description: 'Send a text message', - }, { name: 'Send Media Group', value: 'sendMediaGroup', description: 'Send group of photos or videos to album', }, + { + name: 'Send Message', + value: 'sendMessage', + description: 'Send a text message', + }, { name: 'Send Photo', value: 'sendPhoto', @@ -265,6 +265,11 @@ export class Telegram implements INodeType { value: 'sendVideo', description: 'Send a video', }, + { + name: 'Unpin Chat Message', + value: 'unpinChatMessage', + description: 'Unpin a chat message', + }, ], default: 'sendMessage', description: 'The operation to perform.', @@ -283,11 +288,11 @@ export class Telegram implements INodeType { displayOptions: { show: { operation: [ + 'deleteMessage', 'get', 'leave', 'member', 'pinChatMessage', - 'unpinChatMessage', 'setDescription', 'setTitle', 'sendAnimation', @@ -300,6 +305,7 @@ export class Telegram implements INodeType { 'sendPhoto', 'sendSticker', 'sendVideo', + 'unpinChatMessage', ], resource: [ 'chat', @@ -311,6 +317,28 @@ export class Telegram implements INodeType { description: 'Unique identifier for the target chat or username of the target
channel (in the format @channelusername).', }, + // ---------------------------------- + // message:deleteMessage + // ---------------------------------- + { + displayName: 'Message ID', + name: 'messageId', + type: 'string', + default: '', + displayOptions: { + show: { + operation: [ + 'deleteMessage', + ], + resource: [ + 'message', + ], + }, + }, + required: true, + description: 'Unique identifier of the message to delete.', + }, + // ---------------------------------- // message:pinChatMessage // ---------------------------------- @@ -1849,6 +1877,16 @@ export class Telegram implements INodeType { // Add additional fields and replyMarkup addAdditionalFields.call(this, body, i); + } else if (operation === 'deleteMessage') { + // ---------------------------------- + // message:deleteMessage + // ---------------------------------- + + endpoint = 'deleteMessage'; + + body.chat_id = this.getNodeParameter('chatId', i) as string; + body.message_id = this.getNodeParameter('messageId', i) as string; + } else if (operation === 'pinChatMessage') { // ---------------------------------- // message:pinChatMessage