Skip to content

class Bot

Oliver edited this page Apr 25, 2020 · 1 revision

www/php-ircbot/Classes/Library/IRC/Bot.php


Bot

Package

IRCBot\Library

author

Overview

Public Properties

No public properties found

Constants

No constants found

Public Methods

__construct() | __destruct() | addCommand() | addListener() | connectToServer() | getCommandPrefix() | getCommands() | getUserNickName() | log() | sendDataToServer() | setChannel() | setLogFile() | setMaxReconnects() | setName() | setNick() | setPort() | setServer() |

Properties

channel

A list of all channels the bot should connect to.

private $channel : array

Array

commandPrefix

Defines the prefix for all commands interacting with the bot.

protected $commandPrefix : string

Array

commands

All available commands.

Commands are type of IRCCommand private $commands : array

Array

connection

Holds the server connection.

private $connection : \Library\IRC\Connection

Array

ex

All of the messages both server and client

private $ex : array

Array

listeners

All available listeners.

Listeners are type of IRCListener private $listeners : array

Array

logFile

Complete file path to the log file.

Configure the path, the filename is generated and added. private $logFile : string

Array

logFileHandler

Holds the reference to the file.

private $logFileHandler : \Library\IRC\type

Array

maxReconnects

The number of reconnects before the bot stops running.

private $maxReconnects : int

Array

name

The name of the bot.

private $name : string

Array

nick

The nick of the bot.

private $nick : string

Array

nickCounter

The nick counter, used to generate a available nick.

private $nickCounter : int

Array

nickToUse

The nick of the bot.

private $nickToUse : string

Array

numberOfReconnects

Contains the number of reconnects.

private $numberOfReconnects : int

Array

Methods

__construct()

Creates a new IRCBot.

public __construct(array $configuration = array()) : void

Tags

__destruct()

Cleanup handlers.

public __destruct() : mixed

addCommand()

Adds a single command to the bot.

public addCommand(\Library\IRC\IRCCommand $command) : mixed

Tags

addListener()

public addListener(\Library\IRC\Listener\Base $listener) : mixed

connectToServer()

Connects the bot to the server.

The "USER" input is formed like: "USER misc misc misc :misc\r\n" http://stackoverflow.com/questions/2356040/my-ruby-irc-bot-doesnt-connect-to-the-irc-server-what-am-i-doing-wrong

public connectToServer() : mixed

Tags

executeCommand()

protected executeCommand(mixed $source, mixed $commandName, array $arguments, mixed $data) : mixed

getClassName()

Returns class name of $object without namespace

private getClassName(mixed $object) : string

Tags

getCommandPrefix()

public getCommandPrefix() : mixed

getCommands()

public getCommands() : mixed

getUserNickName()

Get the nickname from the data string.

public getUserNickName(string $data) : mixed

join_channel()

Joins one or multiple channel/-s.

private join_channel(mixed $channel) : mixed

Tags

log()

Adds a log entry to the log file.

public log(string $log, string $status = '') : mixed

Tags

main()

This is the workhorse function, grabs the data from the server and displays on the browser

private main() : mixed

Tags

sendDataToServer()

Displays stuff to the broswer and sends data to the server.

public sendDataToServer(string $cmd) : mixed

Tags

setChannel()

Sets the channel.

E.g. '#testchannel' or array('#testchannel','#helloWorldChannel')

public setChannel(string|array $channel) : mixed

setLogFile()

Sets the filepath to the log. Specify the folder and a prefix.

E.g. /Users/yourname/logs/ircbot- That will result in a logfile like the following: /Users/yourname/logs/ircbot-11-12-2012.log

public setLogFile(string $logFile) : mixed

setMaxReconnects()

Sets the limit of reconnects, before the bot exits.

public setMaxReconnects(int $maxReconnects) : mixed

setName()

Sets the name of the bot.

"Yes give me a name!"

public setName(string $name) : mixed

setNick()

Sets the nick of the bot.

"Yes give me a nick too. I love nicks."

public setNick(string $nick) : mixed

setPort()

Sets the port.

E.g. 6667

public setPort(int $port) : mixed

setServer()

Sets the server.

E.g. irc.quakenet.org or irc.freenode.org

public setServer(string $server) : mixed

setWholeConfiguration()

Sets the whole configuration.

private setWholeConfiguration(array $configuration) : mixed

Tags

\ » Classes » Bot

Clone this wiki locally