예제 #1
0
파일: SayCommand.php 프로젝트: nkreer/Fish
 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");
 }
예제 #2
0
 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");
 }
예제 #3
0
파일: Plugin.php 프로젝트: nkreer/Fish
 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);
             }
         }
     }
 }
예제 #4
0
파일: PartCommand.php 프로젝트: nkreer/Fish
 public function __construct(Connection $connection)
 {
     $this->connection = $connection;
     parent::__construct("part", $this, "fish.management.part", "Leave channels", "part <#channel1,#channel2...>");
 }
예제 #5
0
 public function __construct()
 {
     parent::__construct("whoami", $this, false, "Get information about you", "whoami");
 }
예제 #6
0
 public function __construct(Connection $connection)
 {
     $this->connection = $connection;
     parent::__construct("listplugins", $this, "fish.management.listplugins", "List plugins", "listplugins");
     $this->addAlias("plist");
 }
예제 #7
0
파일: RawCommand.php 프로젝트: nkreer/Fish
 public function __construct(Connection $connection)
 {
     $this->connection = $connection;
     parent::__construct("raw", $this, "fish.management.raw", "Send raw IRC commands", "raw <command>");
 }
예제 #8
0
파일: StopCommand.php 프로젝트: nkreer/Fish
 public function __construct()
 {
     parent::__construct("stop", $this, "fish.management.stop", "Stop the bot", "stop");
 }
예제 #9
0
파일: HelpCommand.php 프로젝트: nkreer/Fish
 public function __construct(Connection $connection)
 {
     $this->connection = $connection;
     parent::__construct("help", $this, false, "Command help", "help <page/command>");
 }
예제 #10
0
파일: JoinCommand.php 프로젝트: nkreer/Fish
 public function __construct(Connection $connection)
 {
     $this->connection = $connection;
     parent::__construct("join", $this, "fish.management.join", "Join channels", "join <#channel1,#channel2...>");
 }
예제 #11
0
파일: NickCommand.php 프로젝트: nkreer/Fish
 public function __construct(Connection $connection)
 {
     $this->connection = $connection;
     parent::__construct("nick", $this, "fish.management.nick", "Change the bot's nick", "nick <name>");
 }
예제 #12
0
 public function __construct()
 {
     parent::__construct("reload", $this, "fish.management.reload", "Reload everything", "reload");
 }