1 | <?php |
||
21 | trait Inline |
||
22 | { |
||
23 | |||
24 | abstract protected function execRequest(string $url); |
||
25 | |||
26 | /** |
||
27 | * \addtogroup Core Core(Internal) |
||
28 | * @{ |
||
29 | */ |
||
30 | |||
31 | /** \brief Store ID of the callback query received. */ |
||
32 | protected $_callback_query_id; |
||
33 | |||
34 | /** \brief Store ID of the inline query received. */ |
||
35 | protected $_inline_query_id; |
||
36 | |||
37 | /** @} */ |
||
38 | |||
39 | /** |
||
40 | * \addtogroup API API Methods |
||
41 | * @{ |
||
42 | */ |
||
43 | |||
44 | /** \brief Answer a callback query. |
||
45 | * \details Remove the 'updating' circle icon on an inline keyboard button showing a message/alert to the user. |
||
46 | * It'll always answer the current callback query. [Api reference](https://core.telegram.org/bots/api#answercallbackquery) |
||
47 | * @param string $text <i>Optional</i>. Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters. |
||
48 | * @param bool $show_alert <i>Optional</i>. If true, an alert will be shown by the client instead of a notification at the top of the chat screen. |
||
49 | * @param string $url <i>Optional</i>. URL that will be opened by the user's client. If you have created a Game and accepted the conditions via @Botfather, specify the URL that opens your game – note that this will only work if the query comes from a callback_game button. |
||
50 | * Otherwise, you may use links like telegram.me/your_bot?start=XXXX that open your bot with a parameter. |
||
51 | * @return bool True on success. |
||
52 | */ |
||
53 | public function answerCallbackQuery($text = '', $show_alert = false, string $url = '') : bool |
||
68 | |||
69 | |||
70 | /** |
||
71 | * \brief Answer a inline query (when the user write @botusername "Query") with a button, that will make user switch to the |
||
72 | * private chat with the bot, on the top of the results. [Api reference](https://core.telegram.org/bots/api#answerinlinequery) |
||
73 | * @param string $results A JSON-serialized array of results for the inline query. Use PhpBotFramework\Entities\InlineQueryResult class to create and get them. |
||
74 | * @param string $switch_pm_text If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter $switch_pm_parameter. |
||
75 | * @param bool $is_personal Pass True, if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query. |
||
76 | * @param int $cache_time The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300. |
||
77 | * @return bool True on success. |
||
78 | */ |
||
79 | public function answerInlineQuery(string $results = '', string $switch_pm_text = '', $switch_pm_parameter = '', bool $is_personal = true, int $cache_time = 300) : bool |
||
100 | |||
101 | /** @} */ |
||
102 | } |
||
103 |