aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar MarkKoz <[email protected]>2020-08-22 20:36:27 -0700
committerGravatar MarkKoz <[email protected]>2020-08-22 20:36:27 -0700
commitc6a20ef3b7b7afe3013a17042f8f2ca84566d998 (patch)
treeb0946af3b65784ba238d9fd69b93c58273032149
parentBot: fix AttributeError for commands which lack root_aliases (diff)
Replace alias command definitions with root_aliases
The fruits of my labour.
-rw-r--r--bot/cogs/alias.py70
-rw-r--r--bot/cogs/defcon.py4
-rw-r--r--bot/cogs/extensions.py2
-rw-r--r--bot/cogs/site.py10
-rw-r--r--bot/cogs/watchchannels/bigbrother.py4
-rw-r--r--bot/cogs/watchchannels/talentpool.py6
6 files changed, 15 insertions, 81 deletions
diff --git a/bot/cogs/alias.py b/bot/cogs/alias.py
index 55c7efe65..c6ba8d6f3 100644
--- a/bot/cogs/alias.py
+++ b/bot/cogs/alias.py
@@ -3,13 +3,12 @@ import logging
from discord import Colour, Embed
from discord.ext.commands import (
- Cog, Command, Context, Greedy,
+ Cog, Command, Context,
clean_content, command, group,
)
from bot.bot import Bot
-from bot.cogs.extensions import Extension
-from bot.converters import FetchedMember, TagNameConverter
+from bot.converters import TagNameConverter
from bot.pagination import LinePaginator
log = logging.getLogger(__name__)
@@ -51,56 +50,6 @@ class Alias (Cog):
ctx, embed, empty=False, max_lines=20
)
- @command(name="resources", aliases=("resource",), hidden=True)
- async def site_resources_alias(self, ctx: Context) -> None:
- """Alias for invoking <prefix>site resources."""
- await self.invoke(ctx, "site resources")
-
- @command(name="tools", hidden=True)
- async def site_tools_alias(self, ctx: Context) -> None:
- """Alias for invoking <prefix>site tools."""
- await self.invoke(ctx, "site tools")
-
- @command(name="watch", hidden=True)
- async def bigbrother_watch_alias(self, ctx: Context, user: FetchedMember, *, reason: str) -> None:
- """Alias for invoking <prefix>bigbrother watch [user] [reason]."""
- await self.invoke(ctx, "bigbrother watch", user, reason=reason)
-
- @command(name="unwatch", hidden=True)
- async def bigbrother_unwatch_alias(self, ctx: Context, user: FetchedMember, *, reason: str) -> None:
- """Alias for invoking <prefix>bigbrother unwatch [user] [reason]."""
- await self.invoke(ctx, "bigbrother unwatch", user, reason=reason)
-
- @command(name="home", hidden=True)
- async def site_home_alias(self, ctx: Context) -> None:
- """Alias for invoking <prefix>site home."""
- await self.invoke(ctx, "site home")
-
- @command(name="faq", hidden=True)
- async def site_faq_alias(self, ctx: Context) -> None:
- """Alias for invoking <prefix>site faq."""
- await self.invoke(ctx, "site faq")
-
- @command(name="rules", aliases=("rule",), hidden=True)
- async def site_rules_alias(self, ctx: Context, rules: Greedy[int], *_: str) -> None:
- """Alias for invoking <prefix>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:
- """Alias for invoking <prefix>extensions reload [extensions...]."""
- await self.invoke(ctx, "extensions reload", *extensions)
-
- @command(name="defon", hidden=True)
- async def defcon_enable_alias(self, ctx: Context) -> None:
- """Alias for invoking <prefix>defcon enable."""
- await self.invoke(ctx, "defcon enable")
-
- @command(name="defoff", hidden=True)
- async def defcon_disable_alias(self, ctx: Context) -> None:
- """Alias for invoking <prefix>defcon disable."""
- await self.invoke(ctx, "defcon disable")
-
@command(name="exception", hidden=True)
async def tags_get_traceback_alias(self, ctx: Context) -> None:
"""Alias for invoking <prefix>tags get traceback."""
@@ -132,21 +81,6 @@ class Alias (Cog):
"""Alias for invoking <prefix>docs get [symbol]."""
await self.invoke(ctx, "docs get", symbol)
- @command(name="nominate", hidden=True)
- async def nomination_add_alias(self, ctx: Context, user: FetchedMember, *, reason: str) -> None:
- """Alias for invoking <prefix>talentpool add [user] [reason]."""
- await self.invoke(ctx, "talentpool add", user, reason=reason)
-
- @command(name="unnominate", hidden=True)
- async def nomination_end_alias(self, ctx: Context, user: FetchedMember, *, reason: str) -> None:
- """Alias for invoking <prefix>nomination end [user] [reason]."""
- await self.invoke(ctx, "nomination end", user, reason=reason)
-
- @command(name="nominees", hidden=True)
- async def nominees_alias(self, ctx: Context) -> None:
- """Alias for invoking <prefix>tp watched."""
- await self.invoke(ctx, "talentpool watched")
-
def setup(bot: Bot) -> None:
"""Load the Alias cog."""
diff --git a/bot/cogs/defcon.py b/bot/cogs/defcon.py
index 4c0ad5914..de0f4545e 100644
--- a/bot/cogs/defcon.py
+++ b/bot/cogs/defcon.py
@@ -162,7 +162,7 @@ class Defcon(Cog):
self.bot.stats.gauge("defcon.threshold", days)
- @defcon_group.command(name='enable', aliases=('on', 'e'))
+ @defcon_group.command(name='enable', aliases=('on', 'e'), root_aliases=("defon",))
@with_role(Roles.admins, Roles.owners)
async def enable_command(self, ctx: Context) -> None:
"""
@@ -175,7 +175,7 @@ class Defcon(Cog):
await self._defcon_action(ctx, days=0, action=Action.ENABLED)
await self.update_channel_topic()
- @defcon_group.command(name='disable', aliases=('off', 'd'))
+ @defcon_group.command(name='disable', aliases=('off', 'd'), root_aliases=("defoff",))
@with_role(Roles.admins, Roles.owners)
async def disable_command(self, ctx: Context) -> None:
"""Disable DEFCON mode. Useful in a pinch, but be sure you know what you're doing!"""
diff --git a/bot/cogs/extensions.py b/bot/cogs/extensions.py
index 365f198ff..396e406b0 100644
--- a/bot/cogs/extensions.py
+++ b/bot/cogs/extensions.py
@@ -107,7 +107,7 @@ class Extensions(commands.Cog):
await ctx.send(msg)
- @extensions_group.command(name="reload", aliases=("r",))
+ @extensions_group.command(name="reload", aliases=("r",), root_aliases=("reload",))
async def reload_command(self, ctx: Context, *extensions: Extension) -> None:
r"""
Reload extensions given their fully qualified or unqualified names.
diff --git a/bot/cogs/site.py b/bot/cogs/site.py
index ac29daa1d..2d3a3d9f3 100644
--- a/bot/cogs/site.py
+++ b/bot/cogs/site.py
@@ -23,7 +23,7 @@ class Site(Cog):
"""Commands for getting info about our website."""
await ctx.send_help(ctx.command)
- @site_group.command(name="home", aliases=("about",))
+ @site_group.command(name="home", aliases=("about",), root_aliases=("home",))
async def site_main(self, ctx: Context) -> None:
"""Info about the website itself."""
url = f"{URLs.site_schema}{URLs.site}/"
@@ -40,7 +40,7 @@ class Site(Cog):
await ctx.send(embed=embed)
- @site_group.command(name="resources")
+ @site_group.command(name="resources", root_aliases=("resources", "resource"))
async def site_resources(self, ctx: Context) -> None:
"""Info about the site's Resources page."""
learning_url = f"{PAGES_URL}/resources"
@@ -56,7 +56,7 @@ class Site(Cog):
await ctx.send(embed=embed)
- @site_group.command(name="tools")
+ @site_group.command(name="tools", root_aliases=("tools",))
async def site_tools(self, ctx: Context) -> None:
"""Info about the site's Tools page."""
tools_url = f"{PAGES_URL}/resources/tools"
@@ -87,7 +87,7 @@ class Site(Cog):
await ctx.send(embed=embed)
- @site_group.command(name="faq")
+ @site_group.command(name="faq", root_aliases=("faq",))
async def site_faq(self, ctx: Context) -> None:
"""Info about the site's FAQ page."""
url = f"{PAGES_URL}/frequently-asked-questions"
@@ -104,7 +104,7 @@ class Site(Cog):
await ctx.send(embed=embed)
- @site_group.command(aliases=['r', 'rule'], name='rules')
+ @site_group.command(name="rules", aliases=("r", "rule"), root_aliases=("rules", "rule"))
async def site_rules(self, ctx: Context, *rules: int) -> None:
"""Provides a link to all rules or, if specified, displays specific rule(s)."""
rules_embed = Embed(title='Rules', color=Colour.blurple())
diff --git a/bot/cogs/watchchannels/bigbrother.py b/bot/cogs/watchchannels/bigbrother.py
index 7aa9cec58..11ab8917a 100644
--- a/bot/cogs/watchchannels/bigbrother.py
+++ b/bot/cogs/watchchannels/bigbrother.py
@@ -59,7 +59,7 @@ class BigBrother(WatchChannel, Cog, name="Big Brother"):
"""
await ctx.invoke(self.watched_command, oldest_first=True, update_cache=update_cache)
- @bigbrother_group.command(name='watch', aliases=('w',))
+ @bigbrother_group.command(name='watch', aliases=('w',), root_aliases=('watch',))
@with_role(*MODERATION_ROLES)
async def watch_command(self, ctx: Context, user: FetchedMember, *, reason: str) -> None:
"""
@@ -70,7 +70,7 @@ class BigBrother(WatchChannel, Cog, name="Big Brother"):
"""
await self.apply_watch(ctx, user, reason)
- @bigbrother_group.command(name='unwatch', aliases=('uw',))
+ @bigbrother_group.command(name='unwatch', aliases=('uw',), root_aliases=('unwatch',))
@with_role(*MODERATION_ROLES)
async def unwatch_command(self, ctx: Context, user: FetchedMember, *, reason: str) -> None:
"""Stop relaying messages by the given `user`."""
diff --git a/bot/cogs/watchchannels/talentpool.py b/bot/cogs/watchchannels/talentpool.py
index a6df84c23..76d6fe9bd 100644
--- a/bot/cogs/watchchannels/talentpool.py
+++ b/bot/cogs/watchchannels/talentpool.py
@@ -37,7 +37,7 @@ class TalentPool(WatchChannel, Cog, name="Talentpool"):
"""Highlights the activity of helper nominees by relaying their messages to the talent pool channel."""
await ctx.send_help(ctx.command)
- @nomination_group.command(name='watched', aliases=('all', 'list'))
+ @nomination_group.command(name='watched', aliases=('all', 'list'), root_aliases=("nominees",))
@with_role(*MODERATION_ROLES)
async def watched_command(
self, ctx: Context, oldest_first: bool = False, update_cache: bool = True
@@ -63,7 +63,7 @@ class TalentPool(WatchChannel, Cog, name="Talentpool"):
"""
await ctx.invoke(self.watched_command, oldest_first=True, update_cache=update_cache)
- @nomination_group.command(name='watch', aliases=('w', 'add', 'a'))
+ @nomination_group.command(name='watch', aliases=('w', 'add', 'a'), root_aliases=("nominate",))
@with_role(*STAFF_ROLES)
async def watch_command(self, ctx: Context, user: FetchedMember, *, reason: str) -> None:
"""
@@ -157,7 +157,7 @@ class TalentPool(WatchChannel, Cog, name="Talentpool"):
max_size=1000
)
- @nomination_group.command(name='unwatch', aliases=('end', ))
+ @nomination_group.command(name='unwatch', aliases=('end', ), root_aliases=("unnominate",))
@with_role(*MODERATION_ROLES)
async def unwatch_command(self, ctx: Context, user: FetchedMember, *, reason: str) -> None:
"""