async def withdraw(self, ctx, *args): if len(list(args)) == 0: return await ctx.send( '{} | How many money?\nOr use `1widthdraw all` to get money from the bank.' .format(str(self.client.get_emoji(BotEmotes.error)))) data = Economy.get(ctx.author.id) if data == None: raise myself.noProfile() if list(args)[0].lower() == 'all': Economy.withdraw(ctx.author.id, data['bankbal']) return await ctx.send( '{} | OK. Withdrawed all of your diamonds from the username601 bank.' .format(str(self.client.get_emoji(BotEmotes.success)))) try: num = int(list(args)[0]) if num > data['bankbal']: return await ctx.send( '{} | Your number is more than the one in your bank!'. format(str(self.client.get_emoji(BotEmotes.error)))) Economy.withdraw(ctx.author.id, num) return await ctx.send( '{} | OK. Withdrawed {} diamonds from your bank.'.format( str(self.client.get_emoji(BotEmotes.success)), num)) except: await ctx.send('{} | Invalid number.'.format( str(self.client.get_emoji(BotEmotes.error))))
async def deposit(self, ctx, *args): if len(list(args)) == 0: return await ctx.send( '{} | How many money?\nOr use `1dep all` to deposit all of your money.' .format(str(self.client.get_emoji(BotEmotes.error)))) data = Economy.get(ctx.author.id) if data == None: raise myself.noProfile() if list(args)[0].lower() == 'all': Economy.deposit(ctx.author.id, data['bal']) return await ctx.send( '{} | OK. Deposited all of your diamonds to the username601 bank.' .format(str(self.client.get_emoji(BotEmotes.success)))) try: num = int(list(args)[0]) if num > data['bal']: return await ctx.send( '{} | Your bank has more money than in your balance!'. format(str(self.client.get_emoji(BotEmotes.error)))) Economy.deposit(ctx.author.id, num) return await ctx.send( '{} | OK. Deposited {} diamonds to your bank.'.format( str(self.client.get_emoji(BotEmotes.success)), num)) except: await ctx.send('{} | Invalid number.'.format( str(self.client.get_emoji(BotEmotes.error))))
async def reset(self, ctx): wait = await ctx.send( str(self.client.get_emoji(BotEmotes.loading)) + " | Please wait...") data = Economy.get(ctx.author.id) if data == None: raise myself.noProfile() else: await wait.edit( content= ':thinking: | Are you sure? This action is irreversible!\n(Reply with yes/no)' ) def check_is_auth(m): return ctx.message.author == m.author try: waiting = await self.client.wait_for('message', check=check_is_auth, timeout=20.0) except: await ctx.send('{} | No it is then.'.format( str(self.client.get_emoji(BotEmotes.success)))) if 'y' in str(waiting.content).lower(): Economy.delete_data(ctx.author.id) await ctx.send('{} | Data deleted. Thanks for playing.'.format( str(self.client.get_emoji(BotEmotes.success)))) else: await ctx.send('{} | No it is then.'.format( str(self.client.get_emoji(BotEmotes.success))))
async def beg(self, ctx): c = random.randint(1, 4) if Economy.get(ctx.author.id) == None: raise myself.noProfile() if c == 1: award = random.randint(100, 500) Economy.addbal(ctx.author.id, award) return await ctx.send( '{} | You begged and got {} diamonds!'.format( self.client.get_emoji(BotEmotes.success), award)) await ctx.send('{} | Stop begging! Try again later.'.format( self.client.get_emoji(BotEmotes.error)))
async def buylist(self, ctx): source = ctx.author if len( ctx.message.mentions) == 0 else ctx.message.mentions[0] if Economy.get(ctx.author.id) == None: raise myself.noProfile() try: data = Economy.getBuyList(source) assert data['error'] == False, data['ctx'] return await ctx.send(embed=discord.Embed( title='{}\'s buy list'.format(source.name), description=data['ctx'], color=discord.Colour.from_rgb(201, 160, 112))) except Exception as e: return await ctx.send('{} | {}!'.format( self.client.get_emoji(BotEmotes.error), str(e)))
async def bal(self, ctx, *args): wait = await ctx.send( str(self.client.get_emoji(BotEmotes.loading)) + " | Please wait...") src, ava = myself.getUser(ctx, args), myself.getUserAvatar(ctx, args) if Economy.get(src.id) == None: raise myself.noProfile() else: img = self.canvas.profile( ava, src, Economy.getProfile( src.id, [i.id for i in ctx.guild.members if not i.bot])) await wait.delete() await ctx.send(file=discord.File(img, 'profile.png'))
async def buy(self, ctx, *args): if len(list(args)) == 0: return await ctx.send( '{} | Please use the following parameters:\n`{}buy <name>`'. format(self.client.get_emoji(BotEmotes.error), Config.prefix)) if Economy.get(ctx.author.id) == None: raise myself.noProfile() try: data = Shop.buy(' '.join(list(args)), ctx.author) assert data['error'] == False, data['ctx'] return await ctx.send('{} | {}!'.format( self.client.get_emoji(BotEmotes.success), data['ctx'])) except Exception as e: await ctx.send('{} | {}!'.format( self.client.get_emoji(BotEmotes.error), str(e)))
async def fish(self, ctx): if Economy.get(ctx.author.id) == None: raise myself.noProfile() wait = await ctx.send('{} | {}'.format( self.client.get_emoji(BotEmotes.loading), random.choice( loads( open('/home/runner/hosting601/assets/json/fish.json', 'r').read())['waiting']))) await sleep(random.randint(3, 10)) res = self.randomfish() if res['catched']: awards = random.randint(res['ctx']['worth']['min'], res['ctx']['worth']['max']) Economy.addbal(ctx.author.id, awards) return await wait.edit( content= '{} | Congratulations! You caught a {} and sell it worth for {} diamonds!' .format(res['ctx']['emote'], res['ctx']['name'], awards)) return await wait.edit(content='{} | You only caught {}...'.format( self.client.get_emoji(BotEmotes.error), res['ctx']))
async def daily(self, ctx, *args): wait = await ctx.send( str(self.client.get_emoji(BotEmotes.loading)) + " | Please wait...") if Economy.get(ctx.message.author.id) == None: raise myself.noProfile() else: obj = Economy.can_vote(ctx.message.author.id) if obj['bool']: await wait.edit( content='', embed=discord.Embed( title='Vote us at top.gg!', description='**[VOTE HERE](https://top.gg/bot/' + str(Config.id) + '/vote)**\nBy voting, we will give you rewards such as ***LOTS of diamonds!***', color=discord.Colour.green())) else: await wait.edit( content='', embed=discord.Embed(title='You can vote us again in ' + str(obj['time']) + '!', colour=discord.Colour.red()))
async def work(self, ctx): wait = await ctx.send( str(self.client.get_emoji(BotEmotes.loading)) + " | Please wait...") data = Economy.get(ctx.author.id) if data == None: raise myself.noProfile() else: reward = str(random.randint(100, 500)) new_data = Economy.addbal(ctx.message.author.id, int(reward)) job = random.choice( loads( open('/home/runner/hosting601/assets/json/work.json', 'r').read())['works']) if new_data == 'success': await wait.edit( content=str(self.client.get_emoji(BotEmotes.success)) + f" | {ctx.message.author.name} worked {job} and earned {reward} diamonds!" ) else: await wait.edit( content=str(self.client.get_emoji(BotEmotes.error)) + f" | Oops there was an error... Please report this to the owner using `1feedback.`\n`{new_data}`" )
async def setdesc(self, ctx, *args): if len(list(args)) == 0: await ctx.send( str(self.client.get_emoji(BotEmotes.error)) + ' | What is the new description?') else: if len(list(args)) > 50: await ctx.send( str(self.client.get_emoji(BotEmotes.error)) + ' | Your description is too long!') elif '://' in str(' '.join(list(args))): await ctx.send( str(self.client.get_emoji(BotEmotes.error)) + ' | Please don\'t use links in the description! We don\'t allow that!' ) elif 'discord.gg' in str(' '.join(list(args))): await ctx.send( str(self.client.get_emoji(BotEmotes.error)) + ' | Please don\'t use server invite links in the description! We don\'t allow that!' ) else: wait = await ctx.send( str(self.client.get_emoji(BotEmotes.loading)) + ' | Please wait...') if Economy.get(ctx.message.author.id) == None: raise myself.noProfile() else: data = Economy.setdesc(ctx.message.author.id, str(' '.join(list(args)))) if data == 'error': await wait.edit(content=str( self.client.get_emoji(BotEmotes.error)) + ' | Oopsies! There was an error...') else: await wait.edit(content=str( self.client.get_emoji(BotEmotes.success)) + ' | Updated your description!')