mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-12 05:17:28 -08:00
🐛 fix bug when sending audio
This commit is contained in:
parent
638310fa94
commit
2274b64694
|
@ -42,6 +42,10 @@ export class Telegram implements INodeType {
|
|||
name: 'resource',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Bot',
|
||||
value: 'bot',
|
||||
},
|
||||
{
|
||||
name: 'Chat',
|
||||
value: 'chat',
|
||||
|
@ -63,7 +67,31 @@ export class Telegram implements INodeType {
|
|||
description: 'The resource to operate on.',
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
// 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.',
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
// operation
|
||||
|
@ -926,6 +954,7 @@ export class Telegram implements INodeType {
|
|||
'sendPhoto',
|
||||
'sendSticker',
|
||||
'sendVideo',
|
||||
'sendAudio',
|
||||
],
|
||||
resource: [
|
||||
'message',
|
||||
|
@ -1554,7 +1583,11 @@ 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 === 'file') {
|
||||
|
||||
if (operation === 'get') {
|
||||
|
@ -1720,7 +1753,7 @@ export class Telegram implements INodeType {
|
|||
throw new Error(`The resource "${resource}" is not known!`);
|
||||
}
|
||||
|
||||
const responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||
let responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||
|
||||
if (resource === 'file' && operation === 'get') {
|
||||
if (this.getNodeParameter('download', i, false) as boolean === true) {
|
||||
|
@ -1746,6 +1779,13 @@ export class Telegram implements INodeType {
|
|||
}
|
||||
}
|
||||
|
||||
if (resource === 'bot' && operation === 'info') {
|
||||
responseData = {
|
||||
user: responseData.result[0].message.from,
|
||||
chat: responseData.result[0].message.chat,
|
||||
};
|
||||
}
|
||||
|
||||
returnData.push({ json: responseData });
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue