예제 #1
0
파일: Bot.php 프로젝트: xhoogland/Monique
 /**
  * The fake destructor of the class gets called when we destroy it, how
  * suprising. In here we close the socket and remove it from the bot
  * manager.
  */
 public function destroy()
 {
     if (!ModuleManager::getInstance()->onShutdown($this)) {
         $this->m_pSocket->send('QUIT :' . $this->m_sNickname);
     }
     Timer::destroy($this->m_aBotInfo['PingTimer']);
 }
예제 #2
0
 public static function addMqdCommands(Commands $moduleManager)
 {
     $moduleManager->registerCommand(new \Command('mqd-on', function ($pBot, $sDestination, $sChannel, $sNickname, $aParams, $sMessage) {
         $id = Timer::create(function () use($pBot) {
             \LVP\InGame\QuoteDevice::sendRandomMessage($pBot);
         }, mt_rand(300, 420) * 1000, false);
         file_put_contents(\LVP\InGame\QuoteDevice::$m_sMqdFileName, $id);
     }, 'mqd'));
     $moduleManager->registerCommand(new \Command('mqd-off', function ($pBot, $sDestination, $sChannel, $sNickname, $aParams, $sMessage) {
         $bSuccess = Timer::destroy(file_get_contents(\LVP\InGame\QuoteDevice::$m_sMqdFileName));
         if ($bSuccess === false) {
             echo 'Couldn\'t turn off';
             return \Command::OUTPUT_ERROR;
         } else {
             echo 'Turned off.';
             file_put_contents(\LVP\InGame\QuoteDevice::$m_sMqdFileName, '');
             return \Command::OUTPUT_SUCCESS;
         }
     }, 'mqd'));
 }