Fix errors when querying system fronters/history when you don't have a system yourself
This commit is contained in:
parent
a6708cb788
commit
e5612a7b41
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user