@@ -40,18 +40,20 @@ and then run `composer update`
4040
4141What use would this library be if you couldn't perform any actions?!
4242
43- There are 4 parameters available to get things rolling:
43+ There are a few parameters available to get things rolling:
4444
4545| Parameter | Description |
4646| --------- | ----------- |
4747| s | ** s** ecret: This is a special secret value defined in the main ` manager.php ` file. |
4848| | This parameter is required to call the script via browser! |
49- | a | ** a** ction: The actual action to perform. (handle (default), set, unset, reset) |
50- | | ** handle** executes the ` getUpdates ` method; ** set** / ** unset** / ** reset** the Webhook . |
49+ | a | ** a** ction: The actual action to perform. (handle (default), cron, set, unset, reset) |
50+ | | ** handle** executes the ` getUpdates ` method; ** cron ** executes cron commands; ** set** / ** unset** / ** reset** the webhook . |
5151| l | ** l** oop: Number of seconds to loop the script for (used for getUpdates method). |
5252| | This would be used mainly via CLI, to continually get updates for a certain period. |
53- | i | ** i** nterval: Number of seconds to wait between getUpdates requests (used for getUpdates method, default: 2). |
53+ | i | ** i** nterval: Number of seconds to wait between getUpdates requests (used for getUpdates method, default is 2). |
5454| | This would be used mainly via CLI, to continually get updates for a certain period, every ** i** seconds. |
55+ | g | ** g** roup: Commands group for cron (only used together with ` cron ` action, default group is ` default ` ). |
56+ | | Define which group of commands to execute via cron. |
5557
5658#### via browser
5759
@@ -102,7 +104,7 @@ Handle updates for 30 seconds, fetching every 5 seconds:
102104You can name this file whatever you like, it just has to be somewhere inside your PHP project (preferably in the root folder to make things easier).
103105(Let's assume our file is called ` manager.php ` )
104106
105- Let's start off with a simple example that uses the Webhook method:
107+ Let's start off with a simple example that uses the webhook method:
106108``` php
107109<?php
108110
@@ -256,6 +258,24 @@ $bot = new BotManager([
256258 ],
257259 ],
258260
261+ // (array) All options that have to do with cron.
262+ 'cron' => [
263+ // (array) List of groups that contain the commands to execute.
264+ 'groups' => [
265+ // Each group has a name and array of commands.
266+ // When no group is defined, the default group gets executed.
267+ 'default' => [
268+ '/default_cron_command',
269+ ],
270+ 'maintenance' => [
271+ '/db_cleanup',
272+ '/db_repair',
273+ '/log_rotate',
274+ '/message_admins Maintenance completed',
275+ ],
276+ ],
277+ ],
278+
259279 // (string) Override the custom input of your bot (mostly for testing purposes!).
260280 'custom_input' => '{"some":"raw", "json":"update"}',
261281]);
0 commit comments