Comment bot:info as the endpoint stopped working

This commit is contained in:
ricardo 2021-01-04 20:18:51 -05:00
parent 2274b64694
commit b989f129be

View file

@ -42,10 +42,10 @@ export class Telegram implements INodeType {
name: 'resource', name: 'resource',
type: 'options', type: 'options',
options: [ options: [
{ // {
name: 'Bot', // name: 'Bot',
value: 'bot', // value: 'bot',
}, // },
{ {
name: 'Chat', name: 'Chat',
value: 'chat', value: 'chat',
@ -71,27 +71,27 @@ export class Telegram implements INodeType {
// operation // operation
// ---------------------------------- // ----------------------------------
{ // {
displayName: 'Operation', // displayName: 'Operation',
name: 'operation', // name: 'operation',
type: 'options', // type: 'options',
displayOptions: { // displayOptions: {
show: { // show: {
resource: [ // resource: [
'bot', // 'bot',
], // ],
}, // },
}, // },
options: [ // options: [
{ // {
name: 'Info', // name: 'Info',
value: 'info', // value: 'info',
description: 'Get information about the bot associated with the access token.', // description: 'Get information about the bot associated with the access token.',
}, // },
], // ],
default: 'info', // default: 'info',
description: 'The operation to perform.', // description: 'The operation to perform.',
}, // },
// ---------------------------------- // ----------------------------------
// operation // operation
@ -1583,11 +1583,10 @@ export class Telegram implements INodeType {
body.title = this.getNodeParameter('title', i) as string; body.title = this.getNodeParameter('title', i) as string;
} }
} else if (resource === 'bot') { // } else if (resource === 'bot') {
if (operation === 'info') { // if (operation === 'info') {
endpoint = 'getUpdates'; // endpoint = 'getUpdates';
} // }
} else if (resource === 'file') { } else if (resource === 'file') {
if (operation === 'get') { if (operation === 'get') {
@ -1753,7 +1752,7 @@ export class Telegram implements INodeType {
throw new Error(`The resource "${resource}" is not known!`); throw new Error(`The resource "${resource}" is not known!`);
} }
let responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs); const responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
if (resource === 'file' && operation === 'get') { if (resource === 'file' && operation === 'get') {
if (this.getNodeParameter('download', i, false) as boolean === true) { if (this.getNodeParameter('download', i, false) as boolean === true) {
@ -1779,12 +1778,12 @@ export class Telegram implements INodeType {
} }
} }
if (resource === 'bot' && operation === 'info') { // if (resource === 'bot' && operation === 'info') {
responseData = { // responseData = {
user: responseData.result[0].message.from, // user: responseData.result[0].message.from,
chat: responseData.result[0].message.chat, // chat: responseData.result[0].message.chat,
}; // };
} // }
returnData.push({ json: responseData }); returnData.push({ json: responseData });
} }