Refactored bot.py

Wrapping SQL things in transactions.
Made LiveLeak uploader a member of Bot.
Reduced code duplication.