Fix error on displaying switch history

Fix CommandError being raised when issuing `pk;switch` with no parameters
This commit is contained in:
xBelladonna 2019-06-15 12:29:19 +09:30 committed by Bella | Nightshade
parent 15ccc4e27a
commit 6eae3c02fa

View file

@ -15,6 +15,7 @@ async def switch_root(ctx: CommandContext):
# We could raise an error here, but we display the system front history instead as a shortcut # We could raise an error here, but we display the system front history instead as a shortcut
#raise CommandError("You must use a subcommand. For a list of subcommands, type `pk;help member`.") #raise CommandError("You must use a subcommand. For a list of subcommands, type `pk;help member`.")
await system_fronthistory(ctx, await ctx.ensure_system()) await system_fronthistory(ctx, await ctx.ensure_system())
return
if ctx.match("out"): if ctx.match("out"):
await switch_out(ctx) await switch_out(ctx)
elif ctx.match("move"): elif ctx.match("move"):
@ -28,9 +29,6 @@ async def switch_root(ctx: CommandContext):
async def switch_member(ctx: CommandContext): async def switch_member(ctx: CommandContext):
system = await ctx.ensure_system() system = await ctx.ensure_system()
if not ctx.has_next():
raise CommandError("You must pass at least one member name or ID to register a switch to.")
members: List[Member] = [] members: List[Member] = []
while ctx.has_next(): while ctx.has_next():
members.append(await ctx.pop_member()) members.append(await ctx.pop_member())