Skip to content
An IRC bot written in PHP.
PHP Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.



A simple IRC bot written in PHP.

 - Automatically connect to a IRC host and join a channel
 - Automatically rejoin the channel after a kick
 - Automatically reconnect to the host after disconnect
 - Listen to commands
 - Modules support which extend the functionality of the bot

Please take a look at the phpircbot.conf.php-dist, adapt it to your needs and
rename it to phpircbot.conf.php.

Following settings can be adjusted,

IRC_PORT	- IRC Port, eg 6667
IRC_CHANNEL	- Channel to be joined, eg #help
IRC_NICK	- Nick of the bot
IRC_HOST_RECONNECT	- How many retries to connect to the host before the bot
					  should shut down
IRC_ADMIN_USERS		- Nicks of the "admin" users, these users can eg shutdown
					  the bot
AUTOLOAD_MODULES	- which modules should be loaded at startup

version		- shows the version of the bot
shutdown	- will shutdown the bot (*)
restart		- will restart the bot (if started from the (*)
modules		- shows a list of loaded modules
commands	- shows a list of registered commands
nick		- rename the bot (*)
load		- load a module (*)
quietmode	- enables/disables quiet mode (console output) (*)

(*) Admin-only commands

Module development
1) Create a file named module_<your desired module name>.php
   You should make sure that your module name is very simple, eg just a
   short word.
2) Every module needs a <module_name>_init() function. Use it to initialize
   variables or set up anything you need for later use.
3) Add a <module_name>_command($string, $target='', $private=0) function. This
   will be called if someone writes your module name to the bot. $string is
   the text, $target is the person who sent it and $private tells you if it
   was written privately or publicly.

To load your module when the bot is running, write "load <your module name>" to
it. If you want to autoload the module at startup add it to the
AUTOLOAD_MODULES constant. Please note that in that case the modules are loaded
before the bot has joined the channel and everything.
You can’t perform that action at this time.