async def worms(self, ctx, user: discord.Member = None): '''Shows your worm balance of yourself or another user''' if user: balance = db.get_user_balance(user.id) name = user.mention else: balance = db.get_user_balance(ctx.author.id) name = ctx.author.mention await ctx.send("{} has {:,} worms".format(name, round(balance, 2)))
async def give(self, ctx, who, value): "Share some love by giving it to others <3" message = ctx.message their_id = message.mentions[0].id value = int(value) if ctx.author.id == message.mentions[0].id: await ctx.send("You cant send worms to yourself dummy") return else: balance = db.get_user_balance(message.author.id) if int(value) < 10: await ctx.send("You need to transfer a minimum of 10 worms.") return elif balance < value: await ctx.send("You dont have {} worms, you only have {} worms" ).format(value, balance) return # not enough money else: #give_gif db.modify_user_balance(ctx.author.id, value * -1) db.modify_user_balance(their_id, value) await ctx.send(love_gif_list[random.randint( 0, len(love_gif_list) - 1)]) await ctx.send("{} has sent {} worms to {}".format( message.author.mention, value, message.mentions[0].mention)) return
async def qp(self, ctx, number_of_tickets=1): """ Quickpick tickets, enter a number to choose how many you want! """ lottory_id = db.get_current_lottory() user_balance = db.get_user_balance(ctx.author.id) total_cost = ticket_cost * number_of_tickets if user_balance < total_cost: await ctx.send("That would cost {:,}, your balance is {:,}. Broke ass bitch".format(total_cost, user_balance)) return else: async with ctx.typing(): ticket_list = quickpick(number_of_tickets) progressive_add = number_of_tickets * ticket_cost * .1 db.add_ticket_to_user(ticket_list, lottory_id, ctx.author.id) new_balance = db.modify_user_balance(ctx.author.id, -1 * total_cost) db.modify_lottory_jackpot_prog(lottory_id, progressive_add) new_progressive = db.get_lottory_jackpot_prog(lottory_id) ticket_obj_list = list(map(lambda x: Ticket(x), ticket_list)) #Convert list of tickets to Ticket objects if len(ticket_list) <= 5: output_line_list = [] for ticket in ticket_list: output_line_list.append('Quickpick ticket {} purchased by {}, good luck!'.format(Ticket(ticket), ctx.author.name)) await ctx.send("\n".join(output_line_list)) if number_of_tickets > 500: await ctx.author.send("You bought {} tickets. I'm not going to send you all of them.".format(number_of_tickets)) else: for n in range(0, len(ticket_list), 50): await ctx.author.send("Lottory {} Quickpick tickets {}".format(lottory_id, ticket_list[n:n+50])) await ctx.send("{} spent {:,} on {:,} tickets, new balance is {:,}. The jackpot is now {:,}".format(ctx.author.name, total_cost, number_of_tickets, round(new_balance,2), payout_table[True][4]+new_progressive))
async def battlebet(self, ctx, amount: int, user_string: str): if self.cock_battle is None: await ctx.send("There is not active battle u w***e") return if not self.cock_battle.accepted: await ctx.send("The battle has not been accepted by {} yet".format(self.cock_battle.challenged.name)) return try: player_to_bet_on = match_string_to_user(self.bot, ctx, user_string) except: await ctx.send("No user found matching {}".format(user_string)) return if player_to_bet_on in [self.cock_battle.challenger, self.cock_battle.challenged]: user_id = ctx.author.id balance = db.get_user_balance(user_id) if amount > balance: await ctx.send("That would cost {}, you only have {} you chode".format(amount, balance)) return else: new_balance = db.modify_user_balance(user_id, -1 * amount) if player_to_bet_on == self.cock_battle.challenger: odds = 1/self.cock_battle.odds else: odds = self.cock_battle.odds amount_to_win = (amount * odds) + amount self.cock_battle.add_wager(ctx.author, player_to_bet_on, amount_to_win) await ctx.send("{} bet {:,} to win {:,} on {}s c**k, good luck!".format(ctx.author.name, amount, round(amount_to_win,2), player_to_bet_on)) else: await ctx.send("{} is not participating in the current battle you mook".format(player_to_bet_on)) return
async def balance(self, ctx): '''Shows your balance and number of tickets in current drawing''' balance = db.get_user_balance(ctx.author.id) lottory_id = db.get_current_lottory() ticket_list = db.get_user_tickets(ctx.author.id, lottory_id) await ctx.send( "{} balance is {:,}. You have {} tickets in the next drawing". format(ctx.author.name, round(balance, 2), len(ticket_list)))
async def roulette(self, ctx, amount: int, *spaces): user_id = ctx.author.id balance = db.get_user_balance(user_id) #Validate user balance is sufficient and space is valid try: num_bets = len(spaces) total_amount = amount * num_bets except: total_amount = amount num_bets = 1 spaces = [spaces] if total_amount > balance: await ctx.send( "That would cost {} but you only have {} u broke ass bitch". format(total_amount, balance)) return for space in spaces: if str(space) not in outside_dict: try: if int(space) not in range(1, 37): await ctx.send( "{} is not a valid number, please choose 1-36". format(space)) return except: await ctx.send( "{} is not a valid space u mook".format(space)) return #Initiate new game if no current game, add wager to current game otherwise. db.modify_user_balance(user_id, -1 * total_amount) if self.game is not None: await self.game.add_wagers(user_id, amount, spaces) output_brackets = ["{}"] * num_bets output_string = "{} bet {:,} on {}".format( ctx.author, amount, ', '.join(output_brackets)) await ctx.send(output_string.format(*spaces)) else: output_brackets = ["{}"] * num_bets output_string = "{} bet {:,} on {}".format( ctx.author, amount, ', '.join(output_brackets)) await ctx.send(output_string.format(*spaces)) self.game = RouletteGame(self.bot, ctx) await self.game.add_wagers(user_id, amount, spaces) await ctx.send( "A new game of Not Rigged Roulette has started! User $roulette <amount> <space> to raise your bets!" ) await ctx.send("31s remaining!") async with ctx.typing(): await asyncio.sleep(21) await ctx.send("10 seconds remaining, RAISE UR BETS!") async with ctx.typing(): await asyncio.sleep(10) await self.game.resolve() self.game = None
async def withdraw(self,ctx,amount:int): '''Withdraws from Lotto balance, to be deposited manually to Ubeleivaboat balance''' balance = db.get_user_balance(ctx.author.id) if amount <= 0: ctx.send("You're broke u bitch") return if amount > balance: amount = balance new_balance = db.modify_user_balance(ctx.author.id, -1 * amount) await ctx.send("{} withdrew {:,}. Your new balance is {:,}. An admin will credit your RiggBott acount soon!".format(ctx.author.name, amount, new_balance)) admin = await self.bot.get_user_info(154415714411741185) await admin.send("Please run --> !add-money cash {} {} <--".format(ctx.author.name, amount))
async def buy_ticket(self, ctx, first: int, second: int, third: int, fourth: int, mega: int): """ Purchase a lottory ticket, enter all 5 numbers seperated by spaces. Valid tickets must have first 4 numbes between 1-23, and last number between 1-11. Use !bt qp <number> to purchase a number of quickpick tickets. Good luck! """ lottory_id = db.get_current_lottory() user_balance = db.get_user_balance(ctx.author.id) ticket = [first, second, third, fourth, mega] ticket_print = Ticket(ticket) if user_balance < ticket_cost: await ctx.send( "That would cost {:,}, your balance is {:,}. Broke ass bitch". format(ticket_cost, user_balance)) return #Validate ticket entry for number in ticket[:4]: if number not in numbers: await ctx.send( "{} is not a valid ticket, first 4 numbers must be between {}-{}}" .format(ticket, numbers[0], numbers[-1])) return if ticket[4] not in range(1, 12): await ctx.send( "{} is not a valid ticket, megaball must be between 1-11". format(ticket)) return for i in range(3): if ticket[i] in ticket[:i]: await ctx.send( "{} is not a valid ticket, first four numbers must be unique" .format(ticket_print)) return if ticket[i] in ticket[i + 1:4]: await ctx.send( "{} is not a valid ticket, first four numbers must be unique" .format(ticket_print)) return progressive_add = ticket_cost * .1 db.add_ticket_to_user([ticket], lottory_id, ctx.author.id) new_balance = db.modify_user_balance(ctx.author.id, -1 * ticket_cost) db.modify_lottory_jackpot_prog(lottory_id, progressive_add) new_progressive = db.get_lottory_jackpot_prog( lottory_id) + payout_table[True][4] await ctx.send( "{} purchased ticket {}, your balance is now {:,}. The progressive jackpot is now {:,}." .format(ctx.author.name, Ticket(ticket), new_balance, new_progressive))
async def prepare_cock(self, ctx): user_id = ctx.author.id balance = db.get_user_balance(user_id) cock_status = db.get_cock_status(user_id) cock_power = get_cock_power(cock_status) if cock_status != -1: await ctx.send("Your c**k is already prepared for battle, currently at {:.1f}% hardness".format(cock_power * 100)) return if balance < self.cock_price: await ctx.send("Your c**k is too mangled and bruised to battle, please wait until you can afford 100 for a c**k doctor before battling again.") return else: db.modify_user_balance(user_id, -1 * self.cock_price) db.set_cock_status(user_id, 0) await ctx.send("Your c**k is ready for battle, you tip your fluffer {} for their service".format(self.cock_price))
async def prepare_worm(self, ctx): '''Buy a fight worm''' user_id = ctx.author.id balance = db.get_user_balance(user_id) cock_status = db.get_cock_status(user_id) cock_power = get_cock_power(cock_status) if cock_status != -1: await ctx.send("Your battle worm is already prepared for battle, currently at {:.1f}% toughness".format(cock_power * 100)) return if balance < self.cock_price: await ctx.send("You don't have any worms!") return else: db.modify_user_balance(user_id, -1 * self.cock_price) db.set_cock_status(user_id, 0) await ctx.send("You exchanged {} worms for a rookie battle worm! Win fights and battles to level him up!".format(self.cock_price))
async def wormfight(self, ctx, amount:int): '''Test your worm in a fight to the death, each win increases your worms toughness and odds of winning! Buy a fightworm with !bw and then bet on the outcome of a fight with !wf <amount>''' user_id = ctx.author.id balance = db.get_user_balance(user_id) cock_status = db.get_cock_status(user_id) if self.cock_battle: if ctx.author == self.cock_battle.challenger or ctx.author == self.cock_battle.challenged: await ctx.send("You cannot participate in wormfights while your worm is preparing for battle") return if cock_status == -1: await ctx.send("Your worm is not ready for battle, prepare your worm with !prepare_worm first.") return if amount > balance: await ctx.send("That would cost {}, you only have {} :(".format(amount, balance)) return else: new_balance = db.modify_user_balance(user_id, -1 * amount) result = random.random() cock_power = get_cock_power(cock_status) if result < cock_power: amount_won = amount * 2 new_cock_status = cock_status + 1 new_balance = db.modify_user_balance(user_id, amount_won) db.set_cock_status(user_id, new_cock_status) result_msg = "Your worm made you {:,} worms richer".format(amount) hardness_msg= "Now at {:.1f}% toughness".format(get_cock_power(new_cock_status) * 100) embed_dict = {'colour':discord.Colour(0x00e553), 'author_name':ctx.author.name, 'fields': {1:{'name': result_msg, 'value': hardness_msg}}} await ctx.send(embed=build_embed(embed_dict)) else: db.set_cock_status(user_id, -1) result_msg = "Your worm got smoosh :(" embed_dict = {'colour':discord.Colour(0xe10531), 'author_name':ctx.author.name, 'fields': {1:{'name': 'Ouch', 'value': result_msg}}} await ctx.send(embed=build_embed(embed_dict))
async def cockfight(self, ctx, amount:int): user_id = ctx.author.id balance = db.get_user_balance(user_id) cock_status = db.get_cock_status(user_id) if self.cock_battle: if ctx.author == self.cock_battle.challenger or ctx.author == self.cock_battle.challenged: await ctx.send("You cannot participate in cockfights while your c**k is preparing for battle") return if cock_status == -1: await ctx.send("Your c**k is not ready for battle, prepare your lil c**k with $prepare_cock first.") return if amount > balance: await ctx.send("That would cost {}, you only have {} you chode".format(amount, balance)) return else: new_balance = db.modify_user_balance(user_id, -1 * amount) result = random.random() cock_power = get_cock_power(cock_status) if result < cock_power: amount_won = amount * 2 new_cock_status = cock_status + 1 new_balance = db.modify_user_balance(user_id, amount_won) db.set_cock_status(user_id, new_cock_status) result_msg = "Your lil c**k made you {:,} richer".format(amount) hardness_msg= "Now at {:.1f}% hardness <:peen:456499857759404035>".format(get_cock_power(new_cock_status) * 100) embed_dict = {'colour':discord.Colour(0x00e553), 'author_name':ctx.author.name, 'fields': {1:{'name': result_msg, 'value': hardness_msg}}} await ctx.send(embed=build_embed(embed_dict)) else: db.set_cock_status(user_id, -1) result_msg = "Your c**k snapped in half <:sad:455866480454533120>" embed_dict = {'colour':discord.Colour(0xe10531), 'author_name':ctx.author.name, 'fields': {1:{'name': 'Ouch', 'value': result_msg}}} await ctx.send(embed=build_embed(embed_dict))
async def leaderboard(self, ctx): '''Displays user balance, c**k status and number of tickets in current drawing''' user_list = db.get_user() balances = [] for user_id in user_list: user = await self.bot.get_user_info(user_id[0]) if not user.bot: balance = db.get_user_balance(user.id) cock_status = db.get_cock_status(user.id) balances.append((user.name, cock_status, balance)) sorted_balances = sorted(balances, key=lambda balances: balances[2], reverse=True) rank = 1 output = [] for user_name, cock_status, user_balance in sorted_balances: cock_power = "{:.1f}% <:peen:456499857759404035>".format(( get_cock_power(cock_status) * 100)) if cock_status is not -1 else "<:sad:455866480454533120>" output.append("{}: **{}** - {:,} - {}".format( rank, user_name, round(user_balance), cock_power)) rank += 1 embed_dict = { 'colour': discord.Colour(0x034cc1), 'author_name': "Lotto-Bot", 'fields': { 1: { 'name': "Leaderboard", 'value': "\n".join(output) } } } await ctx.send(embed=build_embed(embed_dict))
async def leaderboard(self, ctx): '''Displays worm balance leaderboard''' user_list = db.get_user() balances = [] for user in user_list: user_id = user[0] balance = db.get_user_balance(user_id) cock_status = db.get_cock_status(user_id) balances.append((user_id, cock_status, balance)) sorted_balances = sorted(balances, key=lambda balances: balances[2], reverse=True) top_sorted_balances = sorted_balances[0:10] rank = 1 output = [] for user_id, cock_status, user_balance in top_sorted_balances: user = await self.bot.fetch_user(user_id) cock_power = "{:.1f}% <:Worm:752975370231218178>".format( (get_cock_power(cock_status) * 100)) if cock_status is not -1 else ":x:" output.append("{}: **{}** - {:,} - {}".format( rank, user.name, round(user_balance), cock_power)) rank += 1 embed_dict = { 'colour': discord.Colour(0x034cc1), 'author_name': "Worm Hall of Fame", 'fields': { 1: { 'name': "Leaderboard", 'value': "\n".join(output) } } } await ctx.send(embed=build_embed(embed_dict))
async def update_worm_roles(self): await asyncio.sleep(15) guild = self.get_guild(guild_id) role_object_dict = {} worm_god = {"user": None, "score": 0} for key, role_name in worm_roles_dict.items(): role_object = discord.utils.get(guild.roles, name=role_name) role_object_dict[key] = role_object while True: user_list = db.get_user() balances = [] update_god = False users = db.get_user() for user_id_tuple in user_list: user_id = user_id_tuple[0] balance = db.get_user_balance(user_id) balances.append((user_id, balance)) options = [] for threshold in role_object_dict: if balance <= threshold: options.append(threshold) min_threshold = min(options) role_to_assign = role_object_dict[min_threshold] try: member = guild.get_member(user_id) current_roles = member.roles if role_to_assign not in member.roles: for role in current_roles: if role in role_object_dict.values(): await member.remove_roles(role) print("Removing {} from {}".format( role, member.name)) print("Assigning {} to {}".format( role_to_assign, member.name)) await member.add_roles(role_to_assign) except: print("Failed to assign role {} for user {}".format( role_to_assign, user_id)) god_role_object = discord.utils.get(guild.roles, id=worm_god_id) sorted_balances = sorted(balances, key=lambda balances: balances[1], reverse=True) new_worm_god_user_id = sorted_balances[0][0] new_worm_god_balance = sorted_balances[0][1] if new_worm_god_balance != worm_god["score"]: worm_god["score"] = new_worm_god_balance new_role_name = "Worm God ({} Worms)".format(worm_god["score"]) await god_role_object.edit(name=new_role_name) if new_worm_god_user_id != worm_god["user"]: worm_god["user"] = new_worm_god_user_id current_god = god_role_object.members new_god = guild.get_member(worm_god["user"]) if current_god is not None: for god in current_god: if god.id != worm_god["user"]: await god.remove_roles(god_role_object) message = "{} has been dethroned, All hail the new Worm God {} with {} worms!".format( god.mention, new_god.mention, worm_god["score"]) channel = guild.get_channel(default_channel) await channel.send(message) await new_god.add_roles(god_role_object) await asyncio.sleep(60)
async def wormbattle(self, ctx, user, purse=0): '''Challenge another users worm to a battle to the death, anyone can bet on the outcome''' if purse > db.get_user_balance(ctx.author.id): ctx.send("You don't have {} worms!".format(purse)) if self.cock_battle is not None: await ctx.send("Only one worm battle at a time, wait for {} and {} to finish their battle!".format(self.cock_battle.challenger.name, self.cock_battle.challenged.name)) return if db.get_cock_status(ctx.author.id) == -1: await ctx.send("You don't have a battleworm") return try: challenged_user = ctx.message.mentions[0] except: await ctx.send("You need to mention a user to challenge them!") if db.get_cock_status(challenged_user.id) == -1: await ctx.send("{} doesn't have a battleworm!".format(challenged_user.name)) return if challenged_user == ctx.author: await ctx.send("Try punching yourself in the face instead?") return self.cock_battle = CockBattle(self.bot, ctx, ctx.author, challenged_user, purse=purse) embed_dict = {'colour':discord.Colour(0xffa500), 'author_name':"Worm Battle Challenge!", 'fields': {1:{'name': self.cock_battle.challenger.name, 'value': "{:.1f}% <:Worm:752975370231218178> @{:.2f}:1 odds".format(get_cock_power(self.cock_battle.challenger_cock_status)*100, 1/self.cock_battle.odds), 'inline': True}, 2:{'name': "VS", 'value': '-', 'inline': True}, 3:{'name': self.cock_battle.challenged.name, 'value': "{:.1f}% <:Worm:752975370231218178> @{:.2f}:1 odds".format(get_cock_power(self.cock_battle.challenged_cock_status)*100, self.cock_battle.odds), 'inline': True}, 4:{'name': "```{} has 60s to accept the challenge!```".format(self.cock_battle.challenged.name), 'value': 'Use <!challenge_accepted> to accept!', 'inline': False} } } battle_message = await ctx.send(embed = build_embed(embed_dict)) wait_cycles = 0 while self.cock_battle.accepted == False and wait_cycles < 60: await asyncio.sleep(time_to_accept_battle//60) wait_cycles += 1 if wait_cycles in [50, 30, 15]: embed_dict['fields'][4] = {'name': "```{} has {}s to accept the challenge!```".format(self.cock_battle.challenged.name, (time_to_accept_battle/60) * (60 - wait_cycles)), 'value': 'Use <!challenge_accepted> to accept!', 'inline': False} await battle_message.edit(embed=build_embed(embed_dict)) if self.cock_battle.accepted: embed_dict['colour'] = discord.Colour(0x00e553) embed_dict['author_name'] = "Worm Battle Accepted!" embed_dict['fields'][4] = {'name': "```60s until the battle!```", 'value': 'Type !bb <amount> <user> to place your bets!', 'inline': False} await battle_message.edit(embed=build_embed(embed_dict)) wait_cycles = 0 while wait_cycles < 12: await asyncio.sleep(time_to_battle//12) wait_cycles += 1 if wait_cycles in [10, 6, 3]: embed_dict['fields'][4] = {'name': "```{}s until the battle!```".format((time_to_battle/12) * (12 - wait_cycles)), 'value': 'Type !bb <amount> <user> to place your bets!', 'inline': False} await battle_message.edit(embed=build_embed(embed_dict)) embed_dict['author_name'] = "Battle Results Below!" embed_dict['colour'] = discord.Colour(0xd3d3d3) embed_dict['fields'][4] = {'name': "```Battle!```", 'value': 'Results below!', 'inline': False} await battle_message.edit(embed=build_embed(embed_dict)) rounds, winner, loser = self.cock_battle.resolve_battle() db.modify_user_balance(winner.id, self.cock_battle.purse) db.set_cock_status(loser.id, -1) if loser == self.cock_battle.challenger: donated_cock_power = ((self.cock_battle.challenger_cock_status) / 2) + 1 embed_dict['fields'][3]['name'] = "{}:white_check_mark:".format(self.cock_battle.challenged.name) db.set_cock_status(winner.id, self.cock_battle.challenged_cock_status + donated_cock_power) else: donated_cock_power = ((self.cock_battle.challenged_cock_status) / 2) + 1 embed_dict['fields'][1]['name'] = "{}:white_check_mark:".format(self.cock_battle.challenger.name) db.set_cock_status(winner.id, self.cock_battle.challenger_cock_status + donated_cock_power) results = [] for user, amount_won in self.cock_battle.wagers[winner].items(): new_user_balance = db.modify_user_balance(user.id, amount_won) results.append("{} won {:,} worms, new balance is {:,}".format(user, round(amount_won,2), round(new_user_balance,2))) embed_dict['author_name'] = "{}s battleworm won the battle!".format(winner.name) embed_dict['colour'] = discord.Colour(0x0077be) embed_dict['fields'][4] = {'name': "{} battleworm was victorious in round {} and wins {} from the purse!".format(winner.name, rounds, self.cock_battle.purse), 'value': "{}\% is added to his battleworms toughness".format(donated_cock_power), 'inline': False} await ctx.send(embed=build_embed(embed_dict)) self.cock_battle = None await ctx.send("\n".join(results)) else: embed_dict['author_name'] = "Worm Battle Aborted!" embed_dict['colour'] = discord.Colour(0xe10531) embed_dict['fields'][4] = {'name': "```{} did not accept, the battle is cancelled!```".format(self.cock_battle.challenged.name), 'value': 'Challenge someone awake next time!', 'inline': False} await battle_message.edit(embed=build_embed(embed_dict)) self.cock_battle = None
async def roulette(self, ctx, amount: int, *spaces): '''Plays a game of worm roulette. Add bets with !roulette <amount> <space>''' user_id = ctx.author.id balance = db.get_user_balance(user_id) #Validate user balance is sufficient and space is valid try: num_bets = len(spaces) total_amount = amount * num_bets except: total_amount = amount num_bets = 1 spaces = [spaces] if total_amount > balance: await ctx.send( "That would cost {} worms but you only have {} worms".format( total_amount, balance)) return for space in spaces: if str(space) not in outside_dict: try: if int(space) not in range(1, 37): await ctx.send( "{} is not a valid number, please choose 1-36". format(space)) return except: await ctx.send( "{} is not a valid space u mook".format(space)) return #Initiate new game if no current game, add wager to current game otherwise. db.modify_user_balance(user_id, -1 * total_amount) if self.game is not None: image_url = await self.game.add_wagers(user_id, amount, spaces) new_game_string = "A new game of Worm Roulette started!" embed_dict = { 'colour': discord.Colour(0x006400), 'author_name': new_game_string, 'fields': {}, } embed_dict['fields'][0] = { 'name': 'Type !roulette <wager> <space> to bet!', 'value': '------------' } for user_id, wager_list in self.game.wager_dict.items(): user = await self.bot.fetch_user(user_id) output_string = "" embed_dict['fields'][user.id] = {'inline': True} for wager in wager_list: output_string += "Bet {:,} on {} \n".format( wager.amount, wager.space) embed_dict['fields'][user.id]['value'] = output_string embed_dict['fields'][user.id]['name'] = user.name embed_dict['s3_image_url'] = image_url await self.game.roulette_message.edit(embed=build_embed(embed_dict) ) else: output_brackets = ["{}"] * num_bets output_string = "Bet {:,} on {}".format(amount, ', '.join(output_brackets)) new_game_string = "Worm Roulette started!" embed_dict = { 'colour': discord.Colour(0x006400), 'author_name': new_game_string, 'fields': {}, } embed_dict['fields'][0] = { 'name': 'Type !roulette <wager> <space> to bet!', 'value': '------------' } embed_dict['fields'][ctx.author.id] = { 'name': ctx.author.name, 'value': output_string.format(*spaces), 'inline': True } self.game = RouletteGame(self.bot, ctx) image_url = await self.game.add_wagers(user_id, amount, spaces) text2 = "30s remaining!" embed_dict['fields']['0'] = { 'name': 'Place your bets!', 'value': text2, 'inline': True } embed_dict['s3_image_url'] = image_url self.game.roulette_message = await ctx.send( embed=build_embed(embed_dict)) async with ctx.typing(): await asyncio.sleep(20) async with ctx.typing(): await asyncio.sleep(10) await self.game.resolve() self.game = None
async def steal(self, ctx, target, amount: int): '''Try to steal worms from another user, but be careful it may backfire! The more worms you attempt to steal, the less likely it is to succeed''' try: target = ctx.message.mentions[0] except: await ctx.send("No valid user found!") await ctx.command.reset_cooldown(ctx) return target_balance = db.get_user_balance(target.id) user_balance = db.get_user_balance(ctx.author.id) if amount < 10: await ctx.send("You have to steal at least 10 worms!") await ctx.command.reset_cooldown(ctx) return if target_balance < 100: await ctx.send( "{} is too poor to steal from, find another target!".format( target.mention)) await ctx.command.reset_cooldown(ctx) return if amount > target_balance: await ctx.send( "{} only has {} worms, so I guess you're trying to steal all of them" .format(target.mention, target_balance)) amount = target_balance base_difficulty = 10 ratio = round(amount / target_balance, 2) total_difficulty = math.ceil(base_difficulty + (10 * ratio)) result = random.randint(1, 20) await ctx.send( "Attempting to steal {}% of {} worms, you'll need to roll {} or better!" .format(ratio * 100, target.mention, total_difficulty)) gif_message = await ctx.send('https://tenor.com/ba6fL.gif') await asyncio.sleep(5) if result >= total_difficulty: db.modify_user_balance(target.id, -1 * amount) db.modify_user_balance(ctx.author.id, amount) await ctx.send( "{} rolled a {} and successfully stole {} worms from {}". format(ctx.author.mention, result, amount, target.mention)) await gif_message.edit(content="https://tenor.com/bmxN5.gif") ctx.command.reset_cooldown(ctx) elif 1 < result < 6: backfire_percent = random.uniform(.1, .5) backfire_amount = round(user_balance * backfire_percent) await ctx.send( "{} rolled a {}, got caught by the police and were forced to pay {} {} worms instead" .format(ctx.author.mention, result, target.mention, backfire_amount)) db.modify_user_balance(target.id, backfire_amount) db.modify_user_balance(ctx.author.id, -1 * backfire_amount) await gif_message.edit(content="https://tenor.com/bia0L.gif") elif result == 1: await ctx.send( "{} rolled a {}, now all their worms are belong to {}".format( ctx.author.mention, result, target.mention)) db.modify_user_balance(ctx.author.id, -1 * user_balance) db.modify_user_balance(target.id, user_balance) await gif_message.edit(content="https://tenor.com/btHVc.gif") else: await ctx.send("{} rolled a {}, nothing happened!".format( ctx.author.mention, result)) await gif_message.edit(content="https://tenor.com/6ziX.gif")
async def cockbattle(self, ctx, user_string: str, purse=0): if purse > db.get_user_balance(ctx.author.id): ctx.send( "You don't have {} to fund the purse you broke ass bitch!". format(purse)) if self.cock_battle is not None: await ctx.send( "Only one c**k battle at a time u s**t, wait for {} and {} to finish their battle!" .format(self.cock_battle.challenger.name, self.cock_battle.challenged.name)) return if db.get_cock_status(ctx.author.id) == -1: await ctx.send("You don't have a c**k") return try: challenged_user = match_string_to_user(self.bot, ctx, user_string) except: await ctx.send("No user found matching that name") if db.get_cock_status(challenged_user.id) == -1: await ctx.send("{} doesn't have a c**k!".format( challenged_user.name)) return if challenged_user == ctx.author: await ctx.send("Try punching yourself in the face instead") return self.cock_battle = CockBattle(self.bot, ctx, ctx.author, challenged_user, purse=purse) embed_dict = { 'colour': discord.Colour(0xffa500), 'author_name': "C**k Battle Challenge!", 'fields': { 1: { 'name': self.cock_battle.challenger.name, 'value': "{:.1f}% <:peen:456499857759404035> @{:.2f}:1 odds".format( get_cock_power(self.cock_battle.challenger_cock_status) * 100, 1 / self.cock_battle.odds), 'inline': True }, 2: { 'name': "VS", 'value': '-', 'inline': True }, 3: { 'name': self.cock_battle.challenged.name, 'value': "{:.1f}% <:peen:456499857759404035> @{:.2f}:1 odds".format( get_cock_power(self.cock_battle.challenged_cock_status) * 100, self.cock_battle.odds), 'inline': True }, 4: { 'name': "```{} has 60s to accept the challenge!```".format( self.cock_battle.challenged.name), 'value': 'Use <$challenge_accepted> to accept!', 'inline': False } } } battle_message = await ctx.send(embed=build_embed(embed_dict)) wait_cycles = 0 while self.cock_battle.accepted == False and wait_cycles < 60: await asyncio.sleep(time_to_accept_battle // 60) wait_cycles += 1 if wait_cycles in [50, 30, 15]: embed_dict['fields'][4] = { 'name': "```{} has {}s to accept the challenge!```".format( self.cock_battle.challenged.name, (time_to_accept_battle / 60) * (60 - wait_cycles)), 'value': 'Use <$challenge_accepted> to accept!', 'inline': False } await battle_message.edit(embed=build_embed(embed_dict)) if self.cock_battle.accepted: embed_dict['colour'] = discord.Colour(0x00e553) embed_dict['author_name'] = "C**k Battle Accepted!" embed_dict['fields'][4] = { 'name': "```60s until the battle!```", 'value': 'Use <$bb amount user> to raise your bets!', 'inline': False } await battle_message.edit(embed=build_embed(embed_dict)) wait_cycles = 0 while wait_cycles < 12: await asyncio.sleep(time_to_battle // 12) wait_cycles += 1 if wait_cycles in [10, 6, 3]: embed_dict['fields'][4] = { 'name': "```{}s until the battle!```".format( (time_to_battle / 12) * (12 - wait_cycles)), 'value': 'Use <$bb amount user> to raise your bets!', 'inline': False } await battle_message.edit(embed=build_embed(embed_dict)) embed_dict['author_name'] = "Battle Results Below!" embed_dict['colour'] = discord.Colour(0xd3d3d3) embed_dict['fields'][4] = { 'name': "```Battle!```", 'value': 'Results below!', 'inline': False } await battle_message.edit(embed=build_embed(embed_dict)) rounds, winner, loser = self.cock_battle.resolve_battle() db.modify_user_balance(winner.id, self.cock_battle.purse) db.set_cock_status(loser.id, -1) if loser == self.cock_battle.challenger: donated_cock_power = ( (self.cock_battle.challenger_cock_status) / 2) + 1 embed_dict['fields'][3][ 'name'] = "{}:white_check_mark:".format( self.cock_battle.challenged.name) db.set_cock_status( winner.id, self.cock_battle.challenged_cock_status + donated_cock_power) else: donated_cock_power = ( (self.cock_battle.challenged_cock_status) / 2) + 1 embed_dict['fields'][1][ 'name'] = "{}:white_check_mark:".format( self.cock_battle.challenger.name) db.set_cock_status( winner.id, self.cock_battle.challenger_cock_status + donated_cock_power) results = [] for user, amount_won in self.cock_battle.wagers[winner].items(): new_user_balance = db.modify_user_balance(user.id, amount_won) results.append("{} won {:,}, new balance is {:,}".format( user, round(amount_won, 2), round(new_user_balance, 2))) embed_dict['author_name'] = "{}s c**k won the battle!".format( winner.name) embed_dict['colour'] = discord.Colour(0x0077be) embed_dict['fields'][4] = { 'name': "{} c**k was victorious in round {} and wins {} from the purse!" .format(winner.name, rounds, self.cock_battle.purse), 'value': "{}\% is added to his cocks power from his vanquished foe". format(donated_cock_power), 'inline': False } await ctx.send(embed=build_embed(embed_dict)) self.cock_battle = None await ctx.send("\n".join(results)) else: embed_dict['author_name'] = "C**k Battle Aborted!" embed_dict['colour'] = discord.Colour(0xe10531) embed_dict['fields'][4] = { 'name': "```{} did not accept, the battle is cancelled!```".format( self.cock_battle.challenged.name), 'value': 'Challenge someone awake next time!', 'inline': False } await battle_message.edit(embed=build_embed(embed_dict)) self.cock_battle = None