Пример #1
0
 public function run()
 {
     $command = $this->parameters(1);
     if ($command) {
         $subcommand = $this->parameters(2);
         if ($subcommand != "") {
             $description = HelpManager::getDescription($command, $subcommand);
             $parameters = HelpManager::getParameters($command, $subcommand);
             $subcommandsString = false;
         } else {
             $description = HelpManager::getDescription($command);
             $parameters = HelpManager::getParameters($command);
             $subcommands = HelpManager::getSubcommands($command);
             foreach ($subcommands as $id => $subcommandOfCommand) {
                 if ($subcommandOfCommand != "BASE") {
                     $subcommandsString .= " " . $subcommandOfCommand;
                 }
             }
         }
         $server = Server::getInstance();
         $server->notify($this->senderNick, "************************************");
         $server->notify($this->senderNick, "Help for " . Config::$commandCharacter . $command . " " . $subcommand);
         $server->notify($this->senderNick, " ");
         $server->notify($this->senderNick, $description);
         $server->notify($this->senderNick, chr(2) . "Syntax: " . chr(2) . Config::$commandCharacter . $command . " " . $subcommand . " " . $parameters);
         if ($subcommandsString) {
             $server->notify($this->senderNick, chr(2) . "Subcommands:" . chr(2) . $subcommandsString);
         }
         $server->notify($this->senderNick, "************************************");
     } else {
         $commands = HelpManager::getCommandList();
         foreach ($commands as $id => $commandFromList) {
             $commandsString .= " " . $commandFromList;
         }
         $server = Server::getInstance();
         $server->notify($this->senderNick, "************************************");
         $server->notify($this->senderNick, "Welcome to AwesomeBot v2 Help");
         $server->notify($this->senderNick, "Follow @AwesomezGuy on Twitter http://twitter.com/AwesomezGuy");
         $server->notify($this->senderNick, "");
         $server->notify($this->senderNick, chr(2) . "Commands: " . chr(2) . $commandsString);
         $server->notify($this->senderNick, chr(2) . "Getting help with commands: " . chr(2) . Config::$commandCharacter . "help <command to get help for>");
         $server->notify($this->senderNick, "************************************");
     }
 }
Пример #2
0
 /**
  * Unload a module config and all it's mappings from the
  * bot. Basically the opposite of above
  *
  * @param string full namespace of the module config
  */
 public static function unloadModuleConfig($moduleConfig)
 {
     foreach ($moduleConfig::$mappedCommands as $command => $module) {
         static::unmapCommand($command, $module);
     }
     foreach ($moduleConfig::$mappedEvents as $event => $module) {
         static::unmapEvent($event, $module);
     }
     foreach ($moduleConfig::$mappedTriggers as $regexString => $module) {
         static::unmapTrigger($regexString, $module);
     }
     foreach ($moduleConfig::$help as $command => $commandData) {
         HelpManager::unregisterCommand($command);
     }
     $moduleConfig = explode("\\", $moduleConfig);
     foreach (static::$loadedModuleFolders as $id => $loadedModuleFolder) {
         if ($moduleConfig[1] == $loadedModuleFolder) {
             unset(static::$loadedModuleFolders[$id]);
         }
     }
 }