当前位置: 首页>>代码示例>>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;未经允许,请勿转载。