async def zodiac(self, ctx, sign: EnumConverter(ZodiacSign) = None): if sign is None: human = ctx.get_human() if human.date_of_birth is None: raise SendableException(ctx.translate("date_of_birth_not_set")) sign = human.zodiac_sign query = Human.select(Human.user_id, Human.zodiac_sign) query = query.join(Earthling, on=(Human.id == Earthling.human)) query = query.where(Earthling.guild_id == ctx.guild.id) query = query.where(Human.date_of_birth != None) table = pretty.Table() table.add_row(pretty.Row(["member", "sign"], header=True)) i = 0 for human in query: if sign != human.zodiac_sign: continue if human.user is None: continue values = [str(human.user), str(sign.name)] table.add_row(pretty.Row(values)) i += 1 await table.to_paginator(ctx, 15).wait()
async def item_list(self, ctx): items = Item.select().order_by(Item.chance.desc()) table = pretty.Table() table.add_row(pretty.Row(("name", "rarity"), header=True)) for item in items: table.add_row(pretty.Row((item.name, item.rarity.name))) await table.to_paginator(ctx, 15).wait()
async def prank_list(self, ctx): query = Prankster.select() query = query.where(Prankster.guild_id == ctx.guild.id) query = query.where(Prankster.enabled == True) query = query.order_by(Prankster.pranked.desc()) table = pretty.Table() table.add_row(pretty.Row(("Prankster", "Pranked?"), header=True)) for prankster in query: member = prankster.member if member is not None: table.add_row( pretty.Row((str(member), pretty.prettify_value(prankster.pranked)))) await table.to_paginator(ctx, 15).wait()
async def scoreboard(self, ctx): query = Human.select() query = query.join(Earthling, on=(Human.id == Earthling.human)) query = query.where(Earthling.guild_id == ctx.guild.id) query = query.order_by(Human.gold.desc()) table = pretty.Table() table.add_row(pretty.Row(["rank", "gold", "member"], header=True)) i = 0 for human in query: user = human.user if user is None: continue values = [f"{i+1}", str(human.gold), str(user)] table.add_row(pretty.Row(values)) i += 1 await table.to_paginator(ctx, 15).wait()
async def prank_scoreboard(self, ctx): query = Prankster.select() query = query.where(Prankster.guild_id == ctx.guild.id) table = pretty.Table() table.add_row( pretty.Row(("Prankster", "People pranked (nick)"), header=True)) for prankster in query: member = prankster.member if member is not None: query = NicknamePrank.select() query = query.where(NicknamePrank.finished == True) query = query.where(NicknamePrank.pranked_by == prankster) table.add_row(pretty.Row((str(member), query.count()))) table.sort(1, int) await table.to_paginator(ctx, 15).wait()
async def covid(self, ctx, country: CountryConverter = None): human = ctx.get_human() country = country or human.country if country is None: raise SendableException(ctx.translate("no_country_selected")) status = country.covid_status table = pretty.Table() table.add_row(pretty.Row(("😷 Cases", status["active"]))) table.add_row(pretty.Row(("💀 Deaths", status["deaths"]))) table.add_row(pretty.Row(("💉 Recovered", status["recovered"]))) embed = self.get_base_embed(ctx.guild) embed.description = table.generate() # embed.set_footer(text = "Last update") # embed.timestamp = datetime.datetime.utcfromtimestamp(status["last_update"]) asyncio.gather(ctx.send(embed=embed))
async def role_list(self, ctx): query = Earthling.select() query = query.where(Earthling.guild_id == ctx.guild.id) query = query.where(Earthling.personal_role_id != None) roles = [] for earthling in query: role = earthling.personal_role if role is None: earthling.personal_role_id = None earthling.save() else: roles.append(role) roles.sort(key=lambda x: x.position) table = pretty.Table() table.add_row(pretty.Row(["role", "pos", "in use"], header=True)) for role in roles: values = [role.name, role.position, len(role.members) > 0] table.add_row(pretty.Row(values)) await table.to_paginator(ctx, 20).wait() table = pretty.Table()