1. Go to this page and download the library: Download epochblue/philip 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/ */
// Message Events
$bot->onChannel() // listens only to channel messages
$bot->onPrivateMessage() // listens only to private messages
$bot->onMessages() // listens to both channel messages and private messages
// Server Events
$bot->onError() // listens only for IRC ERROR messages
$bot->onInvite() // listens only for invites to channels
$bot->onJoin() // listens only for people joining channels
$bot->onKick() // listens only for people getting kicked from channels
$bot->onMode() // listens only for IRC MODE change messages
$bot->onNick() // listens only for people changing nick on channels
$bot->onNotice() // listens only for IRC NOTICE messages
$bot->onPart() // listens only for people leaving channels
$bot->onPing() // listens only for IRC PING messages
$bot->onQuit() // listens only for people leaving servers
$bot->onTopic() // listens only for channel topic changes
$event->getRequest() // Returns a Philip Request object
$event->getMatches() // Returns an array of any matches found for match
groups specified by the <regex pattern>.
$event->addResponse() // Adds a response to the list of responses for the event.
$request->getSendingUser() // Get the nick of the user sending a message
$request->getSource() // Get the channel of the sent message,
// or nick if it was a private message
$request->getMessage() // Get the text of a message for channel/private messages
Response::msg($who, $msg) // Sends a message $msg to channel/PM $who
Response::action($who, $msg) // Same as a ::msg(), but sends the message as an IRC ACTION
$bot = new Philip(array(/*...*/));
$bot->loadPlugin(new \Example\PhilipPlugin\HelloPlugin($bot));
$bot->loadPlugins(array(
new \Example\PhilipPlugin\HelloPlugin($bot),
// ...
));
$bot = new Philip(array(/*...*/));
$bot->loadPlugin(new \Example\PhilipPlugin\HelloPlugin($bot, $config['HelloPlugin']));
// .../Example/PhilipPlugin/HelloPlugin.php
namespace Example\PhilipPlugin;
use Philip\AbstractPlugin as BasePlugin;
class HelloPlugin extends BasePlugin
{
/**
* Does the 'heavy lifting' of initializing the plugin's behavior
*/
public function init()
{
$this->bot->onChannel('/^hello$/', function($event) {
$request = $event->getRequest();
$event->addResponse(
Response::msg($request->getSource(), "Hi, {$request->getSendingUser()}!")
);
});
}
/**
* Returns the Plugin's name
*/
public function getName()
{
return 'HelloPlugin';
}
}
sh
$> php composer.phar install -v
sh
$> php examplebot.php
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.