<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
phergie / phergie-irc-plugin-react-command example snippets
new \Phergie\Irc\Plugin\React\Command\Plugin(array(
// Select how you'd like the command to be triggered.
// Only 1 method supported at a time so make sure to remove unused methods.
'prefix' => '!', // string denoting the start of a command
// or
'pattern' => '/^!/', // PCRE regular expression denoting the presence of a
// command
// or
'nick' => true, // true to match common ways of addressing the bot by its
// connection nick
))
use Phergie\Irc\Plugin\React\Command\CommandEvent;
use Phergie\Irc\Bot\React\EventQueueInterface;
use Phergie\Irc\Bot\React\PluginInterface;
class FooPlugin implements PluginInterface
{
public function getSubscribedEvents()
{
return array('command.foo' => 'handleFooCommand');
}
public function handleFooCommand(CommandEvent $event, EventQueueInterface $queue)
{
$commandName = $event->getCustomCommand();
$fooParams = $event->getCustomParams();
// ...
}
}