public function on_autojoin_Ac() { $user = Dog::getUser(); $server = Dog::getServer(); $argv = $this->argv(); $argc = count($argv); # Invoked in channel. switch ($argc) { # .autojoin case 0: return $this->showStatus($channel); # .autojoin on|#channel # .autojoin on|#channel case 1: if (Dog_Var::isValid('b', $argv[0])) { return $this->setEnabled($channel, Dog_Var::parseValue('b', $argv[0])); } elseif (false === ($channel = Dog::getOrLoadChannelByArg($argv[0]))) { return Dog::rply('err_channel'); } else { return $this->showStatus($channel); } # .autojoin #wechall on # .autojoin #wechall on case 2: if (false === ($channel = Dog::getOrLoadChannelByArg($argv[0]))) { return Dog::rply('err_channel'); } if (!Dog::hasPermission($server, $channel, $user, 'A')) { return Dog::noPermission('s'); } return $this->setEnabled($channel, Dog_Var::parseValue('b', $argv[1])); } $this->showHelp('autojoin'); }
$out = ''; foreach ($vars as $var) { $var instanceof Dog_Var; $out .= sprintf(', %s', $var->getName()); } return $plugin->rply('avail', array(substr($out, 2))); } elseif ($argc === 1) { if (false === ($var = Dog_Var::getVar($vars, $argv[0]))) { return Dog::rply('err_unk_var'); } $varname = $var->getName(); $vartype = $var->displayType(); $vardeft = $var->getDefault(); $curvalu = Dog_Conf_Bot::getConf($varname, $vardeft); return $plugin->rply('show', array($varname, $vartype, $vardeft, $curvalu)); } elseif ($argc === 2) { if (false === ($var = Dog_Var::getVar($vars, $argv[0]))) { return Dog::rply('err_unk_var'); } $varname = $var->getName(); $vartype = $var->displayType(); $vardeft = $var->getDefault(); $curvalu = Dog_Conf_Bot::getConf($varname, $vardeft); if (!Dog_Var::isValid($var->getType(), $argv[1])) { return $plugin->rply('invalid', array($varname, $vartype)); } Dog_Conf_Bot::setConf($varname, $argv[1]); return $plugin->rply('set', array($varname, $argv[1])); } else { $plugin->showHelp(); }