public function onCommand(CommandInterface $command, CommandSender $sender, CommandSender $room, array $args) { if (!empty($args[1])) { if ($this->connection->getPluginManager()->loadPlugin($args[1] . ".phar", true) !== false) { $sender->sendNotice("Plugin " . $args[1] . " was loaded successfully."); } else { $sender->sendNotice("Plugin " . $args[1] . " could not be loaded."); } return true; } return false; }
public function onCommand(CommandInterface $command, CommandSender $sender, CommandSender $room, array $args) { if ($sender instanceof User) { if (isset($args[1])) { if (is_numeric($args[1]) and $args[1] > 0) { $page = --$args[1]; } elseif (is_string($args[1])) { $page = strtolower($args[1]); } else { $page = $args[1]; } } else { $page = 0; } if (!is_numeric($page)) { $help = $this->connection->getCommandMap()->getCommand($page); if ($help instanceof Command) { $sender->sendNotice(IRC::getInstance()->getCommandPrefix() . $help->getCommand() . " - " . $help->getDescription() . " (" . $help->getUsage() . ")"); } else { $sender->sendNotice("Command not found."); } } else { $commands = $this->connection->getCommandMap()->getCommands(); foreach ($commands as $key => $help) { if (!$sender->hasPermission($help->getMinimumPermission()) or $help->getCommand() !== $key) { unset($commands[$key]); } } ksort($commands); $list = ["Help page " . ($page + 1)]; $min = $page * self::COMMANDS_PER_PAGE; $max = $page * self::COMMANDS_PER_PAGE + self::COMMANDS_PER_PAGE; $count = 1; foreach ($commands as $help) { if ($count >= $min and $count < $max) { $list[] = IRC::getInstance()->getCommandPrefix() . $help->getCommand() . " - " . $help->getDescription() . " (" . $help->getUsage() . ")"; } $count++; } if (count($list) > 1) { foreach ($list as $entry) { $sender->sendNotice($entry); } } else { $sender->sendNotice("This help page is empty"); } } } }
public function onCommand(CommandInterface $command, CommandSender $sender, CommandSender $room, array $args) { if (!empty($args[1])) { if ($plugin = $this->connection->getPluginManager()->getPlugin($args[1]) and $plugin instanceof Plugin) { if ($this->connection->getPluginManager()->unloadPlugin($plugin)) { $sender->sendNotice("Plugin " . $args[1] . " was unloaded successfully."); } else { $sender->sendNotice("Plugin " . $args[1] . " could not be unloaded."); } } else { $sender->sendNotice("That plugin isn't loaded."); } return true; } return false; }
public function onCommand(CommandInterface $command, CommandSender $sender, CommandSender $room, array $args) { if ($sender instanceof User) { $sender->sendNotice("You are " . $sender->getNick() . " @ " . $sender->getAddress() . " | Authentication status: " . $sender->identified . " | Operator: " . ($sender->isOperator() ? "yes" : "no")); } return true; }
public function onCommand(CommandInterface $command, CommandSender $sender, CommandSender $room, array $args) { $plugins = $this->connection->getPluginManager()->getPlugins(); $names = []; foreach ($plugins as $plugin) { $names[] = $plugin->name; } $sender->sendNotice("Loaded plugins (" . count($names) . "): " . implode(", ", $names)); }
public function onCommand(CommandInterface $command, CommandSender $sender, CommandSender $room, array $args) { if (!empty($args[1])) { $channel = Channel::getChannel($this->connection, $args[1]); unset($args[1]); $text = implode(" ", $args); if (!empty($text)) { if ($text[0] === "*") { $channel->sendAction(str_replace("*", "", $text)); } else { $channel->sendMessage($text); } $sender->sendNotice("Message sent."); } else { $sender->sendNotice("No text to say"); } } else { $sender->sendNotice("Argument 1 must be a channel"); } }
public function onCommand(CommandInterface $command, CommandSender $sender, CommandSender $room, array $args) { if (!empty($args[1])) { if ($this->connection->getNick() !== $args[1]) { $this->connection->changeNick($args[1]); // Just quietly let the bot do its job. } } else { $sender->sendNotice("Argument 1 must a nickname"); } }
public function onCommand(CommandInterface $command, CommandSender $sender, CommandSender $room, array $args) { $channels = explode(",", $args[1]); if (!empty($channels)) { foreach ($channels as $channel) { $channel = Channel::getChannel($this->connection, $channel); $this->connection->partChannel($channel); } $sender->sendNotice("Parted channel(s): " . implode(", ", $channels)); return true; } return false; }
public function onCommand(CommandInterface $command, CommandSender $sender, CommandSender $room, array $args) { $sender->sendNotice("Reloading..."); IRC::getInstance()->reload(); $sender->sendNotice("Reload complete."); }