コード例 #1
0
ファイル: start.py プロジェクト: MAkzent/Betminion1.0
def start():
    db = Database()
    channel = globals.CURRENT_CHANNEL
    bets = db.are_bets(channel)[0]
    if not bets:
        chan = "#" + channel
        irc = globals.irc
        
        db.set_bets(channel, 1)
        date = datetime.strftime(datetime.utcnow(), "%Y %m %d %H %M %S")
        db.set_bets_started(channel, date)
        
        msg = "Bets are open! Type !win or !lose with the amount of points you want to bet, example: !win 200"
        irc.send_message(chan, msg)
        return "You have opened the bets"
        
    else:
        return "First, resolve current bets"
コード例 #2
0
ファイル: start.py プロジェクト: MAkzent/Betminion1.0
def start():
    db = Database()
    channel = globals.CURRENT_CHANNEL
    bets = db.are_bets(channel)[0]
    if not bets:
        chan = "#" + channel
        irc = globals.irc

        db.set_bets(channel, 1)
        date = datetime.strftime(datetime.utcnow(), "%Y %m %d %H %M %S")
        db.set_bets_started(channel, date)

        msg = "Bets are open! Type !win or !lose with the amount of points you want to bet, example: !win 200"
        irc.send_message(chan, msg)
        return "You have opened the bets"

    else:
        return "First, resolve current bets"
コード例 #3
0
ファイル: outcome.py プロジェクト: MAkzent/Betminion1.0
def outcome(args):
    result = args[0]

    if result != "win" and result != "lose":
        return "Sorry, but you didn't specified the outcome. You should write !outcome win/lose"

    else:
        db = Database()
        channel = globals.CURRENT_CHANNEL
        bets = db.are_bets(channel)[0]
        if not bets:
            bts = Bets()
            bts.distribute_profit(result)
            db.set_last_result(channel, result)
            date = datetime.strftime(datetime.utcnow(), "%Y %m %d %H %M %S")
            #So the outcome won't be used twice for same bets
            db.set_bets_started(channel, date)
        else:
            return "The bets are still going on!"

    return "You have distributed the profit"