public function __construct(Connection $connection) { $this->connection = $connection; parent::__construct("say", $this, "fish.management.say", "Send a message to a channel", "say <#channel> <text>"); $this->addAlias("echo"); $this->addAlias("msg"); }
public function __construct(Connection $connection) { $this->connection = $connection; parent::__construct("unloadPlugin", $this, "fish.management.unloadplugin", "Unload plugin", "unloadplugin <plugin>"); $this->addAlias("up"); $this->addAlias("unloadMod"); $this->addAlias("unloadModule"); }
public function __construct(string $name, array $json, Connection $connection) { if (file_exists("phar://plugins" . DIRECTORY_SEPARATOR . $name . ".phar" . DIRECTORY_SEPARATOR . "plugin.json")) { Logger::info(BashColor::GREEN . "Loading plugin " . BashColor::BLUE . $name); $this->name = $json["name"]; $this->description = $json["description"]; $this->apiVersion = $json["api"]; $this->version = $json["version"]; $this->author = $json["author"]; $this->main = $json["main"]; //Instantiating plugins $info = new \SplFileInfo("phar://plugins" . DIRECTORY_SEPARATOR . $name . ".phar" . DIRECTORY_SEPARATOR . $this->main); $class = new \ReflectionClass("\\" . $name . "\\" . $info->getBasename(".php")); //Taking care of using the correct namespace $this->class = $class->newInstanceWithoutConstructor(); $this->reflectionClass = $class; $this->class->connection = $connection; $this->class->plugin = $this; //Registering commands if (isset($json["commands"])) { $this->commands = $json["commands"]; foreach ($this->commands as $command => $settings) { // Set description $description = !empty($settings["description"]) ? $settings["description"] : ""; // Set usage help $usage = !empty($settings["usage"]) ? $settings["usage"] : $command; // Set required permission $permission = !empty($settings["permission"]) ? $settings["permission"] : false; //Default permission is false $command = new Command($command, $this->class, $permission, $description, $usage); // Add aliases if (isset($settings["aliases"]) && is_array($settings["aliases"])) { foreach ($settings["aliases"] as $alias) { $command->addAlias($alias); } } $connection->getCommandMap()->registerCommand($command, $this); } } } }
public function __construct(Connection $connection) { $this->connection = $connection; parent::__construct("part", $this, "fish.management.part", "Leave channels", "part <#channel1,#channel2...>"); }
public function __construct() { parent::__construct("whoami", $this, false, "Get information about you", "whoami"); }
public function __construct(Connection $connection) { $this->connection = $connection; parent::__construct("listplugins", $this, "fish.management.listplugins", "List plugins", "listplugins"); $this->addAlias("plist"); }
public function __construct(Connection $connection) { $this->connection = $connection; parent::__construct("raw", $this, "fish.management.raw", "Send raw IRC commands", "raw <command>"); }
public function __construct() { parent::__construct("stop", $this, "fish.management.stop", "Stop the bot", "stop"); }
public function __construct(Connection $connection) { $this->connection = $connection; parent::__construct("help", $this, false, "Command help", "help <page/command>"); }
public function __construct(Connection $connection) { $this->connection = $connection; parent::__construct("join", $this, "fish.management.join", "Join channels", "join <#channel1,#channel2...>"); }
public function __construct(Connection $connection) { $this->connection = $connection; parent::__construct("nick", $this, "fish.management.nick", "Change the bot's nick", "nick <name>"); }
public function __construct() { parent::__construct("reload", $this, "fish.management.reload", "Reload everything", "reload"); }