You're re-inventing the wheel.
The topic isn't allowed to be discussed here - per forum rules..but, peq's forum has quite a lengthy discussion about a 3rd-party program used for this purpose.
for ref:
http://peqtgc.com/forums/index.php?forums/e3.78/
EDIT: MQ2 bots and server bots are not the same.