fix(moderation): awaited coroutines

This commit is contained in:
Seaswimmer 2023-12-14 21:21:40 -05:00
parent 154e871dfc
commit 1fdd8b1e36
Signed by untrusted user: cswimr
GPG key ID: 1EBC234EEDA901AE

View file

@ -1429,7 +1429,7 @@ class Moderation(commands.Cog):
@checks.admin()
async def moderationset_immunity_add(self, ctx: commands.Context, role: discord.Role):
"""Add a role to the immune roles list."""
immune_roles: list = self.config.guild(ctx.guild).immune_roles()
immune_roles: list = await self.config.guild(ctx.guild).immune_roles()
if role.id in immune_roles:
await ctx.send("Role is already immune!")
return
@ -1441,7 +1441,7 @@ class Moderation(commands.Cog):
@checks.admin()
async def moderationset_immunity_remove(self, ctx: commands.Context, role: discord.Role):
"""Remove a role from the immune roles list."""
immune_roles: list = self.config.guild(ctx.guild).immune_roles()
immune_roles: list = await self.config.guild(ctx.guild).immune_roles()
if role.id not in immune_roles:
await ctx.send("Role is not immune!")
return
@ -1453,7 +1453,7 @@ class Moderation(commands.Cog):
@checks.admin()
async def moderationset_immunity_list(self, ctx: commands.Context):
"""List all immune roles."""
immune_roles: list = self.config.guild(ctx.guild).immune_roles()
immune_roles: list = await self.config.guild(ctx.guild).immune_roles()
if not immune_roles:
await ctx.send("No immune roles set!")
return
@ -1482,7 +1482,7 @@ class Moderation(commands.Cog):
What role are you adding a blacklist type for?
duration: str
How long should the target be blacklisted for?"""
blacklist_roles: list = self.config.guild(ctx.guild).blacklist_roles()
blacklist_roles: list = await self.config.guild(ctx.guild).blacklist_roles()
for blacklist_role in blacklist_roles:
if role.id == blacklist_role['role']:
await ctx.send("Role already has an associated blacklist type!")
@ -1505,7 +1505,7 @@ class Moderation(commands.Cog):
-----------
role: discord.Role
What role are you removing a blacklist type for?"""
blacklist_roles: list = self.config.guild(ctx.guild).blacklist_roles()
blacklist_roles: list = await self.config.guild(ctx.guild).blacklist_roles()
for blacklist_role in blacklist_roles:
if role.id == blacklist_role['role']:
blacklist_roles.remove(blacklist_role)
@ -1518,7 +1518,7 @@ class Moderation(commands.Cog):
@checks.admin()
async def moderationset_blacklist_list(self, ctx: commands.Context):
"""List all blacklist types."""
blacklist_roles: list = self.config.guild(ctx.guild).blacklist_roles()
blacklist_roles: list = await self.config.guild(ctx.guild).blacklist_roles()
if not blacklist_roles:
await ctx.send("No blacklist types set!")
return