diff options
author | Fbenas <philbeansburton@gmail.com> | 2020-06-14 20:58:52 +0100 |
---|---|---|
committer | Fbenas <philbeansburton@gmail.com> | 2020-06-14 20:58:52 +0100 |
commit | 7772843630f82f0028893057adad65de6516b110 (patch) | |
tree | 663e7d066ae5c2924a96208121d36826c4ab3785 /src | |
parent | 63abf135263107feb9fa77c70c4ffd48abe6f010 (diff) |
Diffstat (limited to 'src')
-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))); + } +} |