Fix help command not working in DMs

The `help` application command now functions as expected in DMs.
This shows both member-level and admin-level commands.

- Fixed `shop open` appearing in the DM slash command list
- Fixed `support_guild` not being included in `example-bot.conf`
- The following wards now require the `Guild` context to be passed to them:
	- `low_management`
	- `high_management`
This commit is contained in:
JetRaidz
2023-09-19 18:32:29 +12:00
parent bb13c1fe66
commit 1946077ded
4 changed files with 16 additions and 8 deletions

View File

@@ -11,6 +11,8 @@ ALSO_READ = config/emojis.conf, config/secrets.conf, config/gui.conf
asset_path = assets asset_path = assets
support_guild =
[ENDPOINTS] [ENDPOINTS]
guild_log = guild_log =
gem_transaction = gem_transaction =

View File

@@ -32,6 +32,6 @@ class MetaCog(LionCog):
ctx.bot, ctx.bot,
ctx.author, ctx.author,
ctx.guild, 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) await ui.run(ctx.interaction)

View File

@@ -117,6 +117,7 @@ class Shopping(LionCog):
name=_p('cmd:shop', 'shop'), name=_p('cmd:shop', 'shop'),
description=_p('cmd:shop|desc', "Purchase coloures, roles, and other goodies with LionCoins.") description=_p('cmd:shop|desc', "Purchase coloures, roles, and other goodies with LionCoins.")
) )
@appcmds.guild_only
async def shop_group(self, ctx: LionContext): async def shop_group(self, ctx: LionContext):
return return
@@ -124,6 +125,7 @@ class Shopping(LionCog):
name=_p('cmd:shop_open', 'open'), name=_p('cmd:shop_open', 'open'),
description=_p('cmd:shop_open|desc', "Open the server shop.") description=_p('cmd:shop_open|desc', "Open the server shop.")
) )
@appcmds.guild_only
async def shop_open_cmd(self, ctx: LionContext): async def shop_open_cmd(self, ctx: LionContext):
""" """
Opens the shop UI for the current guild. Opens the shop UI for the current guild.

View File

@@ -21,13 +21,17 @@ async def sys_admin(bot: LionBot, userid: int):
return userid in admins 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): if await sys_admin(bot, member.id):
return True return True
return member.guild_permissions.administrator 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): if await high_management(bot, member):
return True return True
return member.guild_permissions.manage_guild 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: async def high_management_iward(interaction: discord.Interaction) -> bool:
if not interaction.guild: if not interaction.guild:
return False 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: async def low_management_iward(interaction: discord.Interaction) -> bool:
if not interaction.guild: if not interaction.guild:
return False return False
return await low_management(interaction.client, interaction.user) return await low_management(interaction.client, interaction.user, interaction.guild)
# High level ctx wards # High level ctx wards
async def moderator_ctxward(ctx: LionContext) -> bool: async def moderator_ctxward(ctx: LionContext) -> bool:
if not ctx.guild: if not ctx.guild:
return False return False
passed = await low_management(ctx.bot, ctx.author) passed = await low_management(ctx.bot, ctx.author, ctx.guild)
if passed: if passed:
return True return True
modrole = ctx.lguild.data.mod_role 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: async def high_management_ward(ctx: LionContext) -> bool:
if not ctx.guild: if not ctx.guild:
return False return False
passed = await high_management(ctx.bot, ctx.author) passed = await high_management(ctx.bot, ctx.author, ctx.guild)
if passed: if passed:
return True return True
else: else:
@@ -101,7 +105,7 @@ async def high_management_ward(ctx: LionContext) -> bool:
async def low_management_ward(ctx: LionContext) -> bool: async def low_management_ward(ctx: LionContext) -> bool:
if not ctx.guild: if not ctx.guild:
return False return False
passed = await low_management(ctx.bot, ctx.author) passed = await low_management(ctx.bot, ctx.author, ctx.guild)
if passed: if passed:
return True return True
else: else: