Handles command calls

@param \Phergie\Irc\Plugin\React\Command\CommandEventInterface $event
@param \Phergie\Irc\Bot\React\EventQueueInterface $queue
495580
public function handleCommand(CommandEventInterface $event, EventQueueInterface $queue)
    {
        $params = $event->getCustomParams();
        if (count($params) < 2) {
            $queue->ircNotice($event->getNick(), 'Can\'t identify nickname or message.');
            $this->helpMessages([ $queue, 'ircNotice' ], $event->getNick(), $event->getCustomCommand());
        } else {
            $message = implode(' ', array_slice($params, 1));
            if ($this->database->postMessage($event->getNick(), $params[0], $message)) {
                $queue->ircNotice($event->getNick(), 'Ok, I\'ll tell him/her.');
            } else {
                $queue->ircNotice($event->getNick(), 'Sry, There\'s so many things to tell him/her.');
            }
        }
    }
323324
protected function event($queue, $event)
    {
        if ($this->container && $this->container->bound(Dispatcher::class)) {
            $queue = Str::replaceFirst('queues:', '', $queue);

            $this->container->make(Dispatcher::class)->dispatch(
                $event->connection($this->getConnectionName())->queue($queue)
            );
        }
    }
675398
public function handleJoinCommand(CommandEvent $event, EventQueueInterface $queue)
    {
        $params = $event->getCustomParams();
        if (!$params) {
            $this->handleJoinHelp($event, $queue);
        } else {
            $channels = $params[0];
            $keys = isset($params[1]) ? $params[1] : null;
            $queue->ircJoin($channels, $keys);
        }
    }
211664
private void handleQueueMemberEvent(QueueMemberEvent event)
    {
        final AsteriskQueueImpl queue = getInternalQueueByName(event.getQueue());
        if (queue == null)
        {
            logger.error("Ignored QueueEntryEvent for unknown queue " + event.getQueue());
            return;
        }

        AsteriskQueueMemberImpl member = queue.getMember(event.getLocation());
        if (member == null)
        {
            member = new AsteriskQueueMemberImpl(server, queue, event.getLocation(), QueueMemberState.valueOf(event
                    .getStatus()), event.getPaused(), event.getPenalty(), event.getMembership(), event.getCallsTaken(),
                    event.getLastCall());

            queue.addMember(member);
        }
        else
        {
            manageQueueMemberChange(queue, member, event);
        }

    }
930675
public function handle(EventMessage $event)
    {
        if ($event instanceof \PAMI\Message\Event\AsyncAGIEvent) {
            if ($event->getCommandId() == $this->lastCommandId) {
                $this->lastAgiResult = trim($event->getResult());
            }
        }
    }
703879
private void fireOnPurgeQueue(ChannelEvent e) {
        List<EventListener> listeners = changes.getListenerList(AMQP);
        for (EventListener listener : listeners) {
            ChannelListener amqpListener = (ChannelListener)listener;
            amqpListener.onPurgeQueue(e);
        }
    }
1078336
public function queue($command, array $parameters = [])
    {
        $app = $this->app->getLaravel();
        $app['Illuminate\Contracts\Queue\Queue']->push(
            'Illuminate\Foundation\Console\QueuedJob', func_get_args()
        );
    }
209013
public function handle(EventInterface $event)
    {

        try {
            // load the application server and the naming directory instance
            /** @var \AppserverIo\Psr\ApplicationServer\ApplicationServerInterface $applicationServer */
            $applicationServer = $this->getApplicationServer();
            /** @var \AppserverIo\Psr\Naming\NamingDirectoryInterface $namingDirectory */
            $namingDirectory = $applicationServer->getNamingDirectory();

            // load the configuration filename
            $configurationFilename = $applicationServer->getConfigurationFilename();

            // write a log message that the event has been invoked
            $applicationServer->getSystemLogger()->info($event->getName());

            // load the setup mode from the naming directory
            $setupMode = $namingDirectory->search('php:env/args/s');
            $currentUser = $namingDirectory->search('php:env/currentUser');

            // load the service instance and switch to the new setup mode
            /** @var \AppserverIo\Appserver\Core\Api\ContainerService $service */
            $service = $applicationServer->newService('AppserverIo\Appserver\Core\Api\ContainerService');
            $service->switchSetupMode($setupMode, $configurationFilename, $currentUser);

        } catch (NamingException $ne) {
            $applicationServer->getSystemLogger()->error('Please specify a setup mode, e. g. \'./server.php -s prod\'');
        } catch (\Exception $e) {
            $applicationServer->getSystemLogger()->error($e->__toString());
        }
    }
1195966
public function onQueueResponseListenerGenerate(
        QueueResponseEvent $event,
        $eventName,
        EventDispatcherInterface $dispatcher
    ) {
        $queueName          = $event->getQueueName();
        $kind               = $event->getKind();
        $content            = $event->getContent();
        $msgKey             = 'con4gis - QueueMessage';
        $msgType            = $queueName . '_' . $kind;
        $param              = $event->getParam();
        $param['queueName'] = $queueName;
        $param['kind']      = $kind;
        $param['content']   = $content;
        $param['msgKey']    = $msgKey;
        $param['msgType']   = $msgType;

        if (class_exists('Notification')) {
            $notifications = Notification::findByType($msgType);

            if ($notifications !== null) {
                while ($notifications->next()) {
                    $notifications->current()
                                  ->send($param);
                }
            }
        }
    }
689493
public void handleQueueMemberRemovedEvent(QueueMemberRemovedEvent event)
    {
        final AsteriskQueueImpl queue = getInternalQueueByName(event.getQueue());
        if (queue == null)
        {
            logger.error("Ignored QueueMemberRemovedEvent for unknown queue " + event.getQueue());
            return;
        }

        final AsteriskQueueMemberImpl member = queue.getMember(event.getLocation());
        if (member == null)
        {
            logger.error("Ignored QueueMemberRemovedEvent for unknown agent name: " + event.getMemberName() + " location: "
                    + event.getLocation() + " queue: " + event.getQueue());
            return;
        }

        queue.removeMember(member);
    }
487811
public function onConsoleCommand(ConsoleCommandEvent $event): void
    {
        $command = $event->getCommand();

        Hub::getCurrent()
            ->configureScope(function (Scope $scope) use ($command): void {
                $scope->setTag('command', $command ? $command->getName() : 'N/A');
            });
    }
769719
final void performAction(final AbstractEventQueue eventQueue, final Event<?> event) {
        final Event<T> eventObject = (Event<T>) event;

        try {
            action(eventObject);
        } catch (final Exception e) {
            LOGGER.log(Level.WARN, "Event perform failed", e);
        } finally { // remove event from event queue
            if (eventQueue instanceof SynchronizedEventQueue) {
                final SynchronizedEventQueue synchronizedEventQueue = (SynchronizedEventQueue) eventQueue;

                synchronizedEventQueue.removeEvent(eventObject);
            }
        }
    }
1240119
public function onSetErrorListenerRun(
        QueueSetErrorEvent $event,
        $eventName,
        EventDispatcherInterface $dispatcher
    ) {
        $query = $event->getQuery();
        $this->database->execute($query);
    }
248731
public function handleSayCommand(Event $event, Queue $queue)
    {
        $params = $event->getCustomParams();
        if (count($params) < 2) {
            $this->handleSayHelp($event, $queue);
        } else {
            $channels = array_shift($params);
            $queue->ircPrivmsg($channels, implode(' ', $params));
        }
    }
497879
public function handleEvent(Event $event, Queue $queue)
    {
        if ($event instanceof UserEvent) {
            $nick = $event->getNick();
            $channel = $event->getSource();
            $params = $event->getParams();
            $text = $params['text'];
            $matched = stripos($text, '8 ball') !== false;
            if ($matched) {
                $msg = $nick . ', the magic 8 ball says "' . $this->getMagicEightBallAnswer() . '"';
                $queue->ircPrivmsg($channel, $msg);
            }
        }
    }
416552
protected function sendHelpReply(Event $event, Queue $queue, array $messages)
    {
        $method = 'irc' . $event->getCommand();
        $target = $event->getSource();
        foreach ($messages as $message) {
            $queue->$method($target, $message);
        }
    }
1164318
final public function dispatch(Event $event): void
    {
        if (!$event instanceof ReceivedEvent && $this->discriminator->shouldEnqueue($event)) {
            $this->queue->send($event);
        }

        if ($event instanceof ReceivedEvent) {
            $event = $event->getOriginalEvent();
        }

        $this->wrappedEventBus->dispatch($event);
    }