mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-02 07:01:30 -08:00
🐛 Add missing function and remove debug messages from Telegram-Node
This commit is contained in:
parent
7ce760f9da
commit
161a74f65f
|
@ -134,9 +134,6 @@ export function addAdditionalFields(this: IExecuteFunctions, body: IDataObject,
|
||||||
* @returns {Promise<any>}
|
* @returns {Promise<any>}
|
||||||
*/
|
*/
|
||||||
export async function apiRequest(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, method: string, endpoint: string, body: object, query?: IDataObject): Promise<any> { // tslint:disable-line:no-any
|
export async function apiRequest(this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, method: string, endpoint: string, body: object, query?: IDataObject): Promise<any> { // tslint:disable-line:no-any
|
||||||
console.log('');
|
|
||||||
console.log('============ apiRequest ===========');
|
|
||||||
|
|
||||||
const credentials = this.getCredentials('telegramApi');
|
const credentials = this.getCredentials('telegramApi');
|
||||||
|
|
||||||
if (credentials === undefined) {
|
if (credentials === undefined) {
|
||||||
|
@ -154,16 +151,9 @@ export async function apiRequest(this: IHookFunctions | IExecuteFunctions | ILoa
|
||||||
uri: `https://api.telegram.org/bot${credentials.accessToken}/${endpoint}`,
|
uri: `https://api.telegram.org/bot${credentials.accessToken}/${endpoint}`,
|
||||||
json: true,
|
json: true,
|
||||||
};
|
};
|
||||||
console.log(JSON.stringify(options, null, 2));
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
console.log('MAKE CALL');
|
return this.helpers.request!(options);
|
||||||
const response = await this.helpers.request!(options);
|
|
||||||
console.log('____response:');
|
|
||||||
console.log(JSON.stringify(response, null, 2));
|
|
||||||
|
|
||||||
return response;
|
|
||||||
// return this.helpers.request!(options);
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.statusCode === 401) {
|
if (error.statusCode === 401) {
|
||||||
// Return a clear error
|
// Return a clear error
|
||||||
|
|
|
@ -111,6 +111,9 @@ export class TelegramTrigger implements INodeType {
|
||||||
// @ts-ignore (because of request)
|
// @ts-ignore (because of request)
|
||||||
webhookMethods = {
|
webhookMethods = {
|
||||||
default: {
|
default: {
|
||||||
|
async checkExists(this: IHookFunctions): Promise<boolean> {
|
||||||
|
return false;
|
||||||
|
},
|
||||||
async create(this: IHookFunctions): Promise<boolean> {
|
async create(this: IHookFunctions): Promise<boolean> {
|
||||||
const webhookUrl = this.getNodeWebhookUrl('default');
|
const webhookUrl = this.getNodeWebhookUrl('default');
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue