From e5612a7b41ca613b4e2987e6a452a41eb252bd98 Mon Sep 17 00:00:00 2001 From: Ske Date: Wed, 25 Jul 2018 23:05:03 +0200 Subject: [PATCH] Fix errors when querying system fronters/history when you don't have a system yourself --- src/pluralkit/bot/commands/system_commands.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pluralkit/bot/commands/system_commands.py b/src/pluralkit/bot/commands/system_commands.py index 6d928442..b2e0412e 100644 --- a/src/pluralkit/bot/commands/system_commands.py +++ b/src/pluralkit/bot/commands/system_commands.py @@ -146,13 +146,14 @@ async def system_fronter(ctx: CommandContext, args: List[str]): if len(args) == 0: if not ctx.system: raise NoSystemRegistered() + system = ctx.system else: system = await utils.get_system_fuzzy(ctx.conn, ctx.client, args[0]) if system is None: raise CommandError("Can't find system \"{}\".".format(args[0])) - fronters, timestamp = await utils.get_fronters(ctx.conn, system_id=ctx.system.id) + fronters, timestamp = await utils.get_fronters(ctx.conn, system_id=system.id) fronter_names = [member.name for member in fronters] embed = utils.make_default_embed(None) @@ -173,6 +174,7 @@ async def system_fronthistory(ctx: CommandContext, args: List[str]): if len(args) == 0: if not ctx.system: raise NoSystemRegistered() + system = ctx.system else: system = await utils.get_system_fuzzy(ctx.conn, ctx.client, args[0]) @@ -180,7 +182,7 @@ async def system_fronthistory(ctx: CommandContext, args: List[str]): raise CommandError("Can't find system \"{}\".".format(args[0])) lines = [] - front_history = await utils.get_front_history(ctx.conn, ctx.system.id, count=10) + front_history = await utils.get_front_history(ctx.conn, system.id, count=10) for i, (timestamp, members) in enumerate(front_history): # Special case when no one's fronting if len(members) == 0: