@@ 804-823 (lines=20) @@ | ||
801 | * $results Array on InlineQueryResult (https://core.telegram.org/bots/api#inlinequeryresult) |
|
802 | * $switch_pm_text Text to show on the button |
|
803 | */ |
|
804 | public function answerInlineQuerySwitchPM($results, $switch_pm_text, $switch_pm_parameter = '', $is_personal = true, $cache_time = 300) { |
|
805 | ||
806 | if (!isset($this->_inline_query_id)) { |
|
807 | ||
808 | throw new BotException("Inline query id not set, wrong update"); |
|
809 | ||
810 | } |
|
811 | ||
812 | $parameters = [ |
|
813 | 'inline_query_id' => $this->_inline_query_id, |
|
814 | 'switch_pm_text' => $switch_pm_text, |
|
815 | 'is_personal' => $is_personal, |
|
816 | 'switch_pm_parameter' => $switch_pm_parameter, |
|
817 | 'results' => $results, |
|
818 | 'cache_time' => $cache_time |
|
819 | ]; |
|
820 | ||
821 | return $this->exec_curl_request('answerInlineQuery?' . http_build_query($parameters)); |
|
822 | ||
823 | } |
|
824 | ||
825 | /* |
|
826 | * 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) |
|
@@ 831-849 (lines=19) @@ | ||
828 | * @param |
|
829 | * $switch_pm_text Text to show on the button |
|
830 | */ |
|
831 | public function answerEmptyInlineQuerySwitchPM($switch_pm_text, $switch_pm_parameter = '', $is_personal = true, $cache_time = 300) { |
|
832 | ||
833 | if (!isset($this->_inline_query_id)) { |
|
834 | ||
835 | throw new BotException("Inline query id not set, wrong update"); |
|
836 | ||
837 | } |
|
838 | ||
839 | $parameters = [ |
|
840 | 'inline_query_id' => $this->_inline_query_id, |
|
841 | 'switch_pm_text' => $switch_pm_text, |
|
842 | 'is_personal' => $is_personal, |
|
843 | 'switch_pm_parameter' => $switch_pm_parameter, |
|
844 | 'cache_time' => $cache_time |
|
845 | ]; |
|
846 | ||
847 | return $this->exec_curl_request('answerInlineQuery?' . http_build_query($parameters)); |
|
848 | ||
849 | } |
|
850 | ||
851 | /** |
|
852 | * \brief Exec any api request using this method. |