autohelp changes. (#1836)

This commit is contained in:
Michael H 2018-07-11 19:23:18 -04:00 committed by Kowlin
parent 43cc3c40f3
commit 1c2196f78f
19 changed files with 38 additions and 38 deletions

View File

@ -156,7 +156,7 @@ class Admin:
else: else:
await self.complain(ctx, USER_HIERARCHY_ISSUE) await self.complain(ctx, USER_HIERARCHY_ISSUE)
@commands.group(autohelp=True) @commands.group()
@commands.guild_only() @commands.guild_only()
@checks.admin_or_permissions(manage_roles=True) @checks.admin_or_permissions(manage_roles=True)
async def editrole(self, ctx: commands.Context): async def editrole(self, ctx: commands.Context):

View File

@ -170,13 +170,13 @@ class Alias:
new_message.content = "{}{} {}".format(prefix, alias.command, args) new_message.content = "{}{} {}".format(prefix, alias.command, args)
await self.bot.process_commands(new_message) await self.bot.process_commands(new_message)
@commands.group(autohelp=True) @commands.group()
@commands.guild_only() @commands.guild_only()
async def alias(self, ctx: commands.Context): async def alias(self, ctx: commands.Context):
"""Manage per-server aliases for commands""" """Manage per-server aliases for commands"""
pass pass
@alias.group(name="global", autohelp=True) @alias.group(name="global")
async def global_(self, ctx: commands.Context): async def global_(self, ctx: commands.Context):
""" """
Manage global aliases. Manage global aliases.

View File

@ -166,7 +166,7 @@ class Audio:
await message_channel.send(embed=embed) await message_channel.send(embed=embed)
await player.skip() await player.skip()
@commands.group(autohelp=True) @commands.group()
@commands.guild_only() @commands.guild_only()
async def audioset(self, ctx): async def audioset(self, ctx):
"""Music configuration options.""" """Music configuration options."""
@ -657,7 +657,7 @@ class Audio:
await player.play() await player.play()
await ctx.send(embed=embed) await ctx.send(embed=embed)
@commands.group(autohelp=True) @commands.group()
@commands.guild_only() @commands.guild_only()
async def playlist(self, ctx): async def playlist(self, ctx):
"""Playlist configuration options.""" """Playlist configuration options."""
@ -1622,7 +1622,7 @@ class Audio:
embed.set_footer(text="Nothing playing.") embed.set_footer(text="Nothing playing.")
await ctx.send(embed=embed) await ctx.send(embed=embed)
@commands.group(aliases=["llset"], autohelp=True) @commands.group(aliases=["llset"])
@commands.guild_only() @commands.guild_only()
@checks.is_owner() @checks.is_owner()
async def llsetup(self, ctx): async def llsetup(self, ctx):

View File

@ -58,7 +58,7 @@ class Bank:
# SECTION commands # SECTION commands
@commands.group(autohelp=True) @commands.group()
@checks.guildowner_or_permissions(administrator=True) @checks.guildowner_or_permissions(administrator=True)
async def bankset(self, ctx: commands.Context): async def bankset(self, ctx: commands.Context):
"""Base command for bank settings""" """Base command for bank settings"""

View File

@ -92,7 +92,7 @@ class Cleanup:
before = message before = message
return to_delete return to_delete
@commands.group(autohelp=True) @commands.group()
@checks.mod_or_permissions(manage_messages=True) @checks.mod_or_permissions(manage_messages=True)
async def cleanup(self, ctx: commands.Context): async def cleanup(self, ctx: commands.Context):
"""Deletes messages.""" """Deletes messages."""

View File

@ -141,13 +141,13 @@ class CustomCommands:
self.config.register_guild(commands={}) self.config.register_guild(commands={})
self.commandobj = CommandObj(config=self.config, bot=self.bot) self.commandobj = CommandObj(config=self.config, bot=self.bot)
@commands.group(aliases=["cc"], autohelp=True) @commands.group(aliases=["cc"])
@commands.guild_only() @commands.guild_only()
async def customcom(self, ctx: commands.Context): async def customcom(self, ctx: commands.Context):
"""Custom commands management""" """Custom commands management"""
pass pass
@customcom.group(name="add", autohelp=True) @customcom.group(name="add")
@checks.mod_or_permissions(administrator=True) @checks.mod_or_permissions(administrator=True)
async def cc_add(self, ctx: commands.Context): async def cc_add(self, ctx: commands.Context):
""" """

View File

@ -204,7 +204,7 @@ class Downloader:
) )
) )
@commands.group(autohelp=True) @commands.group()
@checks.is_owner() @checks.is_owner()
async def repo(self, ctx): async def repo(self, ctx):
""" """
@ -272,7 +272,7 @@ class Downloader:
msg = _("Information on {}:\n{}").format(repo_name.name, repo_name.description or "") msg = _("Information on {}:\n{}").format(repo_name.name, repo_name.description or "")
await ctx.send(box(msg)) await ctx.send(box(msg))
@commands.group(autohelp=True) @commands.group()
@checks.is_owner() @checks.is_owner()
async def cog(self, ctx): async def cog(self, ctx):
""" """

View File

@ -137,7 +137,7 @@ class Economy:
self.config.register_role(**self.default_role_settings) self.config.register_role(**self.default_role_settings)
self.slot_register = defaultdict(dict) self.slot_register = defaultdict(dict)
@commands.group(name="bank", autohelp=True) @commands.group(name="bank")
async def _bank(self, ctx: commands.Context): async def _bank(self, ctx: commands.Context):
"""Bank operations""" """Bank operations"""
pass pass
@ -438,7 +438,7 @@ class Economy:
) )
) )
@commands.group(autohelp=True) @commands.group()
@guild_only_check() @guild_only_check()
@check_global_setting_admin() @check_global_setting_admin()
async def economyset(self, ctx: commands.Context): async def economyset(self, ctx: commands.Context):

View File

@ -39,7 +39,7 @@ class Filter:
except RuntimeError: except RuntimeError:
pass pass
@commands.group(name="filter", autohelp=True) @commands.group(name="filter")
@commands.guild_only() @commands.guild_only()
@checks.mod_or_permissions(manage_messages=True) @checks.mod_or_permissions(manage_messages=True)
async def _filter(self, ctx: commands.Context): async def _filter(self, ctx: commands.Context):

View File

@ -26,7 +26,7 @@ class Image:
def __unload(self): def __unload(self):
self.session.close() self.session.close()
@commands.group(name="imgur", autohelp=True) @commands.group(name="imgur")
async def _imgur(self, ctx): async def _imgur(self, ctx):
"""Retrieves pictures from imgur """Retrieves pictures from imgur

View File

@ -161,7 +161,7 @@ class Mod:
except RuntimeError: except RuntimeError:
pass pass
@commands.group(autohelp=True) @commands.group()
@commands.guild_only() @commands.guild_only()
@checks.guildowner_or_permissions(administrator=True) @checks.guildowner_or_permissions(administrator=True)
async def modset(self, ctx: commands.Context): async def modset(self, ctx: commands.Context):
@ -832,7 +832,7 @@ class Mod:
_("I cannot do that, I lack the '{}' permission.").format("Manage Nicknames") _("I cannot do that, I lack the '{}' permission.").format("Manage Nicknames")
) )
@commands.group(autohelp=True) @commands.group()
@commands.guild_only() @commands.guild_only()
@checks.mod_or_permissions(manage_channel=True) @checks.mod_or_permissions(manage_channel=True)
async def mute(self, ctx: commands.Context): async def mute(self, ctx: commands.Context):
@ -998,7 +998,7 @@ class Mod:
await self.settings.member(user).perms_cache.set(perms_cache) await self.settings.member(user).perms_cache.set(perms_cache)
return True, None return True, None
@commands.group(autohelp=True) @commands.group()
@commands.guild_only() @commands.guild_only()
@checks.mod_or_permissions(manage_channel=True) @checks.mod_or_permissions(manage_channel=True)
async def unmute(self, ctx: commands.Context): async def unmute(self, ctx: commands.Context):
@ -1164,7 +1164,7 @@ class Mod:
await self.settings.member(user).perms_cache.set(perms_cache) await self.settings.member(user).perms_cache.set(perms_cache)
return True, None return True, None
@commands.group(autohelp=True) @commands.group()
@commands.guild_only() @commands.guild_only()
@checks.admin_or_permissions(manage_channels=True) @checks.admin_or_permissions(manage_channels=True)
async def ignore(self, ctx: commands.Context): async def ignore(self, ctx: commands.Context):
@ -1196,7 +1196,7 @@ class Mod:
else: else:
await ctx.send(_("This server is already being ignored.")) await ctx.send(_("This server is already being ignored."))
@commands.group(autohelp=True) @commands.group()
@commands.guild_only() @commands.guild_only()
@checks.admin_or_permissions(manage_channels=True) @checks.admin_or_permissions(manage_channels=True)
async def unignore(self, ctx: commands.Context): async def unignore(self, ctx: commands.Context):

View File

@ -15,7 +15,7 @@ class ModLog:
def __init__(self, bot: Red): def __init__(self, bot: Red):
self.bot = bot self.bot = bot
@commands.group(autohelp=True) @commands.group()
@checks.guildowner_or_permissions(administrator=True) @checks.guildowner_or_permissions(administrator=True)
async def modlogset(self, ctx: commands.Context): async def modlogset(self, ctx: commands.Context):
"""Settings for the mod log""" """Settings for the mod log"""

View File

@ -125,7 +125,7 @@ class Permissions:
# async def admin_model(self, ctx: commands.Context) -> bool: # async def admin_model(self, ctx: commands.Context) -> bool:
# async def mod_model(self, ctx: commands.Context) -> bool: # async def mod_model(self, ctx: commands.Context) -> bool:
@commands.group(aliases=["p"], autohelp=True) @commands.group(aliases=["p"])
async def permissions(self, ctx: commands.Context): async def permissions(self, ctx: commands.Context):
""" """
Permission management tools Permission management tools

View File

@ -56,7 +56,7 @@ class Reports:
@checks.admin_or_permissions(manage_guild=True) @checks.admin_or_permissions(manage_guild=True)
@commands.guild_only() @commands.guild_only()
@commands.group(name="reportset", autohelp=True) @commands.group(name="reportset")
async def reportset(self, ctx: commands.Context): async def reportset(self, ctx: commands.Context):
""" """
settings for reports settings for reports

View File

@ -135,13 +135,13 @@ class Streams:
else: else:
await ctx.send(embed=embed) await ctx.send(embed=embed)
@commands.group(autohelp=True) @commands.group()
@commands.guild_only() @commands.guild_only()
@checks.mod() @checks.mod()
async def streamalert(self, ctx: commands.Context): async def streamalert(self, ctx: commands.Context):
pass pass
@streamalert.group(name="twitch", autohelp=True) @streamalert.group(name="twitch")
async def _twitch(self, ctx: commands.Context): async def _twitch(self, ctx: commands.Context):
"""Twitch stream alerts""" """Twitch stream alerts"""
pass pass
@ -294,7 +294,7 @@ class Streams:
await self.add_or_remove_community(ctx, community) await self.add_or_remove_community(ctx, community)
@commands.group(autohelp=True) @commands.group()
@checks.mod() @checks.mod()
async def streamset(self, ctx: commands.Context): async def streamset(self, ctx: commands.Context):
pass pass
@ -333,7 +333,7 @@ class Streams:
await self.db.tokens.set_raw("YoutubeStream", value=key) await self.db.tokens.set_raw("YoutubeStream", value=key)
await ctx.send(_("Youtube key set.")) await ctx.send(_("Youtube key set."))
@streamset.group(autohelp=True) @streamset.group()
@commands.guild_only() @commands.guild_only()
async def mention(self, ctx: commands.Context): async def mention(self, ctx: commands.Context):
"""Sets mentions for stream alerts.""" """Sets mentions for stream alerts."""

View File

@ -41,7 +41,7 @@ class Trivia:
self.conf.register_member(wins=0, games=0, total_score=0) self.conf.register_member(wins=0, games=0, total_score=0)
@commands.group(autohelp=True) @commands.group()
@commands.guild_only() @commands.guild_only()
@checks.mod_or_permissions(administrator=True) @checks.mod_or_permissions(administrator=True)
async def triviaset(self, ctx: commands.Context): async def triviaset(self, ctx: commands.Context):

View File

@ -41,7 +41,7 @@ class Warnings:
except RuntimeError: except RuntimeError:
pass pass
@commands.group(autohelp=True) @commands.group()
@commands.guild_only() @commands.guild_only()
@checks.guildowner_or_permissions(administrator=True) @checks.guildowner_or_permissions(administrator=True)
async def warningset(self, ctx: commands.Context): async def warningset(self, ctx: commands.Context):
@ -58,7 +58,7 @@ class Warnings:
_("Custom reasons have been {}.").format(_("enabled") if allowed else _("disabled")) _("Custom reasons have been {}.").format(_("enabled") if allowed else _("disabled"))
) )
@commands.group(autohelp=True) @commands.group()
@commands.guild_only() @commands.guild_only()
@checks.guildowner_or_permissions(administrator=True) @checks.guildowner_or_permissions(administrator=True)
async def warnaction(self, ctx: commands.Context): async def warnaction(self, ctx: commands.Context):
@ -134,7 +134,7 @@ class Warnings:
else: else:
await ctx.send(_("No action named {} exists!").format(action_name)) await ctx.send(_("No action named {} exists!").format(action_name))
@commands.group(autohelp=True) @commands.group()
@commands.guild_only() @commands.guild_only()
@checks.guildowner_or_permissions(administrator=True) @checks.guildowner_or_permissions(administrator=True)
async def warnreason(self, ctx: commands.Context): async def warnreason(self, ctx: commands.Context):

View File

@ -137,7 +137,7 @@ class Group(Command, commands.Group):
""" """
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
self.autohelp = kwargs.pop("autohelp", False) self.autohelp = kwargs.pop("autohelp", True)
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
async def invoke(self, ctx): async def invoke(self, ctx):

View File

@ -321,7 +321,7 @@ class Core(CoreLogic):
return fmt.format(d=days, h=hours, m=minutes, s=seconds) return fmt.format(d=days, h=hours, m=minutes, s=seconds)
@commands.group(autohelp=True) @commands.group()
async def embedset(self, ctx: commands.Context): async def embedset(self, ctx: commands.Context):
""" """
Commands for toggling embeds on or off. Commands for toggling embeds on or off.
@ -598,7 +598,7 @@ class Core(CoreLogic):
pass pass
await ctx.bot.shutdown(restart=True) await ctx.bot.shutdown(restart=True)
@commands.group(name="set", autohelp=True) @commands.group(name="set")
async def _set(self, ctx): async def _set(self, ctx):
"""Changes Red's settings""" """Changes Red's settings"""
if ctx.invoked_subcommand is None: if ctx.invoked_subcommand is None:
@ -981,7 +981,7 @@ class Core(CoreLogic):
ctx.bot.disable_sentry() ctx.bot.disable_sentry()
await ctx.send(_("Done. Sentry logging is now disabled.")) await ctx.send(_("Done. Sentry logging is now disabled."))
@commands.group(autohelp=True) @commands.group()
@checks.is_owner() @checks.is_owner()
async def helpset(self, ctx: commands.Context): async def helpset(self, ctx: commands.Context):
"""Manage settings for the help command.""" """Manage settings for the help command."""
@ -1264,7 +1264,7 @@ class Core(CoreLogic):
else: else:
await ctx.send(_("Message delivered to {}").format(destination)) await ctx.send(_("Message delivered to {}").format(destination))
@commands.group(autohelp=True) @commands.group()
@checks.is_owner() @checks.is_owner()
async def whitelist(self, ctx): async def whitelist(self, ctx):
""" """
@ -1322,7 +1322,7 @@ class Core(CoreLogic):
await ctx.bot.db.whitelist.set([]) await ctx.bot.db.whitelist.set([])
await ctx.send(_("Whitelist has been cleared.")) await ctx.send(_("Whitelist has been cleared."))
@commands.group(autohelp=True) @commands.group()
@checks.is_owner() @checks.is_owner()
async def blacklist(self, ctx): async def blacklist(self, ctx):
""" """