mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-11 12:57:29 -08:00
✨ Add answerinlinequery option to Telegram (#1556)
* telegram node: add answerinlinequery option * remove comments
This commit is contained in:
parent
68c14979d3
commit
0d8602de5e
|
@ -156,11 +156,15 @@ export class Telegram implements INodeType {
|
||||||
value: 'answerQuery',
|
value: 'answerQuery',
|
||||||
description: 'Send answer to callback query sent from inline keyboard.',
|
description: 'Send answer to callback query sent from inline keyboard.',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'Answer Inline Query',
|
||||||
|
value: 'answerInlineQuery',
|
||||||
|
description: 'Send answer to callback query sent from inline bot.',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
default: 'answerQuery',
|
default: 'answerQuery',
|
||||||
description: 'The operation to perform.',
|
description: 'The operation to perform.',
|
||||||
},
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
displayName: 'Operation',
|
displayName: 'Operation',
|
||||||
name: 'operation',
|
name: 'operation',
|
||||||
|
@ -508,13 +512,104 @@ export class Telegram implements INodeType {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// -----------------------------------------------
|
||||||
|
// callback:answerInlineQuery
|
||||||
|
// -----------------------------------------------
|
||||||
|
{
|
||||||
|
displayName: 'Query ID',
|
||||||
|
name: 'queryId',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
operation: [
|
||||||
|
'answerInlineQuery',
|
||||||
|
],
|
||||||
|
resource: [
|
||||||
|
'callback',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: true,
|
||||||
|
description: 'Unique identifier for the answered query.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Results',
|
||||||
|
name: 'results',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
operation: [
|
||||||
|
'answerInlineQuery',
|
||||||
|
],
|
||||||
|
resource: [
|
||||||
|
'callback',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
required: true,
|
||||||
|
description: 'A JSON-serialized array of results for the inline query.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Additional Fields',
|
||||||
|
name: 'additionalFields',
|
||||||
|
type: 'collection',
|
||||||
|
placeholder: 'Add Field',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
operation: [
|
||||||
|
'answerInlineQuery',
|
||||||
|
],
|
||||||
|
resource: [
|
||||||
|
'callback',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
default: {},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
displayName: 'Cache Time',
|
||||||
|
name: 'cache_time',
|
||||||
|
type: 'number',
|
||||||
|
typeOptions: {
|
||||||
|
minValue: 0,
|
||||||
|
},
|
||||||
|
default: 0,
|
||||||
|
description: 'The maximum amount of time in seconds that the result of the callback query may be cached client-side.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Show Alert',
|
||||||
|
name: 'show_alert',
|
||||||
|
type: 'boolean',
|
||||||
|
default: false,
|
||||||
|
description: 'If true, an alert will be shown by the client instead of a notification at the top of the chat screen.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Text',
|
||||||
|
name: 'text',
|
||||||
|
type: 'string',
|
||||||
|
typeOptions: {
|
||||||
|
alwaysOpenEditWindow: true,
|
||||||
|
},
|
||||||
|
default: '',
|
||||||
|
description: 'Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'URL',
|
||||||
|
name: 'url',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
description: 'URL that will be opened by the user\'s client.',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
// file
|
// file
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
// file:get/download
|
// file:get/download
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
|
@ -1649,7 +1744,21 @@ export class Telegram implements INodeType {
|
||||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||||
Object.assign(body, additionalFields);
|
Object.assign(body, additionalFields);
|
||||||
|
|
||||||
|
} else if (operation === 'answerInlineQuery') {
|
||||||
|
// -----------------------------------------------
|
||||||
|
// callback:answerInlineQuery
|
||||||
|
// -----------------------------------------------
|
||||||
|
|
||||||
|
endpoint = 'answerInlineQuery';
|
||||||
|
|
||||||
|
body.inline_query_id = this.getNodeParameter('queryId', i) as string;
|
||||||
|
body.results = this.getNodeParameter('results', i) as string;
|
||||||
|
|
||||||
|
// Add additional fields
|
||||||
|
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||||
|
Object.assign(body, additionalFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (resource === 'chat') {
|
} else if (resource === 'chat') {
|
||||||
if (operation === 'get') {
|
if (operation === 'get') {
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
|
|
Loading…
Reference in a new issue