fix(moderation): fixed a few unawaited coroutines
Some checks failed
Pylint / Pylint (push) Failing after 1m21s

This commit is contained in:
Seaswimmer 2023-10-05 09:28:42 -04:00
parent 59c8a96afc
commit ee5f9461aa
No known key found for this signature in database
GPG key ID: 5019678FD9CF50D8

View file

@ -195,7 +195,7 @@ class Moderation(commands.Cog):
if moderation_type in ["kicked", "banned", "unbanned"]: if moderation_type in ["kicked", "banned", "unbanned"]:
guild_name = guild.name guild_name = guild.name
else: else:
guild_name = f"[{guild.name}]({await response.jump_url})" guild_name = f"[{guild.name}]({response.jump_url})"
if moderation_type in ["tempbanned", "muted"] and duration: if moderation_type in ["tempbanned", "muted"] and duration:
embed_duration = f" for {humanize.precisedelta(duration)}" embed_duration = f" for {humanize.precisedelta(duration)}"
else: else:
@ -213,7 +213,7 @@ class Moderation(commands.Cog):
"""Warn a user.""" """Warn a user."""
await interaction.response.send_message(content=f"{target.mention} has been warned!\n**Reason** - `{reason}`") await interaction.response.send_message(content=f"{target.mention} has been warned!\n**Reason** - `{reason}`")
try: try:
embed = await self.embed_factory('message', interaction.guild, reason, 'warned', interaction.original_response()) embed = await self.embed_factory('message', interaction.guild, reason, 'warned', await interaction.original_response())
await target.send(embed=embed) await target.send(embed=embed)
except discord.errors.HTTPException: except discord.errors.HTTPException:
pass pass
@ -236,7 +236,7 @@ class Moderation(commands.Cog):
await target.timeout(parsed_time) await target.timeout(parsed_time)
await interaction.response.send_message(content=f"{target.mention} has been muted for {humanize.precisedelta(parsed_time)}!\n**Reason** - `{reason}`") await interaction.response.send_message(content=f"{target.mention} has been muted for {humanize.precisedelta(parsed_time)}!\n**Reason** - `{reason}`")
try: try:
embed = await self.embed_factory('message', interaction.guild, reason, 'muted', interaction.original_response(), parsed_time) embed = await self.embed_factory('message', interaction.guild, reason, 'muted', await interaction.original_response(), parsed_time)
await target.send(embed=embed) await target.send(embed=embed)
except discord.errors.HTTPException: except discord.errors.HTTPException:
pass pass
@ -255,7 +255,7 @@ class Moderation(commands.Cog):
reason = "No reason given." reason = "No reason given."
await interaction.response.send_message(content=f"{target.mention} has been unmuted!\n**Reason** - `{reason}`") await interaction.response.send_message(content=f"{target.mention} has been unmuted!\n**Reason** - `{reason}`")
try: try:
embed = await self.embed_factory('message', interaction.guild, reason, 'unmuted', interaction.original_response()) embed = await self.embed_factory('message', interaction.guild, reason, 'unmuted', await interaction.original_response())
await target.send(embed=embed) await target.send(embed=embed)
except discord.errors.HTTPException: except discord.errors.HTTPException:
pass pass
@ -266,7 +266,7 @@ class Moderation(commands.Cog):
"""Kick a user.""" """Kick a user."""
await interaction.response.send_message(content=f"{target.mention} has been kicked!\n**Reason** - `{reason}`") await interaction.response.send_message(content=f"{target.mention} has been kicked!\n**Reason** - `{reason}`")
try: try:
embed = await self.embed_factory('message', interaction.guild, reason, 'kicked', interaction.original_response()) embed = await self.embed_factory('message', interaction.guild, reason, 'kicked', await interaction.original_response())
await target.send(embed=embed) await target.send(embed=embed)
except discord.errors.HTTPException: except discord.errors.HTTPException:
pass pass