本文整理汇总了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?");
}
}
}
示例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);
}