ninjabot: sanitisation, preparation changes

Here's something to mull over.
Warning: this code may look scarily compact.

1. A string can be spliced with `[:n]` even if the string is shorter than length `n`.
2. Using `unicode-escape` to encode the string helpfully stops escape sequences. However, this may not be what some people want. The difference here is that it does not destroy bad escape sequences, but rather stops them from being bad.
3. A lot less code.

If you aren't going to merge this, d23a3a3 should probably be reverted.