ClouDev/CloudBot — pull request #227 by xxyy (2014-04-06 01:34:38+00:00)
Title: Fix multi-connection databases for factoids and other minor stuff

**The issue:**
Currently, if you have your CloudBot connected to multiple networks, the factoid command and its regex hooks do only initialize their database connection (aka. create the necessary table if it does not exist) if it has not been initialized. The initialization state is stored in a global boolean db_ready.
However, if you have multiple connections, the table is created for the first connection the bot receives a message on, but other connections' databases *are not checked*. So, suppose you have two connections, c1 and c2. The bot does the following:
````
Receives regex/command from c1, checks db_ready (is False) -> Creates table, Sets db_ready = True
Receives regex/command from c2, checks db_ready (is True) -> Fails with "table does not exist"!
````
I can also provide a stacktrace that occured before applying this patch: http://pastebin.com/dCEARsRQ

**What this does:**
This PR resolves above issue by storing whether the database is ready *per connection*. It does that by changing db_ready to a list and adding every initialized (i.e. table was created) connection's name to it.
Instead of checking for `not db_ready`, it checks `conn.name in db_ready`.
So our previous example would look like this:
````
Receives regex/command from c1, checks db_ready contains c1 (False) -> Creates table, Adds c1
Receives regex/command from c2, checks db_ready contains c2 (False) -> Creates table, Adds c2
````

It also fixes the append message for existing factoids not showing `Type ?{} to see it`. I think this should be shown for this use case too because all other messages say that and it would be inconsistent not to show that. Also, what if a user appends to a factoid but forgot how to show factoids?

This PR also changes all outputted messages to Unicode strings to allow for Unicode factoids. (I had this on my bot, has been working for at least 2 weeks without problems) This is useful for example for unicode faces like `ʘ‿ʘ` (Note: It had occurred first for different data I can't remember, so I cannot guarantee that this exact example will produce an error).

**How to reproduce:**
Clone a new CloudBot. Add two networks to your config file. Add a factoid using `.remember` on the first connection and then do the same on the other connection. The second time, a stack trace is printed with a `table does not exist` error. (2 ?something messages should also work for reproducing)

This patch is currently being run on my bot and no issues have occurred.

*If the text of this PR seems familiar to you, I have copied the one from #209 (and adapted it for this change) because the issue and solution are very similar.*

(Editor's note: It would also be nice to see #196)

Thank you!