forked from cswimr/SeaCogs
fix(moderation): hopefully fixed embed_factory
This commit is contained in:
parent
31fa5eb937
commit
dbb3e7b278
1 changed files with 27 additions and 14 deletions
|
@ -197,7 +197,8 @@ class Moderation(commands.Cog):
|
|||
silent = not await self.config.guild(interaction.guild).dm_users()
|
||||
if silent is False:
|
||||
try:
|
||||
embed = await embed_factory('message', await self.bot.get_embed_color(None), guild=interaction.guild, reason=reason, moderation_type='note', response=await interaction.original_response())
|
||||
color = await self.bot.get_embed_color(None)
|
||||
embed = await embed_factory('message', color, guild=interaction.guild, reason=reason, moderation_type='note', response=await interaction.original_response())
|
||||
await target.send(embed=embed)
|
||||
except discord.errors.HTTPException:
|
||||
pass
|
||||
|
@ -227,7 +228,8 @@ class Moderation(commands.Cog):
|
|||
silent = not await self.config.guild(interaction.guild).dm_users()
|
||||
if silent is False:
|
||||
try:
|
||||
embed = await embed_factory('message', await self.bot.get_embed_color(None), guild=interaction.guild, reason=reason, moderation_type='warned', response=await interaction.original_response())
|
||||
color = await self.bot.get_embed_color(None)
|
||||
embed = await embed_factory('message', color, guild=interaction.guild, reason=reason, moderation_type='warned', response=await interaction.original_response())
|
||||
await target.send(embed=embed)
|
||||
except discord.errors.HTTPException:
|
||||
pass
|
||||
|
@ -287,7 +289,8 @@ class Moderation(commands.Cog):
|
|||
silent = not await self.config.guild(interaction.guild).dm_users()
|
||||
if silent is False:
|
||||
try:
|
||||
embed = await embed_factory('message', await self.bot.get_embed_color(None), guild=interaction.guild, reason=reason, moderation_type='blacklisted', response=await interaction.original_response(), duration=matching_role['duration'])
|
||||
color = await self.bot.get_embed_color(None)
|
||||
embed = await embed_factory('message', color, guild=interaction.guild, reason=reason, moderation_type='blacklisted', response=await interaction.original_response(), duration=matching_role['duration'])
|
||||
await target.send(embed=embed)
|
||||
except discord.errors.HTTPException:
|
||||
pass
|
||||
|
@ -339,7 +342,8 @@ class Moderation(commands.Cog):
|
|||
silent = not await self.config.guild(interaction.guild).dm_users()
|
||||
if silent is False:
|
||||
try:
|
||||
embed = await embed_factory('message', await self.bot.get_embed_color(None), guild=interaction.guild, reason=reason, moderation_type='muted', response=await interaction.original_response(), duration=parsed_time)
|
||||
color = await self.bot.get_embed_color(None)
|
||||
embed = await embed_factory('message', color, guild=interaction.guild, reason=reason, moderation_type='muted', response=await interaction.original_response(), duration=parsed_time)
|
||||
await target.send(embed=embed)
|
||||
except discord.errors.HTTPException:
|
||||
pass
|
||||
|
@ -379,7 +383,8 @@ class Moderation(commands.Cog):
|
|||
silent = not await self.config.guild(interaction.guild).dm_users()
|
||||
if silent is False:
|
||||
try:
|
||||
embed = await embed_factory('message', await self.bot.get_embed_color(None), guild=interaction.guild, reason=reason, moderation_type='unmuted', response=await interaction.original_response())
|
||||
color = await self.bot.get_embed_color(None)
|
||||
embed = await embed_factory('message', color, guild=interaction.guild, reason=reason, moderation_type='unmuted', response=await interaction.original_response())
|
||||
await target.send(embed=embed)
|
||||
except discord.errors.HTTPException:
|
||||
pass
|
||||
|
@ -409,7 +414,8 @@ class Moderation(commands.Cog):
|
|||
silent = not await self.config.guild(interaction.guild).dm_users()
|
||||
if silent is False:
|
||||
try:
|
||||
embed = await embed_factory('message', await self.bot.get_embed_color(None), guild=interaction.guild, reason=reason, moderation_type='kicked', response=await interaction.original_response())
|
||||
color = await self.bot.get_embed_color(None)
|
||||
embed = await embed_factory('message', color, guild=interaction.guild, reason=reason, moderation_type='kicked', response=await interaction.original_response())
|
||||
await target.send(embed=embed)
|
||||
except discord.errors.HTTPException:
|
||||
pass
|
||||
|
@ -464,7 +470,8 @@ class Moderation(commands.Cog):
|
|||
await interaction.response.send_message(content=f"{target.mention} has been banned for {humanize.precisedelta(parsed_time)}!\n**Reason** - `{reason}`")
|
||||
|
||||
try:
|
||||
embed = await embed_factory('message', await self.bot.get_embed_color(None), guild=interaction.guild, reason=reason, moderation_type='tempbanned', response=await interaction.original_response(), duration=parsed_time)
|
||||
color = await self.bot.get_embed_color(None)
|
||||
embed = await embed_factory('message', color, guild=interaction.guild, reason=reason, moderation_type='tempbanned', response=await interaction.original_response(), duration=parsed_time)
|
||||
await target.send(embed=embed)
|
||||
except discord.errors.HTTPException:
|
||||
pass
|
||||
|
@ -481,7 +488,8 @@ class Moderation(commands.Cog):
|
|||
silent = not await self.config.guild(interaction.guild).dm_users()
|
||||
if silent is False:
|
||||
try:
|
||||
embed = embed = await embed_factory('message', await self.bot.get_embed_color(None), guild=interaction.guild, reason=reason, moderation_type='banned', response=await interaction.original_response())
|
||||
color = await self.bot.get_embed_color(None)
|
||||
embed = embed = await embed_factory('message', color, guild=interaction.guild, reason=reason, moderation_type='banned', response=await interaction.original_response())
|
||||
await target.send(embed=embed)
|
||||
except discord.errors.HTTPException:
|
||||
pass
|
||||
|
@ -525,7 +533,8 @@ class Moderation(commands.Cog):
|
|||
silent = not await self.config.guild(interaction.guild).dm_users()
|
||||
if silent is False:
|
||||
try:
|
||||
embed = await embed_factory('message', await self.bot.get_embed_color(None), guild=interaction.guild, reason=reason, moderation_type='unbanned', response=await interaction.original_response())
|
||||
color = await self.bot.get_embed_color(None)
|
||||
embed = await embed_factory('message', color, guild=interaction.guild, reason=reason, moderation_type='unbanned', response=await interaction.original_response())
|
||||
await target.send(embed=embed)
|
||||
except discord.errors.HTTPException:
|
||||
pass
|
||||
|
@ -762,7 +771,8 @@ class Moderation(commands.Cog):
|
|||
cursor.execute(resolve_query, (json.dumps(changes), interaction.user.id, reason, case_dict['moderation_id']))
|
||||
database.commit()
|
||||
|
||||
embed = await embed_factory('case', await self.bot.get_embed_color(None), interaction=interaction, case_dict=await fetch_case(case, interaction.guild.id))
|
||||
color = await self.bot.get_embed_color(None)
|
||||
embed = await embed_factory('case', color, interaction=interaction, case_dict=await fetch_case(case, interaction.guild.id))
|
||||
await interaction.response.send_message(content=f"✅ Moderation #{case:,} resolved!", embed=embed)
|
||||
await log(interaction, case)
|
||||
|
||||
|
@ -818,10 +828,11 @@ class Moderation(commands.Cog):
|
|||
return
|
||||
await interaction.response.send_message(content=f"```json\n{json.dumps(case_dict, indent=2)}```", ephemeral=ephemeral)
|
||||
return
|
||||
color = await self.bot.get_embed_color(None)
|
||||
if changes:
|
||||
embed = await embed_factory('changes', await self.bot.get_embed_color(None), interaction=interaction, case_dict=case_dict)
|
||||
embed = await embed_factory('changes', color, interaction=interaction, case_dict=case_dict)
|
||||
else:
|
||||
embed = await embed_factory('case', await self.bot.get_embed_color(None), interaction=interaction, case_dict=case_dict)
|
||||
embed = await embed_factory('case', color, interaction=interaction, case_dict=case_dict)
|
||||
await interaction.response.send_message(embed=embed, ephemeral=ephemeral)
|
||||
return
|
||||
await interaction.response.send_message(content=f"No case with case number `{case}` found.", ephemeral=True)
|
||||
|
@ -923,7 +934,8 @@ class Moderation(commands.Cog):
|
|||
database.commit()
|
||||
|
||||
new_case = await fetch_case(case, interaction.guild.id)
|
||||
embed = await embed_factory('case', await self.bot.get_embed_color(None), interaction=interaction, case_dict=new_case)
|
||||
color = await self.bot.get_embed_color(None)
|
||||
embed = await embed_factory('case', color, interaction=interaction, case_dict=new_case)
|
||||
|
||||
await interaction.response.send_message(content=f"✅ Moderation #{case:,} edited!", embed=embed, ephemeral=True)
|
||||
await log(interaction, case)
|
||||
|
@ -963,7 +975,8 @@ class Moderation(commands.Cog):
|
|||
try:
|
||||
await guild.unban(user, reason=f"Automatic unban from case #{moderation_id}")
|
||||
|
||||
embed = await embed_factory('message', self.bot.get_embed_color(None), guild, f'Automatic unban from case #{moderation_id}', 'unbanned')
|
||||
color = await self.bot.get_embed_color(None)
|
||||
embed = await embed_factory('message', color, guild, f'Automatic unban from case #{moderation_id}', 'unbanned')
|
||||
|
||||
try:
|
||||
await user.send(embed=embed)
|
||||
|
|
Loading…
Reference in a new issue