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