Project - Python Server Bot

I designed a bot that allowed for my team to use commands using hipchat for interaction with the virtual private server where our game was hosted.

Some sample code shown below:

from subprocess import call,Popen,PIPE
import git
from will.plugin import WillPlugin
from will.decorators import respond_to, periodic, hear, randomly, route, rendered_template, require_settings


class GamePlugin(WillPlugin):

    @respond_to("start game")
    def game(self, message):
    	"""start game: Start game server!"""
	#g = git.cmd.Git("/root/evolution")
	#g.reset("master",hard=True)
	#g.pull()

	def get_exitcode3(cmd):
		"""
		Execute the external command and get its exitcode, stdout and stderr.
		"""
		proc = Popen(cmd, stdout=PIPE, stderr=PIPE,shell=True)
		out, err = proc.communicate()
		exitcode = proc.returncode
		#
		return exitcode, out, err

	cmd = "bash /root/evobot/checkgame.sh"  # arbitrary external command, e.g. "python mytest.py"
	exitcode, out, err = get_exitcode3(cmd)
	self.reply(message, out)