src/Plugin.php
public function handleCommand(Event $event, Queue $queue)
    {
        if ($this->validateParams($event)) {
            $params = $event->getCustomParams();
            $results = array();
            $total = 0;
            $count = $params[0];
            $sides = (isset($params[1])) ? $params[1] : $this->defaultDieSides;

            for ($roll = 1; $roll <= $count; $roll++) {
                $rollResult = $this->doRoll($sides);
                $results[] = $rollResult;
                $total += $rollResult;
            }
            $response = $this->generateResponse($event, $total, $results);
            $this->sendIrcResponseLine($event, $queue, $response);
        } else {
            $this->handleCommandHelp($event, $queue);
        }
    }
public function handleCommand(Event $event, Queue $queue)
    {
        if ($this->validateParams($event)) {
            $params = $event->getCustomParams();
            $results = array();
            $total = 0;
            $count = $params[0];
            $sides = (isset($params[1])) ? $params[1] : $this->defaultDieSides;

            for ($roll = 1; $roll <= $count; $roll++) {
                $rollResult = $this->doRoll($sides);
                $results[] = $rollResult;
                $total += $rollResult;
            }
            $response = $this->generateResponse($event, $total, $results);
            $this->sendIrcResponseLine($event, $queue, $response);
        } else {
            $this->handleCommandHelp($event, $queue);
        }
    }
public function handleCommand ( Event $ event , Queue $ queue ) { if ( $ this -> validateParams ( $ event ) ) { $ params = $ event -> getCustomParams ( ) ; $ results = array ( ) ; $ total = 0 ; $ count = $ params [ 0 ] ; $ sides = ( isset ( $ params [ 1 ] ) ) ? $ params [ 1 ] : $ this -> defaultDieSides ; for ( $ roll = 1 ; $ roll <= $ count ; $ roll ++ ) { $ rollResult = $ this -> doRoll ( $ sides ) ; $ results [ ] = $ rollResult ; $ total += $ rollResult ; } $ response = $ this -> generateResponse ( $ event , $ total , $ results ) ; $ this -> sendIrcResponseLine ( $ event , $ queue , $ response ) ; } else { $ this -> handleCommandHelp ( $ event , $ queue ) ; } }
Handle the dice roll command

@param \Phergie\Irc\Plugin\React\Command\CommandEvent $event
@param \Phergie\Irc\Bot\React\EventQueueInterface $queue
Handle the dice roll command