/** * Creates a new Bot. * @param string $url * @param Request|\stdClass $req */ public function __construct($url, $req = null) { $this->url = $url; $this->req = $req instanceof Request ? $req : (isset($req) ? Request::map($req) : Request::getRequest()); global $processors; foreach ($processors as $processor) { self::register($processor); } processors\Command::register($this, "help", (new \registerables\Command(function ($req, $args = null) { if (empty($args)) { $text = "*All commands are listed below:*\n"; foreach ($this->command as $name => $value) { $text .= "/" . $name . (!empty($value->syntax) ? ' `' . $value->syntax . '`' : '') . (!empty($value->description) ? ' ' . $value->description : '') . "\n"; } } else { $name = strtolower(trim($args)); $cmd = $this->command[$name]; $text = '/' . $name . (!empty($cmd->syntax) ? ' `' . $cmd->syntax . '`' : '') . "\n" . (!empty($cmd->description) ? '*' . $cmd->description . '*' : '') . "\n" . (!empty($cmd->help) ? "" . $cmd->help : ''); } return (new responses\Message($text, $req))->parse_mode("Markdown"); }))->description("Prints the help message")->syntax("[command]")->help("Oh, hey! You found me! Here, have a cookie: " . json_decode('"\\ud83c\\udf6a"') . "\n" . "Used to send help for a specific command or list all commands.")); }