Phergie\Irc\Bot\React\Bot::getClient PHP Method

getClient() public method

Returns the IRC client in use by the bot.
public getClient ( ) : Phergie\Irc\Client\React\ClientInterface
return Phergie\Irc\Client\React\ClientInterface
    public function getClient()
    {
        if (!$this->client) {
            $this->setClient(new Client());
        }
        return $this->client;
    }

Usage Example

 /**
  * Injects the event loop of the bot's client into the plugin if it implements
  * \Phergie\Irc\Bot\React\LoopInterface.
  *
  * @param \Phergie\Irc\Bot\React\PluginInterface $plugin Loaded plugin
  * @param \Phergie\Irc\Bot\React\Bot $bot Bot that loaded the plugin
  */
 public function process(PluginInterface $plugin, Bot $bot)
 {
     $client = $bot->getClient();
     if ($plugin instanceof LoopAwareInterface && $client instanceof LoopAccessorInterface) {
         $plugin->setLoop($client->getLoop());
     }
 }
All Usage Examples Of Phergie\Irc\Bot\React\Bot::getClient