move bot code into its own module