Add command aliases

This commit is contained in:
xBelladonna 2019-04-11 16:09:29 +09:30 committed by Astrid
parent 0cc55e5717
commit 52e1c06d1b
3 changed files with 7 additions and 7 deletions

View File

@ -44,7 +44,7 @@ class CommandError(Exception):
class CommandContext: class CommandContext:
client: discord.Client client: discord.Client
message: discord.Message message: discord.Message
def __init__(self, client: discord.Client, message: discord.Message, conn, args: str, system: Optional[System]): def __init__(self, client: discord.Client, message: discord.Message, conn, args: str, system: Optional[System]):
self.client = client self.client = client
self.message = message self.message = message
@ -171,9 +171,9 @@ import pluralkit.bot.commands.system_commands
async def command_root(ctx: CommandContext): async def command_root(ctx: CommandContext):
if ctx.match("system"): if ctx.match("system") or ctx.match("s"):
await system_commands.system_root(ctx) await system_commands.system_root(ctx)
elif ctx.match("member"): elif ctx.match("member") or ctx.match("m"):
await member_commands.member_root(ctx) await member_commands.member_root(ctx)
elif ctx.match("link"): elif ctx.match("link"):
await system_commands.account_link(ctx) await system_commands.account_link(ctx)
@ -187,7 +187,7 @@ async def command_root(ctx: CommandContext):
await misc_commands.invite_link(ctx) await misc_commands.invite_link(ctx)
elif ctx.match("export"): elif ctx.match("export"):
await misc_commands.export(ctx) await misc_commands.export(ctx)
elif ctx.match("switch"): elif ctx.match("switch") or ctx.match("sw"):
await switch_commands.switch_root(ctx) await switch_commands.switch_root(ctx)
elif ctx.match("token"): elif ctx.match("token"):
await api_commands.token_root(ctx) await api_commands.token_root(ctx)

View File

@ -28,7 +28,7 @@ async def specific_member_root(ctx: CommandContext):
if ctx.match("name") or ctx.match("rename"): if ctx.match("name") or ctx.match("rename"):
await member_name(ctx, member) await member_name(ctx, member)
elif ctx.match("description"): elif ctx.match("description") or ctx.match("desc"):
await member_description(ctx, member) await member_description(ctx, member)
elif ctx.match("avatar") or ctx.match("icon"): elif ctx.match("avatar") or ctx.match("icon"):
await member_avatar(ctx, member) await member_avatar(ctx, member)

View File

@ -28,7 +28,7 @@ async def system_root(ctx: CommandContext):
await system_tag(ctx) await system_tag(ctx)
elif ctx.match("new") or ctx.match("register") or ctx.match("create") or ctx.match("init"): elif ctx.match("new") or ctx.match("register") or ctx.match("create") or ctx.match("init"):
await system_new(ctx) await system_new(ctx)
elif ctx.match("delete") or ctx.match("delete") or ctx.match("erase"): elif ctx.match("delete") or ctx.match("remove") or ctx.match("destroy") or ctx.match("erase"):
await system_delete(ctx) await system_delete(ctx)
elif ctx.match("front") or ctx.match("fronter") or ctx.match("fronters"): elif ctx.match("front") or ctx.match("fronter") or ctx.match("fronters"):
await system_fronter(ctx, await ctx.ensure_system()) await system_fronter(ctx, await ctx.ensure_system())
@ -363,7 +363,7 @@ async def system_frontpercent(ctx: CommandContext, system: System):
async def system_list(ctx: CommandContext, system: System): async def system_list(ctx: CommandContext, system: System):
# TODO: refactor this # TODO: refactor this
all_members = sorted(await system.get_members(ctx.conn), key=lambda m: m.name.lower()) all_members = sorted(await system.get_members(ctx.conn), key=lambda m: m.name.lower())
if ctx.match("full"): if ctx.match("full"):
page_size = 8 page_size = 8