diff options
Diffstat (limited to 'src/Bot/Application.php')
-rw-r--r-- | src/Bot/Application.php | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/Bot/Application.php b/src/Bot/Application.php new file mode 100644 index 0000000..2b8dae0 --- /dev/null +++ b/src/Bot/Application.php @@ -0,0 +1,49 @@ +<?php + +namespace FBeans\Beansbot\Bot; + +use FBeans\BlaIRC\Command; +use FBeans\BlaIRC\Application As BlaApplication; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Process\Process; + +class Application extends BlaApplication +{ + public function commands(): Array + { + $command = new Command; + $command->setName('bot:list'); + + $command->setExecuteCallback( + function (InputInterface $input, OutputInterface $output) { + $output->writeLn( + $this->getCommands() + ); + + return Command::SUCCESS; + } + ); + + $command2 = new Command; + $command2->setName('bot:reload'); + + $command2->setExecuteCallback( + function (InputInterface $input, OutputInterface $output) { + + $output->writeLn( + 'Config reloaded' + ); + + return Command::SUCCESS; + } + ); + + return [$command, $command2]; + } + + protected function getCommands() + { + return implode(', ', array_keys(parse_ini_file(__DIR__ . '/../../Blatech.ini', true))); + } +} |