1 | <?php |
||
28 | class AdminCommand extends MessageCommand |
||
29 | { |
||
30 | /** @} */ |
||
31 | |||
32 | public static $type = 'message'; |
||
33 | |||
34 | public static $object_class = 'PhpBotFramework\Entities\Message'; |
||
35 | |||
36 | public static $priority = 1; |
||
37 | |||
38 | private $command; |
||
|
|||
39 | |||
40 | private $length; |
||
41 | |||
42 | /** |
||
43 | * \brief Registers commands that can be triggered only by administrators. |
||
44 | * \details It works like <code>MessageCommand</code> but it requires a |
||
45 | * third argument: the list of Telegram IDs which represents the users |
||
46 | * that can execute the command. |
||
47 | * |
||
48 | * $start_command = new PhpBotFramework\Commands\AdminCommand("getusers", |
||
49 | * function ($bot, $message) { |
||
50 | * $bot->sendMessage("Hello, folks!"); |
||
51 | * }, |
||
52 | * array(3299130043, -439991220, 12221004)); |
||
53 | * |
||
54 | * @param string $command The command that will trigger this function (e.g. start) |
||
55 | * @param callable $script The function that will be triggered by a command. |
||
56 | * @param array $ids The users who can execute the command. |
||
57 | * Must take an object(the bot) and an array(the message received). |
||
58 | */ |
||
59 | public function __construct(string $command, callable $script, array $ids) |
||
67 | |||
68 | /** |
||
69 | * @internal |
||
70 | * \brief Process a message checking if it trigger any MessageCommand. |
||
71 | * @param string $message Message to process. |
||
72 | * @return bool True if the message trigger any command. |
||
73 | */ |
||
74 | public function checkCommand(array $message) : bool |
||
92 | |||
93 | } |
||
94 |