async def transacinfo(self, ctx, user: discord.User = None): '''See your transaction history''' tried_other=False if user is not None: if not checks.is_owner(ctx): user = ctx.author tried_other=True else: user = ctx.author if user.id not in ctx.bot.people: if id == ctx.author.id: ctx.bot.add_user(user) else: await ctx.author.send('{} is not in the database.'.format(id)) hist = ctx.bot.people[user.id]['transacts'] gains = sum([x for x in hist if x>0]) losses = sum([-x for x in hist if x<0]) d = '' if tried_other: d += 'You can only see your history.\n' d += 'Perc History for **{}**\n'.format(user.name) d += 'Account: ¶{}\n'.format(sum(hist)) d += 'Revenue: ¶{}\n'.format(gains) d += 'Payments: ¶{}\n'.format(losses) d += 'History: {}'.format(', '.join([str(x) for x in hist])) await ctx.author.send(d)
async def tier(self, ctx, user: discord.User = None): '''See your tier''' tried_other=False if user is not None: if not checks.is_owner(ctx): user = ctx.author tried_other=True else: user = ctx.author if user.id not in ctx.bot.people: if user.id == ctx.author.id: ctx.bot.add_user(user) await ctx.author.send('You are at tier 0.') else: await ctx.author.send('{} is not in the database.'.format(user.name)) return d = '' tier = ctx.bot.people[user.id]['tier'] if tried_other: d += 'You can only see your tier. ' if ctx.author.id == user.id: d += 'You are at' else: d += user.name +' is at' await ctx.author.send('{} tier {}.'.format(d,tier))
async def percs(self, ctx, user: discord.User = None): '''See how many percs you have''' tried_other=False if user is not None: if not checks.is_owner(ctx): user = ctx.author tried_other=True else: user = ctx.author if user.id not in ctx.bot.people: if id == ctx.author.id: ctx.bot.add_user(user) await ctx.author.send('You have 0 percs.') else: await ctx.author.send('{} is not in the database.'.format(user.name)) return percs = ctx.bot.people[user.id]['percs'] d = '' if tried_other: d += 'You can only see how many percs you have. ' if ctx.author.id == user.id: d += 'You have' else: d += '{} has'.format(user.name) if percs == 1: await ctx.author.send('{} 1 perc.'.format(d)) else: await ctx.author.send('{} {} percs.'.format(d,percs))
async def myitems(self, ctx, user: discord.User = None): '''See your items''' tried_other=False if user is not None: if not checks.is_owner(ctx): user = ctx.author tried_other=True else: user = ctx.author if user.id not in ctx.bot.people: if id == ctx.author.id: ctx.bot.add_user(user) await ctx.author.send('You have no items.') else: await ctx.author.send('{} is not in the database.'.format(user.name)) return d = '' if tried_other: d += 'You can only see how many items you have. ' d += 'Here are your items:\n' item_dict = ctx.bot.inventories[user.id] item_str = '' for key, value in item_dict.items(): if value>0: item_str+='{}: {}\n'.format(key.title(),value) if len(item_str)==0: if ctx.author.id == user.id: d = 'You have no items.' else: d='{} has no items.'.format(user.name) d += item_str await ctx.author.send(d)
async def __local_check(self, ctx): return checks.is_owner(ctx)