PHP code example of whisller / irc-bot-bundle

1. Go to this page and download the library: Download whisller/irc-bot-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

whisller / irc-bot-bundle example snippets



// app/AppKernel.php

public function registerBundles()
{
    $bundles = array(
        // ...
        new Whisnet\IrcBotBundle\WhisnetIrcBotBundle(),
    );
}


namespace Acme\EventListener;

use Whisnet\IrcBotBundle\EventListener\Plugins\Commands\CommandListener;
use Whisnet\IrcBotBundle\Event\BotCommandFoundEvent;

class HelloListener extends CommandListener
{
    public function onCommand(BotCommandFoundEvent $event)
    {
        // get list of arguments passed after command
        $args = $event->getArguments();

        $msg = 'Hi, '.(isset($args[0]) ? $args[0] : 'nobody').' !';

        // write to the current channel
        $this->sendMessage(array($event->getChannel()), $msg);
    }
}
 bash
$ php composer.phar update whisller/irc-bot-bundle