Use the commands module instead of checks for permission decorators (#5463)

Co-authored-by: Flame442 <34169552+Flame442@users.noreply.github.com>
This commit is contained in:
Kreusada
2023-04-13 19:16:12 +01:00
committed by GitHub
parent a70f444255
commit 79d11e947c
35 changed files with 238 additions and 249 deletions

View File

@@ -44,7 +44,6 @@ from redbot.core.data_manager import storage_type
from . import (
__version__,
version_info as red_version_info,
checks,
commands,
errors,
i18n,
@@ -792,7 +791,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
)
)
@checks.is_owner()
@commands.is_owner()
@mydata.group(name="ownermanagement")
async def mydata_owner_management(self, ctx: commands.Context):
"""
@@ -1176,7 +1175,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
await ctx.send(box(text))
@embedset.command(name="global")
@checks.is_owner()
@commands.is_owner()
async def embedset_global(self, ctx: commands.Context):
"""
Toggle the global embed setting.
@@ -1198,7 +1197,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
await ctx.send(_("Embeds are now enabled by default."))
@embedset.command(name="server", aliases=["guild"])
@checks.guildowner_or_permissions(administrator=True)
@commands.guildowner_or_permissions(administrator=True)
@commands.guild_only()
async def embedset_guild(self, ctx: commands.Context, enabled: bool = None):
"""
@@ -1230,7 +1229,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
else _("Embeds are now disabled for this guild.")
)
@checks.guildowner_or_permissions(administrator=True)
@commands.guildowner_or_permissions(administrator=True)
@embedset.group(name="command", invoke_without_command=True)
async def embedset_command(
self, ctx: commands.Context, command: CommandConverter, enabled: bool = None
@@ -1361,7 +1360,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
)
@embedset.command(name="channel")
@checks.guildowner_or_permissions(administrator=True)
@commands.guildowner_or_permissions(administrator=True)
@commands.guild_only()
async def embedset_channel(
self,
@@ -1432,7 +1431,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
)
@commands.command()
@checks.is_owner()
@commands.is_owner()
async def traceback(self, ctx: commands.Context, public: bool = False):
"""Sends to the owner the last command exception that has occurred.
@@ -1497,7 +1496,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
)
@commands.group()
@checks.is_owner()
@commands.is_owner()
async def inviteset(self, ctx):
"""Commands to setup [botname]'s invite settings."""
pass
@@ -1581,7 +1580,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
)
@commands.command()
@checks.is_owner()
@commands.is_owner()
async def leave(self, ctx: commands.Context, *servers: GuildConverter):
"""
Leaves servers.
@@ -1665,7 +1664,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
await ctx.send(_("Alright, I'm not leaving that server."))
@commands.command()
@checks.is_owner()
@commands.is_owner()
async def servers(self, ctx: commands.Context):
"""
Lists the servers [botname] is currently in.
@@ -1685,7 +1684,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
await menu(ctx, pages)
@commands.command(require_var_positional=True)
@checks.is_owner()
@commands.is_owner()
async def load(self, ctx: commands.Context, *cogs: str):
"""Loads cog packages from the local paths and installed cogs.
@@ -1798,7 +1797,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
await ctx.send(page)
@commands.command(require_var_positional=True)
@checks.is_owner()
@commands.is_owner()
async def unload(self, ctx: commands.Context, *cogs: str):
"""Unloads previously loaded cog packages.
@@ -1844,7 +1843,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
await ctx.send(page)
@commands.command(require_var_positional=True)
@checks.is_owner()
@commands.is_owner()
async def reload(self, ctx: commands.Context, *cogs: str):
"""Reloads cog packages.
@@ -1947,7 +1946,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
# TODO: Guild owner permissions for guild scope slash commands and syncing?
@commands.group()
@checks.is_owner()
@commands.is_owner()
async def slash(self, ctx: commands.Context):
"""Base command for managing what application commands are able to be used on [botname]."""
@@ -2330,7 +2329,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
)
@commands.command(name="shutdown")
@checks.is_owner()
@commands.is_owner()
async def _shutdown(self, ctx: commands.Context, silently: bool = False):
"""Shuts down the bot.
@@ -2353,7 +2352,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
await ctx.bot.shutdown()
@commands.command(name="restart")
@checks.is_owner()
@commands.is_owner()
async def _restart(self, ctx: commands.Context, silently: bool = False):
"""Attempts to restart [botname].
@@ -2373,7 +2372,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
await ctx.bot.shutdown(restart=True)
@bank.is_owner_if_bank_global()
@checks.guildowner_or_permissions(administrator=True)
@commands.guildowner_or_permissions(administrator=True)
@commands.group()
async def bankset(self, ctx: commands.Context):
"""Base command for bank settings."""
@@ -2409,7 +2408,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
await ctx.send(box(settings))
@bankset.command(name="toggleglobal")
@checks.is_owner()
@commands.is_owner()
async def bankset_toggleglobal(self, ctx: commands.Context, confirm: bool = False):
"""Toggle whether the bank is global or not.
@@ -2431,7 +2430,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
await ctx.send(_("The bank is now {banktype}.").format(banktype=word))
@bank.is_owner_if_bank_global()
@checks.guildowner_or_permissions(administrator=True)
@commands.guildowner_or_permissions(administrator=True)
@bankset.command(name="bankname")
async def bankset_bankname(self, ctx: commands.Context, *, name: str):
"""Set the bank's name."""
@@ -2439,7 +2438,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
await ctx.send(_("Bank name has been set to: {name}").format(name=name))
@bank.is_owner_if_bank_global()
@checks.guildowner_or_permissions(administrator=True)
@commands.guildowner_or_permissions(administrator=True)
@bankset.command(name="creditsname")
async def bankset_creditsname(self, ctx: commands.Context, *, name: str):
"""Set the name for the bank's currency."""
@@ -2447,7 +2446,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
await ctx.send(_("Currency name has been set to: {name}").format(name=name))
@bank.is_owner_if_bank_global()
@checks.guildowner_or_permissions(administrator=True)
@commands.guildowner_or_permissions(administrator=True)
@bankset.command(name="maxbal")
async def bankset_maxbal(self, ctx: commands.Context, *, amount: int):
"""Set the maximum balance a user can get."""
@@ -2465,7 +2464,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
)
@bank.is_owner_if_bank_global()
@checks.guildowner_or_permissions(administrator=True)
@commands.guildowner_or_permissions(administrator=True)
@bankset.command(name="registeramount")
async def bankset_registeramount(self, ctx: commands.Context, creds: int):
"""Set the initial balance for new bank accounts.
@@ -2495,7 +2494,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
)
@bank.is_owner_if_bank_global()
@checks.guildowner_or_permissions(administrator=True)
@commands.guildowner_or_permissions(administrator=True)
@bankset.command(name="reset")
async def bankset_reset(self, ctx, confirmation: bool = False):
"""Delete all bank accounts.
@@ -2527,7 +2526,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
)
@bank.is_owner_if_bank_global()
@checks.admin_or_permissions(manage_guild=True)
@commands.admin_or_permissions(manage_guild=True)
@bankset.group(name="prune")
async def bankset_prune(self, ctx):
"""Base command for pruning bank accounts."""
@@ -2535,7 +2534,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
@bankset_prune.command(name="server", aliases=["guild", "local"])
@commands.guild_only()
@checks.guildowner()
@commands.guildowner()
async def bankset_prune_local(self, ctx, confirmation: bool = False):
"""Prune bank accounts for users no longer in the server.
@@ -2568,7 +2567,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
)
@bankset_prune.command(name="global")
@checks.is_owner()
@commands.is_owner()
async def bankset_prune_global(self, ctx, confirmation: bool = False):
"""Prune bank accounts for users who no longer share a server with the bot.
@@ -2641,12 +2640,12 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
await ctx.send(_("The bank account for {name} has been pruned.").format(name=name))
@commands.group()
@checks.guildowner_or_permissions(administrator=True)
@commands.guildowner_or_permissions(administrator=True)
async def modlogset(self, ctx: commands.Context):
"""Manage modlog settings."""
pass
@checks.is_owner()
@commands.is_owner()
@modlogset.command(hidden=True, name="fixcasetypes")
async def modlogset_fixcasetypes(self, ctx: commands.Context):
"""Command to fix misbehaving casetypes."""
@@ -2749,11 +2748,11 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
# -- Bot Metadata Commands -- ###
@_set.group(name="bot", aliases=["metadata"])
@checks.admin_or_permissions(manage_nicknames=True)
@commands.admin_or_permissions(manage_nicknames=True)
async def _set_bot(self, ctx: commands.Context):
"""Commands for changing [botname]'s metadata."""
@checks.is_owner()
@commands.is_owner()
@_set_bot.command(name="description")
async def _set_bot_description(self, ctx: commands.Context, *, description: str = ""):
"""
@@ -2790,7 +2789,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
await ctx.tick()
@_set_bot.group(name="avatar", invoke_without_command=True)
@checks.is_owner()
@commands.is_owner()
async def _set_bot_avatar(self, ctx: commands.Context, url: str = None):
"""Sets [botname]'s avatar
@@ -2839,7 +2838,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
await ctx.send(_("Done."))
@_set_bot_avatar.command(name="remove", aliases=["clear"])
@checks.is_owner()
@commands.is_owner()
async def _set_bot_avatar_remove(self, ctx: commands.Context):
"""
Removes [botname]'s avatar.
@@ -2852,7 +2851,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
await ctx.send(_("Avatar removed."))
@_set_bot.command(name="username", aliases=["name"])
@checks.is_owner()
@commands.is_owner()
async def _set_bot_username(self, ctx: commands.Context, *, username: str):
"""Sets [botname]'s username.
@@ -2908,7 +2907,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
await ctx.send(_("Done."))
@_set_bot.command(name="nickname")
@checks.admin_or_permissions(manage_nicknames=True)
@commands.admin_or_permissions(manage_nicknames=True)
@commands.guild_only()
async def _set_bot_nickname(self, ctx: commands.Context, *, nickname: str = None):
"""Sets [botname]'s nickname for the current server.
@@ -2932,7 +2931,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
await ctx.send(_("Done."))
@_set_bot.command(name="custominfo")
@checks.is_owner()
@commands.is_owner()
async def _set_bot_custominfo(self, ctx: commands.Context, *, text: str = None):
"""Customizes a section of `[p]info`.
@@ -2964,16 +2963,16 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
# -- Bot Status Commands -- ###
@_set.group(name="status")
@checks.bot_in_a_guild()
@checks.is_owner()
@commands.bot_in_a_guild()
@commands.is_owner()
async def _set_status(self, ctx: commands.Context):
"""Commands for setting [botname]'s status."""
@_set_status.command(
name="streaming", aliases=["stream", "twitch"], usage="[(<streamer> <stream_title>)]"
)
@checks.bot_in_a_guild()
@checks.is_owner()
@commands.bot_in_a_guild()
@commands.is_owner()
async def _set_status_stream(self, ctx: commands.Context, streamer=None, *, stream_title=None):
"""Sets [botname]'s streaming status to a twitch stream.
@@ -3014,8 +3013,8 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
await ctx.send(_("Done."))
@_set_status.command(name="playing", aliases=["game"])
@checks.bot_in_a_guild()
@checks.is_owner()
@commands.bot_in_a_guild()
@commands.is_owner()
async def _set_status_game(self, ctx: commands.Context, *, game: str = None):
"""Sets [botname]'s playing status.
@@ -3046,8 +3045,8 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
await ctx.send(_("Game cleared."))
@_set_status.command(name="listening")
@checks.bot_in_a_guild()
@checks.is_owner()
@commands.bot_in_a_guild()
@commands.is_owner()
async def _set_status_listening(self, ctx: commands.Context, *, listening: str = None):
"""Sets [botname]'s listening status.
@@ -3082,8 +3081,8 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
await ctx.send(_("Listening cleared."))
@_set_status.command(name="watching")
@checks.bot_in_a_guild()
@checks.is_owner()
@commands.bot_in_a_guild()
@commands.is_owner()
async def _set_status_watching(self, ctx: commands.Context, *, watching: str = None):
"""Sets [botname]'s watching status.
@@ -3114,8 +3113,8 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
await ctx.send(_("Watching cleared."))
@_set_status.command(name="competing")
@checks.bot_in_a_guild()
@checks.is_owner()
@commands.bot_in_a_guild()
@commands.is_owner()
async def _set_status_competing(self, ctx: commands.Context, *, competing: str = None):
"""Sets [botname]'s competing status.
@@ -3155,29 +3154,29 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
return await ctx.send(_("Status changed to {}.").format(status))
@_set_status.command(name="online")
@checks.bot_in_a_guild()
@checks.is_owner()
@commands.bot_in_a_guild()
@commands.is_owner()
async def _set_status_online(self, ctx: commands.Context):
"""Set [botname]'s status to online."""
await self._set_my_status(ctx, discord.Status.online)
@_set_status.command(name="dnd", aliases=["donotdisturb", "busy"])
@checks.bot_in_a_guild()
@checks.is_owner()
@commands.bot_in_a_guild()
@commands.is_owner()
async def _set_status_dnd(self, ctx: commands.Context):
"""Set [botname]'s status to do not disturb."""
await self._set_my_status(ctx, discord.Status.do_not_disturb)
@_set_status.command(name="idle", aliases=["away", "afk"])
@checks.bot_in_a_guild()
@checks.is_owner()
@commands.bot_in_a_guild()
@commands.is_owner()
async def _set_status_idle(self, ctx: commands.Context):
"""Set [botname]'s status to idle."""
await self._set_my_status(ctx, discord.Status.idle)
@_set_status.command(name="invisible", aliases=["offline"])
@checks.bot_in_a_guild()
@checks.is_owner()
@commands.bot_in_a_guild()
@commands.is_owner()
async def _set_status_invisible(self, ctx: commands.Context):
"""Set [botname]'s status to invisible."""
await self._set_my_status(ctx, discord.Status.invisible)
@@ -3186,13 +3185,13 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
# -- Bot Roles Commands -- ###
@_set.group(name="roles")
@checks.guildowner()
@commands.guildowner()
@commands.guild_only()
async def _set_roles(self, ctx: commands.Context):
"""Set server's admin and mod roles for [botname]."""
@_set_roles.command(name="addadminrole")
@checks.guildowner()
@commands.guildowner()
@commands.guild_only()
async def _set_roles_addadminrole(self, ctx: commands.Context, *, role: discord.Role):
"""
@@ -3220,7 +3219,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
await ctx.send(_("That role is now considered an admin role."))
@_set_roles.command(name="addmodrole")
@checks.guildowner()
@commands.guildowner()
@commands.guild_only()
async def _set_roles_addmodrole(self, ctx: commands.Context, *, role: discord.Role):
"""
@@ -3249,7 +3248,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
@_set_roles.command(
name="removeadminrole", aliases=["remadmindrole", "deladminrole", "deleteadminrole"]
)
@checks.guildowner()
@commands.guildowner()
@commands.guild_only()
async def _set_roles_removeadminrole(self, ctx: commands.Context, *, role: discord.Role):
"""
@@ -3271,7 +3270,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
@_set_roles.command(
name="removemodrole", aliases=["remmodrole", "delmodrole", "deletemodrole"]
)
@checks.guildowner()
@commands.guildowner()
@commands.guild_only()
async def _set_roles_removemodrole(self, ctx: commands.Context, *, role: discord.Role):
"""
@@ -3294,7 +3293,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
# -- Set Locale Commands -- ###
@_set.group(name="locale", invoke_without_command=True)
@checks.guildowner_or_permissions(manage_guild=True)
@commands.guildowner_or_permissions(manage_guild=True)
async def _set_locale(self, ctx: commands.Context, language_code: str):
"""
Changes [botname]'s locale in this server.
@@ -3321,7 +3320,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
await ctx.invoke(self._set_locale_local, language_code)
@_set_locale.command(name="global")
@checks.is_owner()
@commands.is_owner()
async def _set_locale_global(self, ctx: commands.Context, language_code: str):
"""
Changes [botname]'s default locale.
@@ -3359,7 +3358,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
@_set_locale.command(name="server", aliases=["local", "guild"])
@commands.guild_only()
@checks.guildowner_or_permissions(manage_guild=True)
@commands.guildowner_or_permissions(manage_guild=True)
async def _set_locale_local(self, ctx: commands.Context, language_code: str):
"""
Changes [botname]'s locale in this server.
@@ -3400,7 +3399,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
await ctx.send(_("Locale has been set."))
@_set.group(name="regionalformat", aliases=["region"], invoke_without_command=True)
@checks.guildowner_or_permissions(manage_guild=True)
@commands.guildowner_or_permissions(manage_guild=True)
async def _set_regional_format(self, ctx: commands.Context, language_code: str):
"""
Changes the bot's regional format in this server. This is used for formatting date, time and numbers.
@@ -3424,7 +3423,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
await ctx.invoke(self._set_regional_format_local, language_code)
@_set_regional_format.command(name="global")
@checks.is_owner()
@commands.is_owner()
async def _set_regional_format_global(self, ctx: commands.Context, language_code: str):
"""
Changes the bot's regional format. This is used for formatting date, time and numbers.
@@ -3467,7 +3466,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
@_set_regional_format.command(name="server", aliases=["local", "guild"])
@commands.guild_only()
@checks.guildowner_or_permissions(manage_guild=True)
@commands.guildowner_or_permissions(manage_guild=True)
async def _set_regional_format_local(self, ctx: commands.Context, language_code: str):
"""
Changes the bot's regional format in this server. This is used for formatting date, time and numbers.
@@ -3514,7 +3513,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
# -- Set Api Commands -- ###
@_set.group(name="api", invoke_without_command=True)
@checks.is_owner()
@commands.is_owner()
async def _set_api(
self,
ctx: commands.Context,
@@ -3614,7 +3613,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
# -- End Set Api Commands -- ###
# -- Set Ownernotifications Commands -- ###
@checks.is_owner()
@commands.is_owner()
@_set.group(name="ownernotifications")
async def _set_ownernotifications(self, ctx: commands.Context):
"""
@@ -3806,7 +3805,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
for page in pagify(settings):
await ctx.send(box(page))
@checks.guildowner_or_permissions(administrator=True)
@commands.guildowner_or_permissions(administrator=True)
@_set.command(name="deletedelay")
@commands.guild_only()
async def _set_deletedelay(self, ctx: commands.Context, time: int = None):
@@ -3848,7 +3847,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
await ctx.send(_("I will not delete command messages."))
@_set.command(name="usebotcolour", aliases=["usebotcolor"])
@checks.guildowner()
@commands.guildowner()
@commands.guild_only()
async def _set_usebotcolour(self, ctx: commands.Context):
"""
@@ -3869,7 +3868,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
)
@_set.command(name="serverfuzzy")
@checks.guildowner()
@commands.guildowner()
@commands.guild_only()
async def _set_serverfuzzy(self, ctx: commands.Context):
"""
@@ -3893,7 +3892,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
)
@_set.command(name="fuzzy")
@checks.is_owner()
@commands.is_owner()
async def _set_fuzzy(self, ctx: commands.Context):
"""
Toggle whether to enable fuzzy command search in DMs.
@@ -3914,7 +3913,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
)
@_set.command(name="colour", aliases=["color"])
@checks.is_owner()
@commands.is_owner()
async def _set_colour(self, ctx: commands.Context, *, colour: discord.Colour = None):
"""
Sets a default colour to be used for the bot's embeds.
@@ -3946,7 +3945,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
aliases=["prefixes", "globalprefix", "globalprefixes"],
require_var_positional=True,
)
@checks.is_owner()
@commands.is_owner()
async def _set_prefix(self, ctx: commands.Context, *prefixes: str):
"""Sets [botname]'s global prefix(es).
@@ -3993,7 +3992,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
await ctx.send(_("Prefixes set."))
@_set.command(name="serverprefix", aliases=["serverprefixes"])
@checks.admin_or_permissions(manage_guild=True)
@commands.admin_or_permissions(manage_guild=True)
async def _set_serverprefix(
self, ctx: commands.Context, server: Optional[discord.Guild], *prefixes: str
):
@@ -4037,7 +4036,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
await ctx.send(_("Server prefixes set."))
@_set.command(name="usebuttons")
@checks.is_owner()
@commands.is_owner()
async def _set_usebuttons(self, ctx: commands.Context, use_buttons: bool = None):
"""
Set a global bot variable for using buttons in menus.
@@ -4092,7 +4091,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
await ctx.send(content)
@commands.group()
@checks.is_owner()
@commands.is_owner()
async def helpset(self, ctx: commands.Context):
"""
Commands to manage settings for the help command.
@@ -4557,7 +4556,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
await ctx.send(_("I'm unable to deliver your message. Sorry."))
@commands.command()
@checks.is_owner()
@commands.is_owner()
async def dm(self, ctx: commands.Context, user_id: int, *, message: str):
"""Sends a DM to a user.
@@ -4613,7 +4612,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
await ctx.send(_("Message delivered to {}").format(destination))
@commands.command(hidden=True)
@checks.is_owner()
@commands.is_owner()
async def datapath(self, ctx: commands.Context):
"""Prints the bot's data path."""
from redbot.core.data_manager import basic_config
@@ -4623,7 +4622,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
await ctx.send(box(msg))
@commands.command(hidden=True)
@checks.is_owner()
@commands.is_owner()
async def debuginfo(self, ctx: commands.Context):
"""Shows debug information useful for debugging."""
from redbot.core._debuginfo import DebugInfo
@@ -4697,7 +4696,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
await ctx.send(await issue_diagnoser.diagnose())
@commands.group(aliases=["whitelist"])
@checks.is_owner()
@commands.is_owner()
async def allowlist(self, ctx: commands.Context):
"""
Commands to manage the allowlist.
@@ -4786,7 +4785,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
await ctx.send(_("Allowlist has been cleared."))
@commands.group(aliases=["blacklist", "denylist"])
@checks.is_owner()
@commands.is_owner()
async def blocklist(self, ctx: commands.Context):
"""
Commands to manage the blocklist.
@@ -4879,7 +4878,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
@commands.group(aliases=["localwhitelist"])
@commands.guild_only()
@checks.admin_or_permissions(administrator=True)
@commands.admin_or_permissions(administrator=True)
async def localallowlist(self, ctx: commands.Context):
"""
Commands to manage the server specific allowlist.
@@ -5004,7 +5003,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
@commands.group(aliases=["localblacklist"])
@commands.guild_only()
@checks.admin_or_permissions(administrator=True)
@commands.admin_or_permissions(administrator=True)
async def localblocklist(self, ctx: commands.Context):
"""
Commands to manage the server specific blocklist.
@@ -5107,13 +5106,13 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
await self.bot.clear_blacklist(ctx.guild)
await ctx.send(_("Server blocklist has been cleared."))
@checks.guildowner_or_permissions(administrator=True)
@commands.guildowner_or_permissions(administrator=True)
@commands.group(name="command")
async def command_manager(self, ctx: commands.Context):
"""Commands to enable and disable commands and cogs."""
pass
@checks.is_owner()
@commands.is_owner()
@command_manager.command(name="defaultdisablecog")
async def command_default_disable_cog(self, ctx: commands.Context, *, cog: CogConverter):
"""Set the default state for a cog as disabled.
@@ -5136,7 +5135,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
await self.bot._disabled_cog_cache.default_disable(cogname)
await ctx.send(_("{cogname} has been set as disabled by default.").format(cogname=cogname))
@checks.is_owner()
@commands.is_owner()
@command_manager.command(name="defaultenablecog")
async def command_default_enable_cog(self, ctx: commands.Context, *, cog: CogConverter):
"""Set the default state for a cog as enabled.
@@ -5312,7 +5311,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
else:
await ctx.invoke(self.command_disable_guild, command=command)
@checks.is_owner()
@commands.is_owner()
@command_disable.command(name="global")
async def command_disable_global(self, ctx: commands.Context, *, command: CommandConverter):
"""
@@ -5461,7 +5460,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
else:
await ctx.tick()
@checks.is_owner()
@commands.is_owner()
@command_manager.command(name="disabledmsg")
async def command_disabledmsg(self, ctx: commands.Context, *, message: str = ""):
"""Set the bot's response to disabled commands.
@@ -5482,7 +5481,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
await ctx.tick()
@commands.guild_only()
@checks.guildowner_or_permissions(manage_guild=True)
@commands.guildowner_or_permissions(manage_guild=True)
@commands.group(name="autoimmune")
async def autoimmune_group(self, ctx: commands.Context):
"""
@@ -5660,7 +5659,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
await ctx.send(_("Channel already in ignore list."))
@ignore.command(name="server", aliases=["guild"])
@checks.admin_or_permissions(manage_guild=True)
@commands.admin_or_permissions(manage_guild=True)
async def ignore_guild(self, ctx: commands.Context):
"""
Ignore commands in this server.
@@ -5716,7 +5715,7 @@ class Core(commands.commands._RuleDropper, commands.Cog, CoreLogic):
await ctx.send(_("That channel is not in the ignore list."))
@unignore.command(name="server", aliases=["guild"])
@checks.admin_or_permissions(manage_guild=True)
@commands.admin_or_permissions(manage_guild=True)
async def unignore_guild(self, ctx: commands.Context):
"""
Remove this server from the ignore list.