<commit_before>Simple framework for creating IRC bots.

### Example

init.py:

```python
from pyromancer.objects import Pyromancer

p = Pyromancer('test.settings')
p.run()
```

test/settings.py:

```python
host = '1.2.3.4'
port = 6667
nick = 'PyromancerBot'
encoding = 'ISO-8859-1'
```

### Custom commands
Writing own commands is fairly simple. Create a folder which will be the package name, with a folder named "commands" in it and a module to hold the commands in there. In your module, you can register functions to be a command with the built-in command decorator. After that you need to register it in your settings, and you can use it.

#### Example

File layout:

```
test/
    __init__.py
    commands.py
    settings.py
init.py
```

commands.py:

```python
from pyromancer.decorators import command

@command(r'bye (.*)')
def bye(match):
    return 'Bye {m[1]}!'
```

On IRC:

```
<User> bye everyone
<Bot> Bye everyone!
```

Pyromancer scans the modules in the settings automatically for functions decorated using the commands decorator, so all your commands in `commands.py` are used automatically.

You can also create a directory named `commands` with submodules containing the commands. Just make sure that you import either the modules or all of the commands in the `__init__.py` file.

#### The `command` decorator

You must apply this to a function to mark it as a command. It will be used when scanning for and collecting commands.

##### Parameters

* `patterns` - a regular expression or a list of expressions. When a list is given, all patterns are attempted when matching the input, and only when all patterns in the list fail to match, the command is not executed.
```python
@command(['hi', 'hello'])
def hi(match):
    return 'Hello!'
```

* `prefix` - a boolean which defaults to `True`. When true, the command pattern is only attempted to match when the message line starts with the prefix defined in the settings of the bot. This is useful for commands which are very bot-like (in contrary to commands which look and behave like natural language). Using a boolean and a setting allows the same command to be triggered in different ways, depending on the settings of the bot which installed the command package.<commit_msg>Small tweaks to the readme which were inaccurate<commit_after>Simple framework for creating IRC bots.

### Example

init.py:

```python
from pyromancer.objects import Pyromancer

p = Pyromancer('test.settings')
p.run()
```

test/settings.py:

```python
host = '1.2.3.4'
port = 6667
nick = 'PyromancerBot'
encoding = 'ISO-8859-1'
```

### Custom commands
Writing own commands is fairly simple. Create a folder which will be the package name, with a file named `commands.py` in it to hold the commands. In `commands.py`, you can register functions to be a command with the built-in command decorator.

#### Example

File layout:

```
test/
    __init__.py
    commands.py
    settings.py
init.py
```

commands.py:

```python
from pyromancer.decorators import command


@command(r'bye (.*)')
def bye(match):
    return 'Bye {m[1]}!'
```

On IRC:

```
<User> !bye everyone
<Bot> Bye everyone!
```

Pyromancer scans automatically for functions decorated using the commands decorator, so all your commands in `commands.py` are used automatically.

You can also create a directory named `commands` with submodules containing the commands. Just make sure that you import either the modules or all of the commands in the `__init__.py` file.

#### The `command` decorator

You must apply this to a function to mark it as a command. It will be used when scanning for and collecting commands.

##### Parameters

* `patterns` - a regular expression or a list of expressions. When a list is given, all patterns are attempted when matching the input, and only when all patterns in the list fail to match, the command is not executed.
```python
@command(['hi', 'hello'])
def hi(match):
    return 'Hello!'
```

* `prefix` - a boolean which defaults to `True`. When true, the command pattern is only attempted to match when the message line starts with the prefix defined in the settings of the bot. This is useful for commands which are very bot-like (in contrary to commands which look and behave like natural language). Using a boolean and a setting allows the same command to be triggered in different ways, depending on the settings of the bot which installed the command package.
{'fraction_non_alphanumeric': 0.08621860149355058, 'fraction_numerical': 0.006336275175379045, 'mean_word_length': 4.23696682464455, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6282907', 'n_tokens_mistral': 1227, 'n_tokens_neox': 1168, 'n_words': 630}