diff --git a/redbot/cogs/admin/admin.py b/redbot/cogs/admin/admin.py index f1bd83013..06058e018 100644 --- a/redbot/cogs/admin/admin.py +++ b/redbot/cogs/admin/admin.py @@ -291,6 +291,7 @@ class Admin: # noinspection PyTypeChecker return valid_roles + @commands.guild_only() @commands.group(invoke_without_command=True) async def selfrole(self, ctx: commands.Context, *, selfrole: SelfRole): """ diff --git a/redbot/cogs/bank/bank.py b/redbot/cogs/bank/bank.py index f81916cc5..b662b68fb 100644 --- a/redbot/cogs/bank/bank.py +++ b/redbot/cogs/bank/bank.py @@ -17,13 +17,15 @@ def check_global_setting_guildowner(): async def pred(ctx: commands.Context): author = ctx.author - if await ctx.bot.is_owner(author): - return True if not await bank.is_global(): if not isinstance(ctx.channel, discord.abc.GuildChannel): return False + if await ctx.bot.is_owner(author): + return True permissions = ctx.channel.permissions_for(author) return author == ctx.guild.owner or permissions.administrator + else: + return await ctx.bot.is_owner(author) return commands.check(pred) @@ -36,15 +38,17 @@ def check_global_setting_admin(): async def pred(ctx: commands.Context): author = ctx.author - if await ctx.bot.is_owner(author): - return True if not await bank.is_global(): if not isinstance(ctx.channel, discord.abc.GuildChannel): return False + if await ctx.bot.is_owner(author): + return True permissions = ctx.channel.permissions_for(author) is_guild_owner = author == ctx.guild.owner admin_role = await ctx.bot.db.guild(ctx.guild).admin_role() return admin_role in author.roles or is_guild_owner or permissions.manage_guild + else: + return await ctx.bot.is_owner(author) return commands.check(pred) @@ -58,8 +62,9 @@ class Bank: # SECTION commands - @commands.group() + @check_global_setting_guildowner() @checks.guildowner_or_permissions(administrator=True) + @commands.group(autohelp=True) async def bankset(self, ctx: commands.Context): """Base command for bank settings""" if ctx.invoked_subcommand is None: diff --git a/redbot/cogs/cleanup/cleanup.py b/redbot/cogs/cleanup/cleanup.py index 68dd42d3d..7acf299f0 100644 --- a/redbot/cogs/cleanup/cleanup.py +++ b/redbot/cogs/cleanup/cleanup.py @@ -423,7 +423,7 @@ class Cleanup: if author == self.bot.user: to_delete.append(ctx.message) - if channel.name: + if ctx.guild: channel_name = "channel " + channel.name else: channel_name = str(channel) diff --git a/redbot/cogs/economy/economy.py b/redbot/cogs/economy/economy.py index 151fd58a9..2d17866d1 100644 --- a/redbot/cogs/economy/economy.py +++ b/redbot/cogs/economy/economy.py @@ -137,6 +137,7 @@ class Economy: self.config.register_role(**self.default_role_settings) self.slot_register = defaultdict(dict) + @guild_only_check() @commands.group(name="bank") async def _bank(self, ctx: commands.Context): """Bank operations""" @@ -209,7 +210,6 @@ class Economy: ) @_bank.command() - @guild_only_check() @check_global_setting_guildowner() async def reset(self, ctx, confirmation: bool = False): """Deletes bank accounts""" @@ -230,8 +230,8 @@ class Economy: ) ) - @commands.command() @guild_only_check() + @commands.command() async def payday(self, ctx: commands.Context): """Get some free currency""" author = ctx.author diff --git a/redbot/core/core_commands.py b/redbot/core/core_commands.py index d877139a4..fd29c7f8e 100644 --- a/redbot/core/core_commands.py +++ b/redbot/core/core_commands.py @@ -360,6 +360,7 @@ class Core(CoreLogic): @embedset.command(name="guild") @checks.guildowner_or_permissions(administrator=True) + @commands.guild_only() async def embedset_guild(self, ctx: commands.Context, enabled: bool = None): """ Toggle the guild's embed setting.