Miguel N 2a2d2a0b7e Added missing help command
This commit adds the missing help command for the bot.
2020-12-25 16:38:27 +00:00

42 lines
880 B
PHP

<?php
namespace nogueiracodes\RaspberryBot\Bot\Commands;
use Exception;
use nogueiracodes\RaspberryBot\Core\Interfaces\Command;
use nogueiracodes\RaspberryBot\Traits\HasSignature;
use Zttp\Zttp;
class Help implements Command
{
use HasSignature;
public $signature = "help {section: The section to retrieve help for}";
public function run(array $parameters)
{
switch($parameters['section'])
{
case "commands":
if(file_exists(PROJECT_ROOT . "/Commandfiles/help.txt"))
{
return str_replace("<prefix>", $_ENV['COMMAND_PREFIX'], file_get_contents(PROJECT_ROOT . "/Commandfiles/help.txt"));
}
else
{
return ":x: There is currently no available help.";
}
break;
default:
return ":x: There is no help section named " . $parameters['section'] . ".";
break;
}
}
}