Add more aliases and update help

This commit is contained in:
xBelladonna 2019-04-11 17:40:56 +09:30 committed by Astrid
parent 52e1c06d1b
commit f49c2baaff
4 changed files with 35 additions and 8 deletions

View File

@ -38,7 +38,7 @@ async def specific_member_root(ctx: CommandContext):
await member_pronouns(ctx, member)
elif ctx.match("color") or ctx.match("colour"):
await member_color(ctx, member)
elif ctx.match("birthday") or ctx.match("birthdate"):
elif ctx.match("birthday") or ctx.match("birthdate") or ctx.match("bday"):
await member_birthdate(ctx, member)
elif ctx.match("delete") or ctx.match("remove") or ctx.match("destroy") or ctx.match("erase"):
await member_delete(ctx, member)

View File

@ -18,6 +18,7 @@ def make_command_embed(command):
embed = make_footer_embed()
embed.title = prefix + command["usage"]
embed.description = (command["description"] + "\n" + command.get("longdesc", "")).strip()
embed.add_field(name="Aliases" if len(command["aliases"]) > 1 else "Alias", value="\n".join([prefix + cmd for cmd in command["aliases"]]), inline=False)
embed.add_field(name="Usage", value=prefix + command["usage"], inline=False)
if "examples" in command:
embed.add_field(name="Examples" if len(command["examples"]) > 1 else "Example", value="\n".join([prefix + cmd for cmd in command["examples"]]), inline=False)
@ -28,18 +29,18 @@ def make_command_embed(command):
def find_command(command_list, name):
for command in command_list:
if command["name"].lower().strip() == name.lower().strip():
return command
return command
async def help_root(ctx: CommandContext):
for page_name, page_content in help.helpfile["pages"].items():
if ctx.match(page_name):
return await help_page(ctx, page_content)
if not ctx.has_next():
return await help_page(ctx, help.helpfile["pages"]["root"])
return await help_command(ctx, ctx.remaining())
async def help_page(ctx, sections):
msg = ""
for section in sections:
@ -59,7 +60,7 @@ async def help_command(ctx, command_name):
break
command = found_command
name_parts = name_parts[1:]
return await ctx.reply(embed=make_command_embed(command))
async def command_list(ctx):
@ -81,7 +82,7 @@ async def command_list(ctx):
for cat_name, cat_cmds in categories.items():
embed.add_field(name=cat_name, value="\n".join(cat_cmds))
await ctx.reply(embed=embed)
async def invite_link(ctx: CommandContext):
client_id = (await ctx.client.application_info()).id

View File

@ -20,7 +20,7 @@ async def system_root(ctx: CommandContext):
# Commands that operate without a specified system (usually defaults to the executor's own system)
if ctx.match("name") or ctx.match("rename"):
await system_name(ctx)
elif ctx.match("description"):
elif ctx.match("description") or ctx.match("desc"):
await system_description(ctx)
elif ctx.match("avatar") or ctx.match("icon"):
await system_avatar(ctx)

View File

@ -2,6 +2,7 @@
"commands": [
{
"name": "system",
"aliases": ["s"],
"usage": "system [id]",
"description": "Shows information about a system.",
"longdesc": "The given ID can either be a 5-character ID, a Discord account @mention, or a Discord account ID. Leave blank to show your own system.",
@ -10,24 +11,28 @@
"subcommands": [
{
"name": "new",
"aliases": ["system register", "system create", "system init"],
"usage": "system new [name]",
"category": "System",
"description": "Creates a new system registered to your account."
},
{
"name": "name",
"alises": ["system rename"],
"usage": "system name [name]",
"category": "System",
"description": "Changes the name of your system."
},
{
"name": "description",
"aliases": ["system desc"],
"usage": "system description [description]",
"category": "System",
"description": "Changes the description of your system."
},
{
"name": "avatar",
"aliases": ["system icon"],
"usage": "system avatar [avatar url]",
"category": "System",
"description": "Changes the avatar of your system.",
@ -52,6 +57,7 @@
},
{
"name": "delete",
"aliases": ["system remove", "system destroy", "system erase"],
"usage": "system delete",
"category": "System",
"description": "Deletes your system.",
@ -59,6 +65,7 @@
},
{
"name": "fronter",
"aliases": ["system front", "system fronters"],
"usage": "system [id] fronter",
"category": "System",
"description": "Shows the current fronter of a system."
@ -71,6 +78,7 @@
},
{
"name": "frontpercent",
"aliases": ["system frontbreakdown", "system frontpercentage"],
"usage": "system [id] fronthistory [timeframe]",
"category": "System",
"description": "Shows the aggregated front history of a system within a given time frame.",
@ -79,6 +87,7 @@
},
{
"name": "list",
"aliases": ["system members"],
"usage": "system [id] list [full]",
"category": "System",
"description": "Shows a paginated list of a system's members. Add 'full' for more details.",
@ -103,12 +112,21 @@
},
{
"name": "member",
"aliases": ["m"],
"usage": "member <name>",
"category": "Member",
"description": "Shows information about a member.",
"longdesc": "The given member name can either be the name of a member in your own system or a 5-character member ID (in any system).",
"examples": ["member John", "member abcde"],
"subcommands": [
{
"name": "new",
"aliases": ["member add", "member create", "member register"],
"usage": "member new <name>",
"category": "Member",
"description": "Creates a new system member.",
"exmaples": ["member new Jack"]
},
{
"name": "rename",
"usage": "member <name> rename <name>",
@ -118,6 +136,7 @@
},
{
"name": "description",
"aliases": ["member desc"],
"usage": "member <name> description [description]",
"category": "Member",
"description": "Changes the description of a member.",
@ -125,6 +144,7 @@
},
{
"name": "avatar",
"aliases": ["member icon"],
"usage": "member <name> avatar [avatarurl]",
"category": "Member",
"description": "Changes the avatar of a member.",
@ -133,6 +153,7 @@
},
{
"name": "proxy",
"aliases": ["member tags"],
"usage": "member <name> proxy [tags]",
"category": "Member",
"description": "Changes the proxy tags of a member.",
@ -141,6 +162,7 @@
},
{
"name": "pronouns",
"aliases": ["member pronoun"],
"usage": "member <name> pronouns [pronouns]",
"category": "Member",
"description": "Changes the pronouns of a member.",
@ -149,6 +171,7 @@
},
{
"name": "color",
"aliases": ["member colour"],
"usage": "member <name> color [color]",
"category": "Member",
"description": "Changes the color of a member.",
@ -157,6 +180,7 @@
},
{
"name": "birthday",
"aliases": ["member bday", "member birthdate"],
"usage": "member <name> birthday [birthday]",
"category": "Member",
"description": "Changes the birthday of a member.",
@ -165,6 +189,7 @@
},
{
"name": "delete",
"aliases": ["member remove", "member destroy", "member erase"],
"usage": "member <name> delete",
"category": "Member",
"description": "Deletes a member.",
@ -174,6 +199,7 @@
},
{
"name": "switch",
"aliases": ["sw"],
"usage": "switch <member> [member...]",
"category": "Switching",
"description": "Registers a switch with the given members.",
@ -307,4 +333,4 @@
]
},
"footer": "By @Ske#6201 | GitHub: https://github.com/xSke/PluralKit/"
}
}