channel = sys.argv[sys.argv.index('-c') + 1] except: print("Error with channel (-c) argument") if '-p' in sys.argv: try: port = sys.argv[sys.argv.index('-p') + 1] except: print("Error with port (-p) argument") if '-n' in sys.argv: try: nickname = sys.argv[sys.argv.index('-n') + 1] except: print("Error with nickname (-n) argument") if '-s' in sys.argv: try: server = sys.argv[sys.argv.index('-s') + 1] except: print("Error with server (-s) argument") game = Game() irc_connector = IrcConnector(server, port, channel, nickname) irc_connector.on_message_received = game.call_command irc_connector.on_private_message_received = game.call_command game.output_channel = irc_connector.send_message game.private_output_channel = irc_connector.send_private_message irc_connector.connect()
__author__ = '*****@*****.**' from monopoly.Game import Game from monopoly.IrcConnector import IrcConnector from monopoly.IrcStub import IrcStub server = "127.0.0.1" port = 7777 nickname = "monopoprout" #irc = IrcConnector() irc = IrcStub() game = Game() game.output_channel = irc.send_message game.private_output_channel = irc.send_private_message irc.connect(server, port, nickname)
def game(): clear_messages_received() game = Game() game.output_channel = mock_output_channel game.private_output_channel = mock_private_output_channel return game