This is done by making a set of commands using /botai.
basically there is a set of built-in bot instructions, You use them to make an "ai" by typing /botai add this adds the instruction to a list that the bot will do in order. you may need to add the reset instruction at the end of the list so the bot will repeat the action.
if you would like more complex instructions than the built in one's I would look to Venk's mobai plugin.
https://github.com/ddinan/classicube-stuff/blob/master/MCGalaxy/Plugins/MobAI.cs