Jessecar96/SteamBot — pull request #220 by cwhelchel (2013-03-28 00:43:14+00:00)
Title: Feature/bot mgr

Another sorta big one. But its for the benefit of society. Please look it over, pull it down, run it, break it, etc. and post your comments here.

## Bot Manager
Does what it says, manages the bots, be them in separate processes or in separate threads (more on threads later). More over, it allows users to enter commands through the console window.

As a user, you can stop and start bots based mainly on the bots index in their configuration array. This is done via the ``start`` and ``stop`` command. Both of these take a zero-based index to find the correct bot to start or stop. You can also use ``stopbot`` and pass in the bot's username but it hasn't been fully implemented yet.

![Proc](https://f.cloud.github.com/assets/1816402/311387/63db5e80-973e-11e2-8c51-e0f7bc9a5d93.png)

You can also dump (part) of the bot's configuration with the ``show`` command:

![Proc2](https://f.cloud.github.com/assets/1816402/311390/8e7cf630-973e-11e2-9742-f5f6e1921027.png)

## Threads and Exceptions
Using a new configuration setting ``UseSeparateProcesses`` in the ``settings.json`` file, you can control if you want the bots to remain in one console and use a better threading mechanism to handle the Steam interaction. It's better because it allows for exceptions in one running bot to not kill the entire application. See #150.

With this threading mode you still get to use the above bot manager commands to start and stop bots.

![thread](https://f.cloud.github.com/assets/1816402/311400/2c2f0c60-973f-11e2-9f8b-4a5ac753b489.png)

Here's an example of a bot that threw an exception in one thread being shut down and restarted (I made my handler throw when a message was received) :

![thread2](https://f.cloud.github.com/assets/1816402/311405/3973f390-973f-11e2-8a07-c1b226223940.png)

![thread3](https://f.cloud.github.com/assets/1816402/311407/496b8592-973f-11e2-9689-7c3d89591696.png)

### Steam Guard
This section deserves special note in the threaded management mode. This was present even without these changes as some of you may have found that you could not enter a Steam Guard code when running multiple bots spitting out text to one console. To solve this I added a form that prompts the user for the Steam Guard code. (This bug doesn't seem to be present in the separate processes mode so the form doesn't show up in that mode.)

![thread4](https://f.cloud.github.com/assets/1816402/311425/0d01f266-9740-11e2-9f38-11497311abe3.png)

**That's it. Go and tear it apart**