- public function onCommandHelp($query = null)
- {
- if ($query == 'refresh') {
- $this->populateRegistry();
- }
-
- $nick = $this->getEvent()->getNick();
- $delay = $this->getConfig('help.delay', 2);
-
- // Handle requests for a plugin list
- if (!$query) {
- $msg = 'These plugins have help information available: '
- . implode(', ', array_keys($this->registry));
- $this->doPrivmsg($nick, $msg);
- return;
- }
-
- // Handle requests for plugin information
- $query = strtolower($query);
- if (isset($this->registry[$query])
- && empty($this->registry[$query]['cmds'][$query])) {
- $msg = $query . ' - ' . $this->registry[$query]['desc'];
- $this->doPrivmsg($nick, $msg);
-
- $msg = 'Available commands - '
- . implode(', ', array_keys($this->registry[$query]['cmds']));
- $this->doPrivmsg($nick, $msg);
-
- if ($this->getConfig('command.prefix')) {
- $msg
- = 'Note that these commands must be prefixed with "'
- . $this->getConfig('command.prefix')
- . '" (without quotes) when issued in a public channel.';
- $this->doPrivmsg($nick, $msg);
- }
-
- return;
- }
-
- // Handle requests for command information
- foreach ($this->registry as $plugin => $data) {
- if (empty($data['cmds'])) {
- continue;
- }
-
- $result = preg_grep('/^' . $query . '$/i', array_keys($data['cmds']));
- if (!$result) {
- continue;
- }