/** * Says hello to the sender or first command parameter. */ public function doExecute() { parent::doExecute(); $sToBeGreeted = $this->getSender(); $aArgs = $this->getParameters(); // Checking if there is a name given that shall be greeted if (isset($aArgs[2][0]) && !empty($aArgs[2][0])) { $sToBeGreeted = $aArgs[2][0]; } $this->setReturnMessage(Config::getInstance()->lang('WELCOME', $sToBeGreeted)); }
/** * Calculates current uptime of the bot */ public function doExecute() { parent::doExecute(); $oNow = new DateTime(); $oDifference = $this->__oStartDateTime->diff($oNow); $iYears = $oDifference->format('%y'); $iDays = $oDifference->format('%d'); $iHours = $oDifference->format('%H'); $iMinutes = $oDifference->format('%I'); $sResponse = $iYears ? $iYears . ' ' . Config::getInstance()->lang('YEARS') . ', ' : ''; $sResponse .= $iDays ? $iDays . ' ' . Config::getInstance()->lang('DAYS') . ', ' : ''; $sResponse .= $iHours . ':' . $iMinutes . ' ' . Config::getInstance()->lang('HOURS'); $this->setReturnMessage($sResponse); }
/** * Can be used as hook when a command is *really* executed. * * @return void */ public function doExecute() { parent::doExecute(); $sMessage = $this->getReceivedMessage(); $aArgs = $this->getParameters(); $sAction = $aArgs[2][0]; switch ($sAction) { case 'join': $this->addToQueue($this->getSender(), !empty($aArgs[4][0]) ? $aArgs[4][0] : $this->getSender()); break; case 'get': $this->getFromQueue(!empty($aArgs[4][0]) ? (int) $aArgs[4][0] : 1); break; case 'list': $this->listAll(); break; case 'clear': $this->clearQueue(); break; } }
/** * Can be used as hook when a command is *really* executed. * * @return void */ public function doExecute() { parent::doExecute(); $this->setReturnMessage('Test successful!'); }