Display front history with pk;switch
Display system front history when the command `pk;switch` is issued without any arguments
This commit is contained in:
parent
ebc8ab1738
commit
1ec0683713
@ -5,14 +5,16 @@ import dateparser
|
||||
import pytz
|
||||
|
||||
from pluralkit.bot.commands import *
|
||||
from pluralkit.bot.commands.system_commands import system_fronthistory
|
||||
from pluralkit.member import Member
|
||||
from pluralkit.utils import display_relative
|
||||
|
||||
|
||||
async def switch_root(ctx: CommandContext):
|
||||
if not ctx.has_next():
|
||||
raise CommandError("You must use a subcommand. For a list of subcommands, type `pk;help member`.")
|
||||
|
||||
# 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`.")
|
||||
await system_fronthistory(ctx, await ctx.ensure_system())
|
||||
if ctx.match("out"):
|
||||
await switch_out(ctx)
|
||||
elif ctx.match("move"):
|
||||
|
@ -244,7 +244,7 @@ async def system_fronthistory(ctx: CommandContext, system: System):
|
||||
front_history = await pluralkit.utils.get_front_history(ctx.conn, system.id, count=10)
|
||||
|
||||
if not front_history:
|
||||
raise CommandError("You have no logged switches. Use `pk;switch´ to start logging.")
|
||||
raise CommandError("You have no logged switches. Use `pk;switch [member] [extra members...]` to start logging.")
|
||||
|
||||
for i, (timestamp, members) in enumerate(front_history):
|
||||
# Special case when no one's fronting
|
||||
|
@ -201,11 +201,11 @@
|
||||
{
|
||||
"name": "switch",
|
||||
"aliases": ["sw"],
|
||||
"usage": "switch <member> [member...]",
|
||||
"usage": "switch [member] [extra members...]",
|
||||
"category": "Switching",
|
||||
"description": "Registers a switch with the given members.",
|
||||
"longdesc": "You may specify multiple members to indicate cofronting.",
|
||||
"examples": ["switch Jack", "switch Jack Jill"],
|
||||
"description": "Registers a switch with the given members, or displays a list of logged switches if no members are given.",
|
||||
"longdesc": "You may specify multiple members to indicate cofronting. Shows the last 10 switches of a system if no members are given.",
|
||||
"examples": ["switch Jack", "switch Jack Jill", "switch"],
|
||||
"subcommands": [
|
||||
{
|
||||
"name": "move",
|
||||
|
Loading…
Reference in New Issue
Block a user