Skip to content

Commit

Permalink
No "switch_pm_text" & "switch_pm_parameter" #53
Browse files Browse the repository at this point in the history
  • Loading branch information
mullwar committed Apr 28, 2017
1 parent 1775941 commit b18c10f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ Creates `InlineKeyboardButton` button object.

Creates inlineKeyboard object for normal bot messages.

##### `answerList(<inline_query_id>, {nextOffset, cacheTime, personal})`
##### `answerList(<inline_query_id>, {nextOffset, cacheTime, personal, pmText, pmParameter})`

Creates `answerInlineQuery` answer list object.

Expand Down
12 changes: 11 additions & 1 deletion lib/methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,21 @@ const methods = {
answerInlineQuery: {
short: 'answerQuery',
arguments: answers => {
return {

const data = {
inline_query_id: answers.id,
results: answers.results(),
next_offset: answers.nextOffset,
is_personal: answers.personal,
cache_time: answers.cacheTime
};

if (answers.pmText && answers.pmParameter) {
data.switch_pm_text = answers.pmText;
data.switch_pm_parameter = answers.pmParameter;
}

return data;
}
},

Expand Down Expand Up @@ -304,6 +312,8 @@ class AnswerList {
this.cacheTime = Number(opt.cacheTime) || 300;
this.nextOffset = opt.nextOffset === undefined ? null : opt.nextOffset;
this.personal = opt.personal === undefined ? false : opt.personal;
this.pmText = opt.pmText;
this.pmParameter = opt.pmParameter;
this.list = [];
}

Expand Down

0 comments on commit b18c10f

Please sign in to comment.