Beispiel #1
0
def sendDelayDefensiveNumberMessage(game):
	recpt = game['waitingOn']
	messageToSend = "{}\n\nReply with a number between **1** and **{}**, inclusive".format(getCurrentPlayString(game), globals.maxRange)
	reddit.sendMessage(game[recpt]['coaches'],"{} vs {}".format(game['away']['name'], game['home']['name']),embedTableInMessage(messageToSend, {'action': 'play'}))
	messageResult =  reddit.getRecentSentMessage()
	game['waitingId'] = messageResult.fullname
	log.debug('Just sent the defensive message to {} after their delay of game'.format(game[recpt]['coaches']))
Beispiel #2
0
def sendDefensiveNumberMessage(game, mess=None, recpt=None):
    defenseHomeAway = reverseHomeAway(game['status']['possession'])
    log.debug("Sending get defense number message to {}".format(
        getCoachString(game, defenseHomeAway)))
    if mess is not None:
        reddit.sendMessage(game[game['waitingOn']]['coaches'][0], 'Tip result',
                           embedTableInMessage(mess, {'action': 'play'}))
    else:
        if not game['status']['free']:
            messageToSend = "{}\n\nReply with a number between **1** and **{}**, inclusive \
			or you can send foul for an intentional foul. There is currently {} \
			left in the {} half".format(getCurrentPlayString(game), globals.maxRange,
                               renderTime(game['status']['clock']),
                               getNthWord(game['status']['half']))
        else:
            messageToSend = "{}\n\nReply with a number between **1** and **{}**, inclusive".format(
                getCurrentPlayString(game), globals.maxRange)
        reddit.sendMessage(
            game[defenseHomeAway]['coaches'],
            "{} vs {}".format(game['away']['name'], game['home']['name']),
            embedTableInMessage(messageToSend, {'action': 'play'}))

    messageResult = reddit.getRecentSentMessage()
    log.debug('messageResult is {}'.format(messageResult))
    game['waitingId'] = messageResult.fullname
    log.debug("Defensive number sent, now waiting on: {}".format(
        game['waitingId']))
Beispiel #3
0
def sendTipNumberMessages(game, coaches):
	reddit.sendMessage(coaches,
			   'Tip Number',
			   embedTableInMessage("\n\nReply with a number between \
						**1** and **{0}**, inclusive.".format(globals.maxRange)
					       , {'action': 'tip'}))
	messageResult = reddit.getRecentSentMessage()
	game['waitingId'] = messageResult.fullname
	log.debug("Tip number sent, now waiting on: {}".format(game['waitingId']))
Beispiel #4
0
def sendDefensiveNumberMessage(game):
    defenseHomeAway = reverseHomeAway(game['status']['possession'])
    log.debug("Sending get defence number to {}".format(
        getCoachString(game, defenseHomeAway)))
    reddit.sendMessage(
        game[defenseHomeAway]['coaches'],
        "{} vs {}".format(game['away']['name'], game['home']['name']),
        embedTableInMessage(
            "{}\n\nReply with a number between **1** and **1500**, inclusive.".
            format(getCurrentPlayString(game)), {'action': 'play'}))
    messageResult = reddit.getRecentSentMessage()
    game['waitingId'] = messageResult.fullname
    log.debug("Defensive number sent, now waiting on: {}".format(
        game['waitingId']))
Beispiel #5
0
def sendPlayResultMessage(isHome, game, message):
    reddit.sendMessage(
        game[('home' if isHome == 'home' else 'away')]['coaches'],
        'Result of Play', message)
    return reddit.getRecentSentMessage().id
Beispiel #6
0
def sendGameMessage(isHome, game, message, dataTable):
    reddit.sendMessage(
        game[('home' if isHome else 'away')]['coaches'],
        "{} vs {}".format(game['home']['name'], game['away']['name']),
        embedTableInMessage(message, dataTable))
    return reddit.getRecentSentMessage().id
Beispiel #7
0
def sendGameMessage(isHome, game, message, dataTable):
    reddit.sendMessage(
        game.team(isHome).coaches, "{} vs {}".format(game.home.name,
                                                     game.away.name),
        embedTableInMessage(message, dataTable))
    return reddit.getRecentSentMessage().id