<commit_before><?php

/**
 * Provides help for plugins
 *
 * @category Phergie
 * @package  Phergie_Plugin_Help
 * @author   <NAME> <<EMAIL>>
 */
class Phergie_Plugin_SudoHelp extends Phergie_Plugin_Abstract
{
	public function onLoad() {
		$this->getPluginHandler()->getPlugin('Command');
	}

	protected function getHelpMessages() {
		$connection = $this->getConnection();
		$botNick = $connection->getNick();

		$helpMessages = array();
		$helpMessages['SudoHelp'] = "You can type !help {$botNick} in the channel you will get a list of commands.";
		$helpMessages['SudoHelloWorld'] = "You can type 'hello world', and {$botNick} will say it back!";
		$helpMessages['SudoSayHello'] = "You can type /msg {$botNick} hello (OR) hello {$botNick}, and {$botNick} will say hello back.";

		return $helpMessages;
	}

	public function onCommandHelp() {
		$event = $this->getEvent();
		$input = $event->getArgument(1);
		$nick = $event->getNick();
		$source = $event->getSource();
		$helpMessages = $this->getHelpMessages();

		$pattern = '/'.preg_quote($prefix).'\s*?help '.preg_quote($botNick).'/i';
		if (preg_match($pattern, $input)) {
			foreach ($this->plugins as $plugin) {
				$class = new ReflectionClass($plugin);
				if(isset($helpMessages[$plugin->getName()])) {
					$this->doPrivmsg($source, $helpMessages[$plugin->getName()]);
				}
			}
		}

		return;
	}

}<commit_msg>fixed some small bugs in sudohelp plugin<commit_after><?php

/**
 * Provides help for plugins
 *
 * @category Phergie
 * @package  Phergie_Plugin_Help
 * @author   <NAME> <<EMAIL>>
 */
class Phergie_Plugin_SudoHelp extends Phergie_Plugin_Abstract
{
	public function onLoad() {
		$this->getPluginHandler()->getPlugin('Command');
	}

	protected function getHelpMessages() {
		$connection = $this->getConnection();
		$botNick = $connection->getNick();

		$helpMessages = array();
		$helpMessages['SudoHelp'] = "You can type !help {$botNick} in the channel you will get a list of commands.";
		$helpMessages['SudoHelloWorld'] = "You can type 'hello world', and {$botNick} will say it back!";
		$helpMessages['SudoSayHello'] = "You can type /msg {$botNick} hello (OR) hello {$botNick}, and {$botNick} will say hello back.";

		return $helpMessages;
	}

	public function onCommandHelp() {
		$connection = $this->getConnection();
		$botNick = $connection->getNick();

		$prefix = $this->getConfig('command.prefix');
		$event = $this->getEvent();
		$input = $event->getArgument(1);
		$source = $event->getSource();
		$helpMessages = $this->getHelpMessages();

		$pattern = '/'.preg_quote($prefix).'\s*?help '.preg_quote($botNick).'/i';
		if (preg_match($pattern, $input)) {
			foreach ($this->plugins as $plugin) {
				if(isset($helpMessages[$plugin->getName()])) {
					$this->doPrivmsg($source, $helpMessages[$plugin->getName()]);
				}
			}
		}

		return;
	}

}
{'fraction_non_alphanumeric': 0.17696926880960792, 'fraction_numerical': 0.0007064641469445425, 'mean_word_length': 4.675350701402806, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2198773', 'n_tokens_mistral': 1025, 'n_tokens_neox': 915, 'n_words': 217}