diff --git a/config/example-bot.conf b/config/example-bot.conf index 6ed72e6b..b27c143e 100644 --- a/config/example-bot.conf +++ b/config/example-bot.conf @@ -11,6 +11,8 @@ ALSO_READ = config/emojis.conf, config/secrets.conf, config/gui.conf asset_path = assets +support_guild = + [ENDPOINTS] guild_log = gem_transaction = diff --git a/src/modules/meta/cog.py b/src/modules/meta/cog.py index e5cc5f4f..b865148d 100644 --- a/src/modules/meta/cog.py +++ b/src/modules/meta/cog.py @@ -32,6 +32,6 @@ class MetaCog(LionCog): ctx.bot, ctx.author, ctx.guild, - show_admin=await low_management(ctx.bot, ctx.author), + show_admin=await low_management(ctx.bot, ctx.author, ctx.guild), ) await ui.run(ctx.interaction) diff --git a/src/modules/shop/cog.py b/src/modules/shop/cog.py index 4892c2f2..a6885751 100644 --- a/src/modules/shop/cog.py +++ b/src/modules/shop/cog.py @@ -117,6 +117,7 @@ class Shopping(LionCog): name=_p('cmd:shop', 'shop'), description=_p('cmd:shop|desc', "Purchase coloures, roles, and other goodies with LionCoins.") ) + @appcmds.guild_only async def shop_group(self, ctx: LionContext): return @@ -124,6 +125,7 @@ class Shopping(LionCog): name=_p('cmd:shop_open', 'open'), description=_p('cmd:shop_open|desc', "Open the server shop.") ) + @appcmds.guild_only async def shop_open_cmd(self, ctx: LionContext): """ Opens the shop UI for the current guild. diff --git a/src/wards.py b/src/wards.py index 6198436b..2ac290e1 100644 --- a/src/wards.py +++ b/src/wards.py @@ -21,13 +21,17 @@ async def sys_admin(bot: LionBot, userid: int): return userid in admins -async def high_management(bot: LionBot, member: discord.Member): +async def high_management(bot: LionBot, member: discord.Member, guild: discord.Guild): + if not guild: + return True if await sys_admin(bot, member.id): return True return member.guild_permissions.administrator -async def low_management(bot: LionBot, member: discord.Member): +async def low_management(bot: LionBot, member: discord.Member, guild: discord.Guild): + if not guild: + return True if await high_management(bot, member): return True return member.guild_permissions.manage_guild @@ -42,20 +46,20 @@ async def sys_admin_iward(interaction: discord.Interaction) -> bool: async def high_management_iward(interaction: discord.Interaction) -> bool: if not interaction.guild: return False - return await high_management(interaction.client, interaction.user) + return await high_management(interaction.client, interaction.user, interaction.guild) async def low_management_iward(interaction: discord.Interaction) -> bool: if not interaction.guild: return False - return await low_management(interaction.client, interaction.user) + return await low_management(interaction.client, interaction.user, interaction.guild) # High level ctx wards async def moderator_ctxward(ctx: LionContext) -> bool: if not ctx.guild: return False - passed = await low_management(ctx.bot, ctx.author) + passed = await low_management(ctx.bot, ctx.author, ctx.guild) if passed: return True modrole = ctx.lguild.data.mod_role @@ -85,7 +89,7 @@ async def sys_admin_ward(ctx: LionContext) -> bool: async def high_management_ward(ctx: LionContext) -> bool: if not ctx.guild: return False - passed = await high_management(ctx.bot, ctx.author) + passed = await high_management(ctx.bot, ctx.author, ctx.guild) if passed: return True else: @@ -101,7 +105,7 @@ async def high_management_ward(ctx: LionContext) -> bool: async def low_management_ward(ctx: LionContext) -> bool: if not ctx.guild: return False - passed = await low_management(ctx.bot, ctx.author) + passed = await low_management(ctx.bot, ctx.author, ctx.guild) if passed: return True else: