當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Services::getBotManager方法代碼示例

本文整理匯總了PHP中Services::getBotManager方法的典型用法代碼示例。如果您正苦於以下問題:PHP Services::getBotManager方法的具體用法?PHP Services::getBotManager怎麽用?PHP Services::getBotManager使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Services的用法示例。


在下文中一共展示了Services::getBotManager方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: PRIVMSG

 /**
  * Handles the PRIVMSG command
  *
  * @param	string		$input
  * @param	array<string>	$inputEx
  * @return	void
  */
 public static function PRIVMSG($input, $inputEx)
 {
     if ($inputEx[2][0] != '$') {
         // get source
         $source = Services::getUserManager()->getUser($inputEx[0]);
         if ($inputEx[2][0] == '#' and $source !== null) {
             // send debug message
             if (defined('DEBUG')) {
                 Services::getConnection()->getProtocol()->sendLogLine($source->getUuid() . " (" . $source->getNick() . ") sent a message to " . $inputEx[2]);
             }
             // notify module manager
             Services::getModuleManager()->handleLine($source, $inputEx[2], substr($input, stripos($input, ':') + 1));
         } elseif ($source) {
             // kick numeric
             $inputEx[2] = substr($inputEx[2], strlen(Services::getConnection()->getProtocol()->numeric));
             // send debug message
             if (defined('DEBUG')) {
                 Services::getConnection()->getProtocol()->sendLogLine($source->getUuid() . " (" . $source->getNick() . ") sent a message to " . $inputEx[2]);
             }
             // try to find bot
             if (($bot = Services::getBotManager()->getUser($inputEx[2])) !== null) {
                 // resolved uuid ... send debug message
                 if (defined('DEBUG')) {
                     Services::getConnection()->getProtocol()->sendLogLine("Resolved " . $inputEx[2] . " to " . $bot->getNick());
                 }
                 // notify module manager
                 Services::getModuleManager()->handleLine($source, $inputEx[2], substr($input, stripos($input, ':') + 1));
             } else {
                 // cannot find user ... send debug message
                 if (defined('DEBUG')) {
                     Services::getConnection()->getProtocol()->sendLogLine("Cannot resolve '" . $inputEx[2] . "'! Type of return value: " . gettype($bot));
                 }
             }
         } else {
             Services::getConnection()->getProtocol()->sendLogLine("Received invalid UUID '" . $inputEx[0] . "'! Maybe choosen wrong IRCd?");
         }
     }
 }
開發者ID:Evil-Co-Legacy,項目名稱:Evil-Co.de-Services,代碼行數:45,代碼來源:ProtocolHandler.class.php

示例2: createBot

 /**
  * Creates a new bot
  *
  * @param	string			$nick
  * @param	string			$hostname
  * @param	string			$ident
  * @param	string			$ip
  * @param	string			$modes
  * @param	string			$gecos
  * @return	AbstractUserType
  */
 public function createBot($nick, $hostname, $ident, $ip, $modes, $gecos)
 {
     // get current unix timestamp
     $timestamp = time();
     // create user in bot manager
     $uuid = Services::getBotManager()->introduceUser($timestamp, $nick, $hostname, $hostname, $ident, $ip, $timestamp, $modes, $gecos);
     // send SVSHOLD command
     // Services::getConnection()->sendServerLine("SVSHOLD ".$nick." :Reserved for services");
     // send uid command
     Services::getConnection()->sendServerLine("UID " . $this->numeric . $uuid . " " . $timestamp . " " . $nick . " " . $hostname . " " . $hostname . " " . $ident . " " . $ip . " " . $timestamp . " " . $modes . " :" . $gecos);
     // return bot object
     return Services::getBotManager()->getUser($uuid);
 }
開發者ID:Evil-Co-Legacy,項目名稱:Evil-Co.de-Services,代碼行數:24,代碼來源:Protocol.class.php


注:本文中的Services::getBotManager方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。