Update bothandler.py

Complete code rewrite from scratch