Major revision 2
This commit is contained in:
33
handlers/Command.php
Normal file
33
handlers/Command.php
Normal file
@ -0,0 +1,33 @@
|
||||
<?php
|
||||
use \TelegramBot\Api\Types\Message;
|
||||
use \TelegramBot\Api\Client;
|
||||
class Command
|
||||
{
|
||||
protected $message; // Message
|
||||
protected $bot; // Client
|
||||
public function __construct(Message $message, Client $bot)
|
||||
{
|
||||
$this->message = $message;
|
||||
$this->bot = $bot;
|
||||
}
|
||||
protected function multiExplode(string $string, array $delimiters, int $max = -1): array
|
||||
{
|
||||
$l = [];
|
||||
$temp = "";
|
||||
$found = 0;
|
||||
foreach (str_split($string) as $char) {
|
||||
if (in_array($char, $delimiters)) {
|
||||
if ($max != -1 && $found == $max) break;
|
||||
$l[] = $temp;
|
||||
$temp = "";
|
||||
$found++;
|
||||
}
|
||||
}
|
||||
return $l;
|
||||
}
|
||||
|
||||
public function execute(): void{
|
||||
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user