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: [
|
options: [
|
||||||
|
{
|
||||||
|
name: 'Delete Chat Message',
|
||||||
|
value: 'deleteMessage',
|
||||||
|
description: 'Delete a chat message',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'Edit Message Text',
|
name: 'Edit Message Text',
|
||||||
value: 'editMessageText',
|
value: 'editMessageText',
|
||||||
|
@ -210,11 +215,6 @@ export class Telegram implements INodeType {
|
||||||
value: 'pinChatMessage',
|
value: 'pinChatMessage',
|
||||||
description: 'Pin a chat message',
|
description: 'Pin a chat message',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: 'Unpin Chat Message',
|
|
||||||
value: 'unpinChatMessage',
|
|
||||||
description: 'Unpin a chat message',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: 'Send Animation',
|
name: 'Send Animation',
|
||||||
value: 'sendAnimation',
|
value: 'sendAnimation',
|
||||||
|
@ -240,16 +240,16 @@ export class Telegram implements INodeType {
|
||||||
value: 'sendLocation',
|
value: 'sendLocation',
|
||||||
description: 'Send a location',
|
description: 'Send a location',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: 'Send Message',
|
|
||||||
value: 'sendMessage',
|
|
||||||
description: 'Send a text message',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: 'Send Media Group',
|
name: 'Send Media Group',
|
||||||
value: 'sendMediaGroup',
|
value: 'sendMediaGroup',
|
||||||
description: 'Send group of photos or videos to album',
|
description: 'Send group of photos or videos to album',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'Send Message',
|
||||||
|
value: 'sendMessage',
|
||||||
|
description: 'Send a text message',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'Send Photo',
|
name: 'Send Photo',
|
||||||
value: 'sendPhoto',
|
value: 'sendPhoto',
|
||||||
|
@ -265,6 +265,11 @@ export class Telegram implements INodeType {
|
||||||
value: 'sendVideo',
|
value: 'sendVideo',
|
||||||
description: 'Send a video',
|
description: 'Send a video',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'Unpin Chat Message',
|
||||||
|
value: 'unpinChatMessage',
|
||||||
|
description: 'Unpin a chat message',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
default: 'sendMessage',
|
default: 'sendMessage',
|
||||||
description: 'The operation to perform.',
|
description: 'The operation to perform.',
|
||||||
|
@ -283,11 +288,11 @@ export class Telegram implements INodeType {
|
||||||
displayOptions: {
|
displayOptions: {
|
||||||
show: {
|
show: {
|
||||||
operation: [
|
operation: [
|
||||||
|
'deleteMessage',
|
||||||
'get',
|
'get',
|
||||||
'leave',
|
'leave',
|
||||||
'member',
|
'member',
|
||||||
'pinChatMessage',
|
'pinChatMessage',
|
||||||
'unpinChatMessage',
|
|
||||||
'setDescription',
|
'setDescription',
|
||||||
'setTitle',
|
'setTitle',
|
||||||
'sendAnimation',
|
'sendAnimation',
|
||||||
|
@ -300,6 +305,7 @@ export class Telegram implements INodeType {
|
||||||
'sendPhoto',
|
'sendPhoto',
|
||||||
'sendSticker',
|
'sendSticker',
|
||||||
'sendVideo',
|
'sendVideo',
|
||||||
|
'unpinChatMessage',
|
||||||
],
|
],
|
||||||
resource: [
|
resource: [
|
||||||
'chat',
|
'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).',
|
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
|
// message:pinChatMessage
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
|
@ -1849,6 +1877,16 @@ 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 === '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') {
|
} else if (operation === 'pinChatMessage') {
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
// message:pinChatMessage
|
// message:pinChatMessage
|
||||||
|
|
Loading…
Reference in a new issue