本文整理匯總了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);
}