mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 20:24:05 -08:00
⚡ Add message deletion to Telegram node (#1980)
* ⚡ Add deleteMessage to Telegram node * ⚡ Fix order Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
parent
e2aa8ae9b8
commit
a3ec24e912
|
@ -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<br />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
|
||||
|
|
Loading…
Reference in a new issue