/** * Execute the command through ModuleManager */ public function execute() { $return = ModuleManager::runCommand($this->command, $this->fullMessage, $this->senderNick, $this->channel); if ($return !== true) { if ($return == 2) { $server = Server::getInstance(); $server->notify($this->senderNick, "You do not have permission to use this command. Please identify via NickServ if you have privileges, then type " . Config::$commandCharacter . "identify"); } } }
public function run() { $action = $this->parameters(1); $server = Server::getInstance(); switch ($action) { case "load": $moduleNamespace = "modules\\" . strtolower($this->parameters(2)) . "\\configs\\" . $this->parameters(2); ModuleManager::loadModuleConfig($moduleNamespace); $server->notify($this->senderNick, "Action completed"); break; case "unload": $moduleNamespace = "modules\\" . strtolower($this->parameters(2)) . "\\configs\\" . $this->parameters(2); ModuleManager::unloadModuleConfig($moduleNamespace); $server->notify($this->senderNick, "Action completed"); break; default: $folder = opendir(__DIR__ . "/.."); $modulePacks = array(); while (($file = readdir($folder)) !== false) { if ($file != "." && $file != ".." && $file != "modules.inc.php" && $file != ".DS_Store") { $folder2 = opendir(__DIR__ . "/../" . $file . "/configs"); while (($file2 = readdir($folder2)) !== false) { if ($file2 != "." && $file2 != ".." && $file2 != ".DS_Store") { $modulePacks[] = str_replace(".php", "", $file2); } } closedir($folder2); } } closedir($folder); $server->message($this->senderNick, "************************************"); $server->message($this->senderNick, "Module Pack Listing"); $server->message($this->senderNick, " "); foreach ($modulePacks as $modulePack) { $modulePackLength = strlen($modulePack); $spacesToAdd = 25 - $modulePackLength; for ($i = 1; $i < $spacesToAdd; $i++) { $spaces .= " "; } if (ModuleManager::isLoaded($modulePack)) { $server->message($this->senderNick, $modulePack . $spaces . " - " . chr(2) . chr(3) . "3Loaded" . chr(3) . chr(2)); } else { $server->message($this->senderNick, $modulePack . $spaces . " - " . chr(2) . chr(3) . "4Not Loaded" . chr(3) . chr(2)); } unset($spaces); } $server->message($this->senderNick, "************************************"); break; } }
/** * Execute the mapped module through ModuleManager */ public function execute() { ModuleManager::runEvent($this->type, $this->fullLine, $this->channel, $this->senderNick, $this->targetNick); }
use awesomeircbot\line\ReceivedLineTypes; use awesomeircbot\command\Command; use awesomeircbot\event\Event; use awesomeircbot\trigger\Trigger; use awesomeircbot\database\Database; error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING); passthru('clear'); echo "Welcome to Awesome IRC Bot v2\n"; echo "Created by AwesomezGuy, follow @AwesomezGuy on Twitter\n"; if (Config::$die) { die("READ THE CONFIG!\n\n"); } if (Config::$configVersion != 4) { die("Your config is out of date, please delete your old config and remake your config from config.example.php\n\n"); } ModuleManager::initialize(); $server = Server::getInstance(); $db = Database::getInstance(); $db->updateScriptArrays(); $db->updateDatabase(); echo "\n"; while (true) { // Connect $server->connect(); // Identify $server->identify(); sleep(1); // NickServ if (Config::$nickservPassword) { $server->identifyWithNickServ(); }
/** * Execute the command through ModuleManager */ public function execute() { $return = ModuleManager::runTrigger($this->fullMessage, $this->senderNick, $this->channel); }
echo "\n"; $lastUpdate = time(); while (true) { // Connect $server->connect(); // Identify $server->identify(); // If we send anything else too soon after identification it could be // lost, so sleep for 2 seconds sleep(2); // NickServ if (Config::getValue("nickservPassword")) { $server->identifyWithNickServ(); } // Connect commands ModuleManager::runConnectCommands(); // Loop through the channels in the config and join them $channels = Config::getValue("channels"); foreach ($channels as $channel) { $server->join($channel); } // Loop-edy-loop while ($server->connected()) { $line = $server->getNextLine(); $line = new ReceivedLine($line); $line->parse(); if ($line->isMappedCommand()) { $command = new Command($line); $command->execute(); } if ($line->isMappedEvent()) {