1 | <?php |
||
25 | trait Updates |
||
26 | { |
||
27 | abstract protected function execRequest(string $url); |
||
28 | |||
29 | /** |
||
30 | * \addtogroup Api Api Methods |
||
31 | * @{ |
||
32 | */ |
||
33 | |||
34 | /** |
||
35 | * \brief Set bot's webhook. |
||
36 | * \details Set a webhook for the current bot in order to receive incoming |
||
37 | * updates via an outgoing webhook. |
||
38 | * @param $params See [Telegram API](https://core.telegram.org/bots/api#setwebhook) |
||
39 | * for more information about the available parameters. |
||
40 | */ |
||
41 | public function setWebhook(array $params) |
||
46 | |||
47 | /** |
||
48 | * \brief Get information about bot's webhook. |
||
49 | * \details Returns an hash which contains information about bot's webhook. |
||
50 | * @return Array|false Webhook info. |
||
51 | */ |
||
52 | 1 | public function getWebhookInfo() |
|
57 | |||
58 | /** |
||
59 | * \brief Delete bot's webhook. |
||
60 | * \details Delete bot's webhook if it exists. |
||
61 | */ |
||
62 | public function deleteWebhook() |
||
67 | |||
68 | /** |
||
69 | * \brief Request bot updates. |
||
70 | * \details Request updates received by the bot using method getUpdates of Telegram API. [API reference](https://core.telegram.org/bots/api#getupdates) |
||
71 | * @param int $offset <i>Optional</i>. Identifier of the first update to be returned. Must be greater by one than the highest among the identifiers of previously received updates. By default, updates starting with the earliest unconfirmed update are returned. An update is considered confirmed as soon as getUpdates is called with an offset higher than its update_id. The negative offset can be specified to retrieve updates starting from -offset update from the end of the updates queue. All previous updates will forgotten. |
||
72 | * @param int $limit <i>Optional</i>. Limits the number of updates to be retrieved. Values between 1—100 are accepted. |
||
73 | * @param int $timeout <i>Optional</i>. Timeout in seconds for long polling. |
||
74 | * @return Array|false Array of updates (can be empty). |
||
75 | */ |
||
76 | public function getUpdates(int $offset = 0, int $limit = 100, int $timeout = 60) |
||
87 | |||
88 | /** |
||
89 | * \brief Set updates received by the bot for getUpdates handling. |
||
90 | * \details List the types of updates you want your bot to receive. For example, specify [“message”, “edited_channel_post”, “callback_query”] to only receive updates of these types. Specify an empty list to receive all updates regardless of type. |
||
91 | * Set it one time and it won't change until next setUpdateReturned call. |
||
92 | * @param Array $allowed_updates <i>Optional</i>. List of updates allowed. |
||
93 | */ |
||
94 | public function setUpdateReturned(array $allowed_updates = []) |
||
108 | |||
109 | /** @} */ |
||
110 | } |
||
111 |