|
@@ 60-79 (lines=20) @@
|
| 57 |
|
* $results Array on InlineQueryResult (https://core.telegram.org/bots/api#inlinequeryresult) |
| 58 |
|
* $switch_pm_text Text to show on the button |
| 59 |
|
*/ |
| 60 |
|
public function answerInlineQuerySwitchPM($results, $switch_pm_text, $switch_pm_parameter = '', $is_personal = true, $cache_time = 300) { |
| 61 |
|
|
| 62 |
|
if (!isset($this->_inline_query_id)) { |
| 63 |
|
|
| 64 |
|
throw new BotException("Inline query id not set, wrong update"); |
| 65 |
|
|
| 66 |
|
} |
| 67 |
|
|
| 68 |
|
$parameters = [ |
| 69 |
|
'inline_query_id' => $this->_inline_query_id, |
| 70 |
|
'switch_pm_text' => $switch_pm_text, |
| 71 |
|
'is_personal' => $is_personal, |
| 72 |
|
'switch_pm_parameter' => $switch_pm_parameter, |
| 73 |
|
'results' => $results, |
| 74 |
|
'cache_time' => $cache_time |
| 75 |
|
]; |
| 76 |
|
|
| 77 |
|
return $this->exec_curl_request('answerInlineQuery?' . http_build_query($parameters)); |
| 78 |
|
|
| 79 |
|
} |
| 80 |
|
|
| 81 |
|
/* |
| 82 |
|
* Answer a inline query (when the user write @botusername "Query") with a button, that will make user switch to the private chat with the bot, on the top of the results (https://core.telegram.org/bots/api#answerinlinequery) |
|
@@ 87-105 (lines=19) @@
|
| 84 |
|
* @param |
| 85 |
|
* $switch_pm_text Text to show on the button |
| 86 |
|
*/ |
| 87 |
|
public function answerEmptyInlineQuerySwitchPM($switch_pm_text, $switch_pm_parameter = '', $is_personal = true, $cache_time = 300) { |
| 88 |
|
|
| 89 |
|
if (!isset($this->_inline_query_id)) { |
| 90 |
|
|
| 91 |
|
throw new BotException("Inline query id not set, wrong update"); |
| 92 |
|
|
| 93 |
|
} |
| 94 |
|
|
| 95 |
|
$parameters = [ |
| 96 |
|
'inline_query_id' => $this->_inline_query_id, |
| 97 |
|
'switch_pm_text' => $switch_pm_text, |
| 98 |
|
'is_personal' => $is_personal, |
| 99 |
|
'switch_pm_parameter' => $switch_pm_parameter, |
| 100 |
|
'cache_time' => $cache_time |
| 101 |
|
]; |
| 102 |
|
|
| 103 |
|
return $this->exec_curl_request('answerInlineQuery?' . http_build_query($parameters)); |
| 104 |
|
|
| 105 |
|
} |
| 106 |
|
|
| 107 |
|
/** @} */ |
| 108 |
|
|