Erebot
latest
A modular IRC bot for PHP 7.0+
|
A simple prompt which can be used to send commands remotely. More...
Public Member Functions | |
__construct (\Erebot\Interfaces\Core $bot, $connector=null, $group=null, $perms=0660) | |
__destruct () | |
Destructor. | |
connect () | |
disconnect ($quitMessage=null) | |
getBot () | |
getConfig ($chan) | |
getIO () | |
getSocket () | |
isConnected () | |
process () | |
Processes commands queued in the input buffer. | |
read () | |
Protected Member Functions | |
handleMessage ($line) | |
Protected Attributes | |
$bot | |
A bot object implementing the Erebot::Interfaces::Core interface. | |
$io | |
I/O manager for the socket. | |
$socket | |
The underlying socket, represented as a stream. | |
A simple prompt which can be used to send commands remotely.
This class can be used by external processes to send commands through the bot. It creates a UNIX socket other programs can send commands to whenever they want the bot to send certain commands to an IRC server.
Such commands must be prefixed by a pattern (which accepts '*' and '?' as wildcards, but not the full grammar of regular expressions) to indicate which server(s) the command must be sent to (hint: '*' can be used to refer to all servers the bot is connected to).
This makes in possible to display the output of some shell script on IRC. For example, the following command would display the output of /some/command.sh to #Erebot on all servers the bot is currently connected to:
Definition at line 45 of file Prompt.php.
Erebot\Prompt::__construct | ( | \Erebot\Interfaces\Core | $bot, |
$connector = null , |
|||
$group = null , |
|||
$perms = 0660 |
|||
) |
Constructs the UNIX socket that represents the prompt.
Erebot::Interfaces::Core | $bot | Instance of the bot to operate on. |
string | $connector | (optional) Path where the newly-created UNIX socket will be made accessible. The default is to create a UNIX socket named "Erebot.sock" in the system's temporary directory (usually "/tmp/"). |
mixed | $group | (optional) Either the name or the identifier of the UNIX group the socket will belong to. The default is to not change the group of the socket (i.e. to keep whatever is the main group for the user running Erebot). |
int | $perms | (optional) UNIX permissions the newly-created socket will receive. The default is to give read/write access to the user running Erebot and to the group the socket belongs to (see $group). |
mode
). Definition at line 99 of file Prompt.php.
|
protected |
Handles a line received from the prompt.
string | $line | A single line of text received from the prompt, with the end-of-line sequence stripped. |
Definition at line 224 of file Prompt.php.