<commit_before>Terrabot
=====

Introduction
-----
[![PyPI version](https://badge.fury.io/py/terrabot.svg)](https://badge.fury.io/py/terrabot)

Terrabot is a Terraria bot API written in Python.
It is designed to be easy to use and uses the event-listener pattern.

Installation
------

Install the python using pip:

```
pip3 install terrabot
```

Current features
------

 - Connecting to servers
 - Sending chat messages
 - Parsing world data
 - Drawing the world to an image
 - Responding to various events

Missing features
-------

 - Movement
 - The implementation of a lot of packets


Examples
-------

The following is a very basic bot, which will connect and handle chat.

-----
```python
from terrabot import TerraBot
from terrabot.events import Events

#Create a TerraBot object
bot = TerraBot('127.0.0.1')
event = bot.get_event_manager()

#Connect a function to an event using a decorator
@event.on_event(Events.Chat)
def chat(event_id, msg):
    #Do something with the message
    #In this case, stop the bot if the word "Stop" occurs
    print(msg)
    if "stop" in msg:
        bot.stop()

#Start the bot
bot.start()

#And wait
while bot.running:
pass
```

The TerraBot runs in a separate daemon thread. This means that when the main thread is gone, the bot will automatically stop. This is why the example waits for bot.running to become False.
<commit_msg>Fixed text mistake<commit_after>Terrabot
=====

Introduction
-----
[![PyPI version](https://badge.fury.io/py/terrabot.svg)](https://badge.fury.io/py/terrabot)

Terrabot is a Terraria bot API written in Python.
It is designed to be easy to use and uses the event-listener pattern.

Installation
------

Install the module using pip:

```
pip3 install terrabot
```

Current features
------

 - Connecting to servers
 - Sending chat messages
 - Parsing world data
 - Drawing the world to an image
 - Responding to various events

Missing features
-------

 - Movement
 - The implementation of a lot of packets


Examples
-------

The following is a very basic bot, which will connect and handle chat.

-----
```python
from terrabot import TerraBot
from terrabot.events import Events

#Create a TerraBot object
bot = TerraBot('127.0.0.1')
event = bot.get_event_manager()

#Connect a function to an event using a decorator
@event.on_event(Events.Chat)
def chat(event_id, msg):
    #Do something with the message
    #In this case, stop the bot if the word "Stop" occurs
    print(msg)
    if "stop" in msg:
        bot.stop()

#Start the bot
bot.start()

#And wait
while bot.running:
pass
```

The TerraBot runs in a separate daemon thread. This means that when the main thread is gone, the bot will automatically stop. This is why the example waits for bot.running to become False.

{'fraction_non_alphanumeric': 0.10323518720465286, 'fraction_numerical': 0.005089058524173028, 'mean_word_length': 3.3338582677165354, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, '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': '580934', 'n_tokens_mistral': 853, 'n_tokens_neox': 822, 'n_words': 350}