THIS BOT IS DEPRECATED IN FAVOR OF WORFBOT3
A simple IRC Bot written in Python
To start it just cd to the src directory and type ./ircbot.py, although
before using the bot it's recommended to check the config first.
The bot can handle multiple channels at a time, also if you want to have a
private discussion it can be queried (/query WorfBot).
IRC Protocol reference: RFC 1459
Sphinx docs to come
!about- a few words about this software
!bible <Bible Reference>- quotes the ESV bible in the channel
!define <Word>- Looks up a list of definitions for Word on dictionaryapi.com
!google <search term>- returns a link and a short description of the first Google search result
- see Dependencies: !google
!help- list all available commands
!heretic [Person]- Checks the number of denunciations the sender or [Person] has received
- _e.g. <@mstark> !heretic < WorfBot> mstark (6 denunciations)
!heretics [count]- list top 5 (or [count]) known heretics
!hono(u)r <phrase>- Checks whether is honorable or not
!mball- the famous Magic Ball
!uptime- shows current uptime of the bot
!weather <city>or!weather <city>, <state or country>- replies some info related to the current weather conditions from the given location
!wiki <search term>- replies a wikipedia link for <search term> along with the first paragraph from the page
!xkcd [<number>, <search term>]- If a number is given, retrieves a link to and the alt-text of the specified XKCD comic
- Otherwise, searches for the search term, and returns a link to and alt-text of a relevant XKCD comic
!add <word>:[Honorable,Dishonorable]- specifies as Honorable or Dishonorable
- see Config: owner
!channels- replies a list containing the channels the bot is connected to
- see Config: owner
!join <#channel >+- the bot joins the given channels, minimum one channel name must be supplied
- see Config: owner
!quit [#channel ]+- disconnects the bot from the given list of channels
- if no arguments are given, all connected channels are disconnected
- if some arguments are provided the bot checks the channel names and disconnects only the valid ones
- if no channel is "alive" then the bot closes
- Example:
!quit #foo #bar- quits from #foo and #bar - see Config: owner, channels
Total: 13 commands
add_heretic- Listens to people being called heretics and takes noteauto_bible- Listens for bible references in [square brackets] and quotes the ESV bible in responseremove_heretic- Listens to people being called non-heretics and takes note
Total: 3 auto-commands
- In
src/config.pyyou must add the name of the command to thecmds_list's end(without !) - In
src/cmds/directory you must create a file named after your command - Into the newly created file you must define a function named after your command that takes one parameter. This parameter will contain the command components sent by the user. The function must return either a message (string) to be sent on the channel, or a list, first item being a command (other than PRIVMSG which is added automatically if needed) and the second being the command's arguments.
E.g.:
If you want to create a command !ncmd, you must follow these steps:
- Add 'ncmd' to the
cmds_listinsrc/config.py - Create
src/cmds/ncmd.py - In
src/cmds/ncmd.pydefinedef dance(param):,paramwill hold the users command components(seesrc/parser.py) in case you must do some checkings, it must return a message(eg.return 'Dance time!', in this casesrc/ircbot.pywill automatically addPRIVMSGat the beginning and\r\nat the end) or a list(eg.return ['JOIN ', '#chan1,#chan2'], in this case the list will be joined and\r\nadded at the end)
If you want to create a command that the bot should execute if something happens
on the chat (not if the command is manually triggered) you should add the
command name to the auto_cmds_list insead of cmds_list.
See src/config.py:
owner- the users who are allowed to send a specific command to the bot (for example the!quitcommand)log- path to the logging directory, all logs are stored hereserver- server to connect to (default: chat.freenode.net)port- port number to use (default: 6667)channels- a list of channels to connect tonicks- a list of strings, the bot's name will be the first unused nick from this list or the first nick in the list and a random sequence appended if all nicks are usedreal_name- bot's "real name"cmds_list- a list of strings that the bot knows to answer toauto_cmds_list- a list of commands defined as regular commands with the only difference that they cannot be invoked by users, the bot executes them as result of an event
!bible,!weather, and!wikimodule depends on BeautifulSoup!weatherdepends on BeautifulStoneSoup (XML)!bibleand!wikidepends on BeautifulSoup (HTML)
!googlemodule depends on Google Custom Search API- before using the bot please see the installation page
!bible,auto_bible, etc. depend on customized versions of python-bible and python-scriptures
(C) Copyright 2011-2014 Barbu Paul - Gheorghe
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.