本文整理汇总了PHP中Services::getChannelManager方法的典型用法代码示例。如果您正苦于以下问题:PHP Services::getChannelManager方法的具体用法?PHP Services::getChannelManager怎么用?PHP Services::getChannelManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Services
的用法示例。
在下文中一共展示了Services::getChannelManager方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: part
/**
* Removes the bot from given channel
* @param string $channel
*/
public function part($channel, $message = "Leaving")
{
// join channel
Services::getConnection()->getProtocol()->part($this->getUuid(), $channel, $message);
// notify channel manager
$chan = Services::getChannelManager()->getChannel($channel);
$chan->part($this->getUuid());
}
示例2: execute
/**
* @see lib/modules/CommandModule::execute()
*/
public function execute($user, $target, $message)
{
// split message
$messageEx = explode(' ', $message);
if ($target[0] != '#') {
$target = $messageEx[1];
unset($messageEx[1]);
$messageEx = array_values($messageEx);
}
if ($this->bot->isRegistered($target)) {
return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.alreadyRegistered'));
}
$users = Services::getChannelManager()->getChannel($target)->getUserList();
foreach ($users as $channelUser) {
if ($channelUser['user']->getUuid() == $user->getUuid()) {
if (stripos($channelUser['mode'], 'o')) {
$this->bot->register($target, Services::getUserManager()->getUser($user->getUuid())->accountname);
Services::getConnection()->getProtocol()->sendMode($this->bot->getUuid(), $target, '+q ' . $user->getNick());
return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.success', $target));
}
}
}
return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.noOp'));
}
示例3: PART
/**
* Handles PART command
*
* @param string $input
* @param array<string> $inputEx
* @return void
*/
public static function PART($input, $inputEx)
{
Services::getEvent()->fire(Services::getConnection()->getProtocol(), 'userParted', array('channel' => $inputEx[2], 'user' => Services::getUserManager()->getUser($inputEx[0])));
Services::getChannelManager()->getChannel($inputEx[2])->part($inputEx[0]);
}
示例4: handleLine
/**
* Notifies bots if a new messages received
* @param UserType $user
* @param string $target
* @param string $message
*/
public function handleLine($user, $target, $message)
{
if ($target[0] != '#') {
foreach ($this->runningBots as $key => $bot) {
if ($this->runningBots[$key]->getBot()->getUuid() == $target) {
$this->runningBots[$key]->handleLine($user, $target, $message);
}
}
} else {
$trigger = $message[0];
$message = substr($message, 1);
foreach ($this->runningBots as $key => $bot) {
if (strtolower($this->runningBots[$key]->getTrigger()) == strtolower($trigger) and Services::getChannelManager()->getChannel($target)->isJoined($this->runningBots[$key]->getUuid())) {
$this->runningBots[$key]->handleLine($user, $target, $message);
}
}
}
}