sendMessageAction operation supports topics in supergroups

This commit is contained in:
Sergey Petrov 2024-05-21 23:03:35 +07:00
parent f003d939fc
commit 57a903cd5b
2 changed files with 60 additions and 59 deletions

View file

@ -118,14 +118,13 @@ export function addAdditionalFields(
Object.assign(body, additionalFields); Object.assign(body, additionalFields);
if (operation !== 'sendMediaGroup' && operation !== 'sendChatAction') {
// Add the reply markup // Add the reply markup
let replyMarkupOption = ''; let replyMarkupOption = '';
if (operation !== 'sendMediaGroup') {
replyMarkupOption = this.getNodeParameter('replyMarkup', index) as string; replyMarkupOption = this.getNodeParameter('replyMarkup', index) as string;
if (replyMarkupOption === 'none') { if (replyMarkupOption === 'none') {
return; return;
} }
}
body.reply_markup = {} as body.reply_markup = {} as
| IMarkupForceReply | IMarkupForceReply
@ -181,6 +180,7 @@ export function addAdditionalFields(
) as IMarkupReplyKeyboardOptions; ) as IMarkupReplyKeyboardOptions;
Object.assign(body.reply_markup, replyKeyboardOptions); Object.assign(body.reply_markup, replyKeyboardOptions);
} }
}
} }
/** /**

View file

@ -1454,6 +1454,7 @@ export class Telegram implements INodeType {
'editMessageText', 'editMessageText',
'sendAnimation', 'sendAnimation',
'sendAudio', 'sendAudio',
'sendChatAction',
'sendDocument', 'sendDocument',
'sendLocation', 'sendLocation',
'sendMessage', 'sendMessage',
@ -1506,7 +1507,7 @@ export class Telegram implements INodeType {
default: false, default: false,
displayOptions: { displayOptions: {
hide: { hide: {
'/operation': ['editMessageText'], '/operation': ['editMessageText', 'sendChatAction'],
}, },
}, },
description: description:
@ -1627,7 +1628,7 @@ export class Telegram implements INodeType {
type: 'number', type: 'number',
displayOptions: { displayOptions: {
hide: { hide: {
'/operation': ['editMessageText'], '/operation': ['editMessageText', 'sendChatAction'],
}, },
}, },
default: 0, default: 0,
@ -1909,7 +1910,7 @@ export class Telegram implements INodeType {
body.chat_id = this.getNodeParameter('chatId', i) as string; body.chat_id = this.getNodeParameter('chatId', i) as string;
body.action = this.getNodeParameter('action', i) as string; body.action = this.getNodeParameter('action', i) as string;
// Add additional fields (topic id) // Add additional fields
addAdditionalFields.call(this, body, i); addAdditionalFields.call(this, body, i);
} else if (operation === 'sendDocument') { } else if (operation === 'sendDocument') {
// ---------------------------------- // ----------------------------------