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',
type: 'options',
options: [
{
name: 'Bot',
value: 'bot',
},
// {
// name: 'Bot',
// value: 'bot',
// },
{
name: 'Chat',
value: 'chat',
@ -71,27 +71,27 @@ export class Telegram implements INodeType {
// operation
// ----------------------------------
{
displayName: 'Operation',
name: 'operation',
type: 'options',
displayOptions: {
show: {
resource: [
'bot',
],
},
},
options: [
{
name: 'Info',
value: 'info',
description: 'Get information about the bot associated with the access token.',
},
],
default: 'info',
description: 'The operation to perform.',
},
// {
// displayName: 'Operation',
// name: 'operation',
// type: 'options',
// displayOptions: {
// show: {
// resource: [
// 'bot',
// ],
// },
// },
// options: [
// {
// name: 'Info',
// value: 'info',
// description: 'Get information about the bot associated with the access token.',
// },
// ],
// default: 'info',
// description: 'The operation to perform.',
// },
// ----------------------------------
// operation
@ -1583,11 +1583,10 @@ export class Telegram implements INodeType {
body.title = this.getNodeParameter('title', i) as string;
}
} else if (resource === 'bot') {
if (operation === 'info') {
endpoint = 'getUpdates';
}
// } else if (resource === 'bot') {
// if (operation === 'info') {
// endpoint = 'getUpdates';
// }
} else if (resource === 'file') {
if (operation === 'get') {
@ -1753,7 +1752,7 @@ export class Telegram implements INodeType {
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 (this.getNodeParameter('download', i, false) as boolean === true) {
@ -1779,12 +1778,12 @@ export class Telegram implements INodeType {
}
}
if (resource === 'bot' && operation === 'info') {
responseData = {
user: responseData.result[0].message.from,
chat: responseData.result[0].message.chat,
};
}
// if (resource === 'bot' && operation === 'info') {
// responseData = {
// user: responseData.result[0].message.from,
// chat: responseData.result[0].message.chat,
// };
// }
returnData.push({ json: responseData });
}