$argv = $plugin->argv(); $argc = count($argv); if ($argc === 0) { if ($chan !== false) { if (NULL !== ($t = $chan->getTriggers())) { $plugin->rply('chan', array($t)); } elseif (NULL !== ($t = $serv->getTriggers())) { $plugin->rply('chan_by_serv', array($t)); } else { $plugin->rply('chan_by_bot', array(Dog_Init::getTriggers())); } } else { if (NULL !== ($t = $serv->getTriggers())) { $plugin->rply('serv', array($t)); } else { $plugin->rply('serv_by_bot', array(Dog_Init::getTriggers())); } } } elseif ($argc === 1) { if ($chan !== false) { if ($argv[0] === 'default') { $chan->saveVar('chan_triggers', NULL); $plugin->rply('chan_to_default'); } else { $chan->saveVar('chan_triggers', $argv[0]); $plugin->rply('chan_to', array($argv[0])); } } else { if (!Dog::hasPermission($serv, false, $user, 'i')) { Dog::noPermission('i'); } elseif ($argv[0] === 'default') {
/** * Get the first valid trigger which would currently work. * @return string . */ public static function getTrigger() { $chan = self::getChannel(); $trigger = $chan === false ? self::getServer()->getTriggers() : $chan->getTriggers(); $trigger = $trigger === NULL ? Dog_Init::getTriggers() : $trigger; return $trigger[0]; }