File tree Expand file tree Collapse file tree 4 files changed +13
-3
lines changed
Expand file tree Collapse file tree 4 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
55### Added
66- PHP CodeSniffer introduced and cleaned code to pass tests.
77- Custom exceptions for better error handling.
8+ - Request limiter options.
89
910## [ 0.42.0.1] - 2017-04-11
1011### Added
Original file line number Diff line number Diff line change @@ -167,8 +167,8 @@ Here is a list of available extra parameters:
167167| * array* | * e.g.* ` ['message', 'edited_channel_post', 'callback_query'] ` |
168168| logging | Path(s) where to the log files should be put. This is an array that can contain all 3 log file paths (` error ` , ` debug ` and ` update ` ). |
169169| * array* | * e.g.* ` ['error' => __DIR__ . '/php-telegram-bot-error.log'] ` |
170- | limiter | Enable or disable the limiter functionality |
171- | * bool* | * e.g.* ` true ` or ` false ` |
170+ | limiter | Enable or disable the limiter functionality, also accepts options array. |
171+ | * bool| array * | * e.g.* ` true ` or ` false ` or ` ['interval' => 2] ` |
172172| admins | An array of user ids that have admin access to your bot. |
173173| * array* | * e.g.* ` [12345] ` |
174174| mysql | Mysql credentials to connect a database (necessary for [ ` getUpdates ` ] ( #using-getupdates-method ) method!). |
Original file line number Diff line number Diff line change @@ -270,7 +270,7 @@ public function setBotExtras(): self
270270 }
271271
272272 $ request_extras = [
273- ' limiter ' => ' setLimiter ' ,
273+ // None at the moment...
274274 ];
275275 // For request extras, just pass the single param value to the Request method.
276276 foreach ($ request_extras as $ param_key => $ method ) {
@@ -280,6 +280,14 @@ public function setBotExtras(): self
280280 }
281281 }
282282
283+ // Special cases.
284+ $ limiter = $ this ->params ->getBotParam ('limiter ' , []);
285+ if (is_array ($ limiter )) {
286+ Request::setLimiter (true , $ limiter );
287+ } else {
288+ Request::setLimiter ($ limiter );
289+ }
290+
283291 $ command_configs = $ this ->params ->getBotParam ('command_configs ' );
284292 if (is_array ($ command_configs )) {
285293 /** @var array $command_configs */
Original file line number Diff line number Diff line change @@ -78,6 +78,7 @@ class Params
7878 * max_connections (int) Maximum allowed simultaneous HTTPS connections to the webhook
7979 * allowed_updates (array) List the types of updates you want your bot to receive
8080 * logging (array) Array of logger files to set.
81+ * limiter (bool|array) Set limiter, as bool or options array.
8182 * admins (array) List of admins to enable.
8283 * mysql (array) MySQL credentials to use.
8384 * download_path (string) Custom download path to set.
You can’t perform that action at this time.
0 commit comments