Merge branch 'develop' of github.com:ClouDev/CloudBot into develop

This commit is contained in:
Luke Rogers 2012-05-11 07:43:27 +12:00
commit da9441a5e1
3 changed files with 38 additions and 24 deletions

View file

@ -25,42 +25,58 @@ Unzip the resulting file, and continue to read this document.
## Install
Before you can run the bot, you need to install a few Python modules. These are `lXML` and `BeautifulSoup`. These can be installed with PIP (The Python package manager):
Before you can run the bot, you need to install a few Python modules. These are `lXML` and `BeautifulSoup`. These can be installed with PIP (The Python package manager). If you use Windows and dont want to set up pip, you can also find `exe` installers on the internet:
`sudo pip install lxml`
`pip install lxml`
`sudo pip install beautifulsoup`
`pip install beautifulsoup`
On Debian based systems, you can get pip with
`sudo apt-get install pip`
`apt-get install pip`
For `.spell` to work, we also need a library called `Enchant`. On Debian based systems, install it with:
`sudo apt-get install python-enchant`
`apt-get install python-enchant`
In addition, for `.whois` to work optimally, you must have `whois` installed. Again, on Debian based systems, install it with:
`sudo apt-get install whois`
`apt-get install whois`
For the wrapper to work best, install `screen`, or `daemon`:
`sudo apt-get install screen`
`sudo apt-get install daemon`
If you are a user of another Linux disto, use your package manager to install the dependencies, or, for other operating systems, use **Google** to locate source packages you can install.
Once you have installed the required dependencies, run the bot¹:
Once you have installed the required dependencies, there are two ways you can run the bot:
### Using the launcher:
The launcher will start the bot as a background process, and allow the bot to close and restart itself. This is only supported on unix-like machines (not Windows).
For the launcher to work properly, install `screen`, or `daemon` (daemon is recommended) :
`apt-get install screen`
`apt-get install daemon`
Once you have installed either `screen` or `daemon`, run the start command:
`./cloudbot start`
It will generate a default config for you. Once you have edited the config, run it again with:
It will generate a default config for you. Once you have edited the config, run it again with the same command:
`./cloudbot start`
and it will connect to any server(s) you have added to the config. (Config docs at the [wiki](http://git.io/cloudbotircconfig))
This will start up your bot as a background process. To stop it, use `./cloudbot stop`. (Config docs at the [wiki](http://git.io/cloudbotircconfig))
### Manually running the bot:
To manually run the bot and get debug output, run it with:
`python bot.py`
On Windows you can usually just double-click the `bot.py` file to start the bot, as long as you have Python installed correctly.
(note that running it without the launcher will break the restart and stop commands)
## Documentation

View file

@ -4,8 +4,6 @@ import random
nick_re = re.compile(r"^[A-Za-z0-9_|\.\-\]\[]*$")
insults = []
flirts = []
with open("plugins/data/insults.txt") as f:
insults = [line.strip() for line in f.readlines()

View file

@ -11,19 +11,19 @@ with open("plugins/data/larts.txt") as f:
with open("plugins/data/slaps.txt") as f:
slaps = [line.strip() for line in f.readlines()
if not line.startswith("//")]
if not line.startswith("//")]
with open("plugins/data/slap_items.txt") as f:
slap_items = [line.strip() for line in f.readlines()
if not line.startswith("//")]
items = [line.strip() for line in f.readlines()
if not line.startswith("//")]
with open("plugins/data/kills.txt") as f:
kills = [line.strip() for line in f.readlines()
if not line.startswith("//")]
with open("plugins/data/kill_bodyparts.txt") as f:
kill_bodyparts = [line.strip() for line in f.readlines()
if not line.startswith("//")]
parts = [line.strip() for line in f.readlines()
if not line.startswith("//")]
@hook.command
@ -43,7 +43,7 @@ def slap(inp, me=None, nick=None, conn=None, notice=None):
out = random.choice(slaps)
out = out.replace('<who>', target)
out = out.replace('<item>', random.choice(slap_items))
out = out.replace('<item>', random.choice(items))
# act out the message
me(out)
@ -65,7 +65,7 @@ def lart(inp, me=None, nick=None, conn=None, notice=None):
out = random.choice(larts)
out = out.replace('<who>', target)
out = out.replace('<item>', random.choice(slap_items))
out = out.replace('<item>', random.choice(items))
me(out)
@ -85,5 +85,5 @@ def kill(inp, me=None, nick=None, conn=None, notice=None):
out = random.choice(kills)
out = out.replace('<who>', target)
out = out.replace('<body>', random.choice(kill_bodyparts))
out = out.replace('<body>', random.choice(parts))
me(out)