async def dg(ctx, args): global STATUS, COOLDOWN embed = Embed(title="Suffering on demand", description="I may regret this") if len(args) > 0 and args[0] in ['status', 's']: await check_status(ctx, embed) elif len(args) > 0 and args[0] in ['help']: await help_page(ctx, 'dg') elif id(ctx.message.author) == 'CapSora#7528': if len(args) == 0: await print_unfinished_request(ctx, embed) elif (args[0] in ['disable', 'd'] and STATUS) \ or (args[0] in ['enable', 'e'] and not STATUS): STATUS = not STATUS await check_status(ctx, embed) elif len(args) >= 2 and args[0] in ['cooldown']: if args[1].isdecimal(): COOLDOWN = int(args[1]) embed.description = f"Cooldown set to {COOLDOWN} minute(s)." await ctx.send(embed=embed) elif len(args) >= 3 and args[0] in ['p', 'putting']: if args[1].isdecimal() and args[2].isdecimal(): await complete_putting(ctx, embed, int(args[1]), int(args[2])) elif args[0] in ['override']: pass else: if not STATUS: await check_status(ctx, embed) else: await create_request(ctx, embed, ' '.join(args))
async def untouchable(ctx, emotes, args): # User check user = ctx.message.author userid = id(user) await new_user(ctx, userid) # Read data with open('Apps/bank.json') as f: bank_dict = load(f) # Embed embed = Embed( title='UNTOUCHABLE!', description=f'Test your luck! Win up to 10 Million Cor!', colour=0xffa02d ) # Time data now = datetime.now(timezone.utc) last_play = parse( bank_dict[userid]['untouchable']['last_played'], tzinfos={"+00:00": tz.UTC} ) cooldown_dur = timedelta(minutes=5) # Logic if len(args) == 0: await instructions(ctx, embed) elif args[0] in ['help']: await help_page(ctx, "untouchable") elif args[0] in ['rates']: await rates(ctx, embed) elif args[0] in ['history', 'h']: if len(args) >= 2 and args[1] in bank_dict: userid = args[1] await history(ctx, embed, userid, bank_dict[userid]) elif args[0] in ['luck', 'l']: if len(args) >= 2 and args[1] in bank_dict: userid = args[1] await percentile(ctx, embed, userid, bank_dict[userid], emotes) elif args[0] in ['leaderboards', 'lb']: num = -1 if len(args) >= 2 and args[1].isnumeric(): num = int(args[1]) await leaderboards(ctx, embed, bank_dict, num) elif now - last_play < cooldown_dur: await cooldown(ctx, embed, cooldown_dur, now - last_play) else: if args[0] in ['random', 'r']: guess = f'{randrange(1000000):06}' elif len(args[0]) == 6 and str(args[0]).isnumeric(): guess = str(args[0]) else: await ctx.send('Please guess a 6-digit (0-9) number.') return matches = await lottery(ctx, embed, emotes, guess) # Add value to bank dict bank_dict[userid]['cor'] += PAYOUTS[matches] bank_dict[userid]['untouchable']['wins'][matches] += 1 bank_dict[userid]['untouchable']['last_played'] = str(now) with open('Apps/bank.json', 'w') as f: dump(bank_dict, f)
async def create_request(ctx, embed, flags): create_connection() if unfinished_request() is not None: embed.description = "There is already an existing request." await ctx.send(embed=embed) await ping_owner(ctx) await print_unfinished_request(ctx, embed) return cd = cooldown() if cd > 0: mins = int(cd / 60) secs = cd % 60 embed.description = ( f'Cooldown active. Try again in {mins}m {secs}s. ⏱️') await ctx.send(embed=embed) return sql = ( "INSERT INTO throws(flags, distance, throw_type, userid, request_time)" " VALUES(?,?,?,?,?)") flag_list = flags.split() if '-15' in flag_list: dist = '15' elif '-20' in flag_list: dist = '20' else: dist = choice(['15', '20', '20', '20']) if '-s' in flag_list: throw_type = "straddle" elif '-l' in flag_list: throw_type = "lunge" else: throw_type = choice(["Straddle", "Lunge"]) userid = id(ctx.message.author) request_time = str(datetime.now(timezone.utc)) values = (flags, dist, throw_type, userid, request_time) CONN.execute(sql, values) CONN.commit() await ping_owner(ctx) await print_unfinished_request(ctx, embed, values) return values
async def stocks(ctx, emojis, args): # User check user = ctx.message.author userid = id(user) await new_user(ctx, userid) # Read data (only used for holdings command atm) with open('Apps/bank.json') as f: bank_dict = load(f) # Update stock history check_history() # Embed embed = Embed( title='Aincrad Stock Exchange', description= ('Good credit? Bad credit? No credit? No problem!\n' "Oh you dead? F*** it, GHOST CREDIT!\nр┤х'рхљ рхЇрхњРЂ┐ рхЇрхЅрхЌ рхЃ ╦брхўрхЄрхЃ╩│рхў" ), colour=0x379cfa) # Logic if len(args) == 0: await stock_prices(ctx, embed, emojis) elif args[0] in ['help']: await help_page(ctx, "stocks") elif args[0] in ['info']: await stock_help(ctx, embed) elif args[0] in ['history', 'h']: await stock_price_history(ctx, embed, emojis) elif args[0] in ['holdings', 'o']: if len(args) >= 2 and args[1] in bank_dict: userid = args[1] await view_holdings(ctx, embed, userid) elif args[0] in ['leaderboards', 'lb']: await leaderboards(ctx, embed) elif args[0] in ['buy', 'b']: await trade(ctx, embed, userid, args, buy=True) elif args[0] in ['sell', 's']: await trade(ctx, embed, userid, args, buy=False) elif args[0] in ['fees', 'f']: await fees(ctx, embed)
async def profile(ctx, args): # User check user = ctx.message.author userid = id(user) await new_user(ctx, userid) # Read bank dict with open('Apps/bank.json') as f: bank_dict = load(f) # Embed embed = Embed( title = userid, description = "No title", colour = 0xa600a0 ) # Logic if len(args) == 0: await display_user(ctx, embed, userid) elif args[0] in ['help']: await help_page(ctx, 'profile') elif args[0] in bank_dict: embed.title = args[0] await display_user(ctx, embed, args[0])
async def roulette(ctx, args): cap = 1000 # User check user = ctx.message.author userid = id(user) await new_user(ctx, userid) # Embed embed = Embed(title="Roulette", description="Place your bets now!", colour=0x009c2c) # Logic if len(args) == 0: await instructions(ctx, embed) elif args[0] in ['help']: await help_page(ctx, "roulette") elif args[0] in ['rates']: await rates(ctx, embed) elif args[0] in ['table', 't']: await table(ctx, embed) elif args[0] in ['history', 'h']: # Read data with open('Apps/bank.json') as f: bank_dict = load(f) if len(args) >= 2 and args[1] in bank_dict: userid = args[1] await history(ctx, embed, userid) elif args[0] in ['leaderboards', 'lb']: await leaderboards(ctx, embed) elif len(args) < 2: await instructions(ctx, embed) elif (args[0] in TRANSLATE) \ or (args[0].isdecimal() and int(args[0]) >= 0 \ and int(args[0]) < 37): if args[1].isdecimal() and int(args[1]) > 0 and int(args[1]) <= cap: await bet(ctx, embed, args[0], int(args[1]), userid) else: await instructions(ctx, embed)