Merge branch 'rewrite' of cgithub:StudyLions/StudyLion into rewrite
This commit is contained in:
@@ -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 =
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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.
|
||||
|
||||
18
src/wards.py
18
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:
|
||||
|
||||
Reference in New Issue
Block a user