async def pot(ctx, amount): allowance = not_allowed(ctx, pot.name, bot) if allowance[0]: await bot.say(f'acess denied,channel for ={pot.name} is {allowance[1]}' ) return if amount == 't': jackpot = game.jackpot(0, ctx) jackpot.time_delta() await bot.say(f'{round(40-jackpot.delta)} seconds left') return lev = level.Level(ctx) check = utils.Check(ctx) embed = check.embed balance = check.balance() amount = utils.Check.amount(amount, balance) if utils.Check.broke(amount, balance): await check.display(amount, balance, bot) return else: jackpot = game.jackpot(amount, ctx) jackpot.join(amount, ctx.message.channel.id) log = statistics.bet_log(ctx) log.update_count() chances = jackpot.chances() if jackpot.time_delta(): winner = jackpot.get_winner() jackpot.update(winner, ctx) chance = [i for i in chances if winner[0][0] in i] await bot.say('AND THE WINNER IS.....') for i in range(0, 5): await bot.say('*drum rolls*') await asyncio.sleep(1) await bot.say(f'@{winner[0][0]} won with {chance[0][0]*100}%') lev.get_level() lev.evaluate(amount) else: vals = jackpot.get_stake_and_size() embed.add_field(name='POT SIZE', value=f'{vals[0]}/4') embed.add_field(name='POT STAKE', value=f'{vals[1]}') display = '' for i in chances: display += f'User: {i[1]} \nChance: {i[0]*100}% \n' embed.add_field(name='CHANCES', value=display + '\n') await bot.say(embed=embed) lev.get_level() lev.evaluate(amount)
async def Game(amount, bot, ctx, func): n = utils.Check(ctx) balance = n.balance() amount = utils.Check.amount(amount, balance) if utils.Check.broke(amount, balance): await n.display(amount, balance, bot) return else: await func(amount, balance) log = statistics.bet_log(ctx) log.update_count() lev = level.Level(ctx) lev.get_level() lev.evaluate(amount)
async def slot(ctx, amount): allowance = not_allowed(ctx, slot.name, bot) if allowance[0]: await bot.say( f'acess denied,channel for ={slot.name} is {allowance[1]}') return db = utils.db(ctx) check = utils.Check(ctx) lev = level.Level(ctx) balance = check.balance() amount = utils.Check.amount(amount, balance) if utils.Check.broke(amount, balance): await check.display(amount, balance, bot) return else: Slot = game.slot(balance, amount, ctx) grid = Slot.generate() win = Slot.check_win(grid) if not win: balance = Slot.new_balance(win) check.embed.add_field( name=f'{db.userName} YOU LOST now you have {balance} left', value=Slot.display(grid)) else: balance = Slot.new_balance(win) check.embed.add_field( name=f'{db.userName} YOU WON now you got {balance}', value=Slot.display(grid)) lev.get_level() lev.evaluate(amount) db.updateBalance(balance) await bot.say(embed=check.embed) log = statistics.bet_log(ctx) log.update_count()
async def dice(ctx, range, amount): allowance = not_allowed(ctx, dice.name, bot) if allowance[0]: await bot.say( f'acess denied,channel for ={dice.name} is {allowance[1]}') return db = utils.db(ctx) check = utils.Check(ctx) lev = level.Level(ctx) balance = check.balance() amount = utils.Check.amount(amount, balance) if '-' not in range: await bot.say(f'add a - to your range like this -> 30-80') return if utils.Check.broke(amount, balance): await check.display(amount, balance, bot) return else: Dice = game.dice(range, amount, balance, ctx) Dice.update_balance() if Dice.win(): check.embed.add_field( name=f'{ctx.message.author} you won it rolled {Dice.choice}!!!', value=f'New balance:{Dice.balance}') else: check.embed.add_field( name= f'{ctx.message.author} you LOST it rolled {Dice.choice}!!!', value=f'New balance:{Dice.balance}') log = statistics.bet_log(ctx) log.update_count() await bot.say(embed=check.embed)
async def gamble(ctx, amount): allowance = not_allowed(ctx, gamble.name, bot) if allowance[0]: await bot.say( f'acess denied, channel for ={gamble.name} is {allowance[1]}') return n = utils.Check(ctx) db = utils.db(ctx) lev = level.Level(ctx) balance = n.balance() amount = utils.Check.amount(amount, balance) if utils.Check.broke(amount, balance): await n.display(amount, balance, bot) return else: rn = random.randint(0, 1) if rn == 0: balance += amount n.embed.add_field(name=f'{n.info.userName} YOU WON!!!', value=f'New balance: {balance}') if rn == 1: balance -= amount n.embed.add_field(name=f"{n.info.userName} YOU LOST", value=f'New balance: {balance}') lev.get_level() lev.evaluate(amount) await bot.say(embed=n.embed) db.updateBalance(balance) log = statistics.bet_log(ctx) log.update_count()
async def roll(ctx, amount, choice): allowance = not_allowed(ctx, roll.name, bot) if allowance[0]: await bot.say( f'acess denied,channel for ={roll.name} is {allowance[1]}') return p = ['r', 'b', 'g'] if choice != 'r' and choice != 'b' and choice != 'g': await bot.say( f'INVALID CHOICE,type {p[0]} for red,{p[1]} for black and {p[2]} for green' ) return n = utils.Check(ctx) db = utils.db(ctx) lev = level.Level(ctx) balance = n.balance() amount = utils.Check.amount(amount, balance) emoji = {'r': ':red_circle:', 'b': ':black_circle:', 'g': ':green_apple:'} rn = random.randint(0, 16) display = '' win = '' if rn == 16: win = 'g' elif rn % 2 == 0: win = 'r' elif rn % 2 != 0: win = 'b' for i in range(0, 9): if rn == 16: display += emoji['g'] rn = 0 elif rn % 2 == 0: display += emoji['r'] rn += 1 else: display += emoji['b'] rn += 1 cursor = ':point_up:' if utils.Check.broke(amount, balance): await n.display(amount, balance, bot) return else: if win == choice: if choice == 'g': balance += amount * 14 n.embed.add_field( name=display + '\n' + cursor + '\n' + f'{db.userName} you won,ON GREEN!!! balance->' + str(balance), value='--------------------') else: balance += amount n.embed.add_field(name=display + '\n' + cursor + '\n' + f'{db.userName} you won,new balance is ->' + str(balance), value='------------------') else: balance -= amount n.embed.add_field(name=display + '\n' + cursor + '\n' + f'{db.userName} you lost,new balance is ->' + str(balance), value='----------------------') lev.get_level() lev.evaluate(amount) db.updateBalance(balance) await bot.say(embed=n.embed) log = statistics.bet_log(ctx) log.update_count()
async def on_server_join(server): lg = statistics.bet_log(server=server) lg.add_server()