コード例 #1
0
ファイル: Module.php プロジェクト: xhoogland/Monique
 /**
  * Here we process each individual message if it matches the right user and
  * channel. If so we can send it to the specific module to process it.
  *
  * @param  Bot          $pBot
  * @param  string $channel
  * @param  string $sNickname
  * @param  string $message
  */
 public function onChannelPrivmsg(Bot $pBot, $sChannel, $sNickname, $sMessage)
 {
     if ($sChannel[0] == '+' || $sChannel[0] == '%' || $sChannel[0] == '@' || $sChannel[0] == '&' || $sChannel[0] == '~') {
         $channel = substr($sChannel, 1);
     }
     $channel = strtolower($sChannel);
     $message = Util::stripFormat($sMessage);
     if ($channel == self::ECHO_CHANNEL || $channel == self::LOGGING_CHANNEL) {
         $pConfiguration = Configuration::getInstance();
         $aConfiguration = $pConfiguration->get('LVP');
         if (in_array($sNickname, $aConfiguration['NuwaniSistersEchoBots'])) {
             if ($message == '*** Global Gamemode Initialization') {
                 Seen::resetOnlinePlayersAtGamemodeInit();
                 Merchant::resetInformation();
             } else {
                 Seen::setPersonInformation($message);
                 Merchant::setInformation($message);
                 TempHistory::messageHandler($message);
                 if ($pBot['Nickname'] == 'Monique') {
                     QuoteDevice::setInformation($pBot, $message);
                 }
             }
         }
         if ($message == '!players') {
             Seen::syncOnlinePlayers();
         }
     }
     if ($channel == self::RADIO_CHANNEL && $sNickname == 'LVP_Radio') {
         Radio::setNowPlayingInformation($message);
     }
 }
コード例 #2
0
ファイル: QuoteDevice.php プロジェクト: xhoogland/Monique
 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'));
 }