diff options
author | 2019-10-15 22:25:52 +0800 | |
---|---|---|
committer | 2019-10-15 22:25:52 +0800 | |
commit | c209cc6544aaa8c6b6635ced1c000d50d1bee890 (patch) | |
tree | 2b6493acb5fde295a112a117d7be10a917e41af3 | |
parent | Create the !mention command. (#493) (diff) |
Fix rule alias.
Allow rule alias to take rule numbers, passes them to the `site rules`
command. Rules are now 1-indexed to conform with the representation on
the website.
-rw-r--r-- | bot/cogs/alias.py | 6 | ||||
-rw-r--r-- | bot/cogs/site.py | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/bot/cogs/alias.py b/bot/cogs/alias.py index 6648805e9..5190c559b 100644 --- a/bot/cogs/alias.py +++ b/bot/cogs/alias.py @@ -79,10 +79,10 @@ class Alias (Cog): """Alias for invoking <prefix>site faq.""" await self.invoke(ctx, "site faq") - @command(name="rules", hidden=True) - async def site_rules_alias(self, ctx: Context) -> None: + @command(name="rules", aliases=("rule",), hidden=True) + async def site_rules_alias(self, ctx: Context, *rules: int) -> None: """Alias for invoking <prefix>site rules.""" - await self.invoke(ctx, "site rules") + await self.invoke(ctx, "site rules", *rules) @command(name="reload", hidden=True) async def extensions_reload_alias(self, ctx: Context, *extensions: Extension) -> None: diff --git a/bot/cogs/site.py b/bot/cogs/site.py index c3bdf85e4..d95359159 100644 --- a/bot/cogs/site.py +++ b/bot/cogs/site.py @@ -126,15 +126,15 @@ class Site(Cog): invalid_indices = tuple( pick for pick in rules - if pick < 0 or pick >= len(full_rules) + if pick < 1 or pick > len(full_rules) ) if invalid_indices: indices = ', '.join(map(str, invalid_indices)) - await ctx.send(f":x: Invalid rule indices {indices}") + await ctx.send(f":x: Invalid rule indices: {indices}") return - final_rules = tuple(f"**{pick}.** {full_rules[pick]}" for pick in rules) + final_rules = tuple(f"**{pick}.** {full_rules[pick - 1]}" for pick in rules) await LinePaginator.paginate(final_rules, ctx, rules_embed, max_lines=3) |