fix(aurora): fixed colors being wrong occasionally
All checks were successful
Build Documentation and Lint Code / build and lint (push) Successful in 25s

This commit is contained in:
Seaswimmer 2024-01-08 06:14:48 +00:00
parent ca244b234a
commit 6d8b99cf76
Signed by: cswimr
GPG key ID: D74DDDDF420E13DF

View file

@ -162,7 +162,7 @@ class Aurora(commands.Cog):
silent = not await 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, moderator=interaction.user, reason=reason, moderation_type='note', response=await interaction.original_response())
embed = await embed_factory('message', await self.bot.get_embed_color(interaction.channel), guild=interaction.guild, moderator=interaction.user, reason=reason, moderation_type='note', response=await interaction.original_response())
await target.send(embed=embed)
except discord.errors.HTTPException:
pass
@ -195,7 +195,7 @@ class Aurora(commands.Cog):
silent = not await 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, moderator=interaction.user, reason=reason, moderation_type='warned', response=await interaction.original_response())
embed = await embed_factory('message', await self.bot.get_embed_color(interaction.channel), guild=interaction.guild, moderator=interaction.user, reason=reason, moderation_type='warned', response=await interaction.original_response())
await target.send(embed=embed)
except discord.errors.HTTPException:
pass
@ -251,7 +251,7 @@ class Aurora(commands.Cog):
silent = not await 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, moderator=interaction.user, reason=reason, moderation_type='blacklisted', response=await interaction.original_response(), duration=matching_role['duration'])
embed = await embed_factory('message', await self.bot.get_embed_color(interaction.channel), guild=interaction.guild, moderator=interaction.user, reason=reason, moderation_type='blacklisted', response=await interaction.original_response(), duration=matching_role['duration'])
await target.send(embed=embed)
except discord.errors.HTTPException:
pass
@ -306,7 +306,7 @@ class Aurora(commands.Cog):
silent = not await 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, moderator=interaction.user, reason=reason, moderation_type='muted', response=await interaction.original_response(), duration=parsed_time)
embed = await embed_factory('message', await self.bot.get_embed_color(interaction.channel), guild=interaction.guild, moderator=interaction.user, reason=reason, moderation_type='muted', response=await interaction.original_response(), duration=parsed_time)
await target.send(embed=embed)
except discord.errors.HTTPException:
pass
@ -349,7 +349,7 @@ class Aurora(commands.Cog):
silent = not await 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, moderator=interaction.user, reason=reason, moderation_type='unmuted', response=await interaction.original_response())
embed = await embed_factory('message', await self.bot.get_embed_color(interaction.channel), guild=interaction.guild, moderator=interaction.user, reason=reason, moderation_type='unmuted', response=await interaction.original_response())
await target.send(embed=embed)
except discord.errors.HTTPException:
pass
@ -382,7 +382,7 @@ class Aurora(commands.Cog):
silent = not await 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, moderator=interaction.user, reason=reason, moderation_type='kicked', response=await interaction.original_response())
embed = await embed_factory('message', await self.bot.get_embed_color(interaction.channel), guild=interaction.guild, moderator=interaction.user, reason=reason, moderation_type='kicked', response=await interaction.original_response())
await target.send(embed=embed)
except discord.errors.HTTPException:
pass
@ -445,7 +445,7 @@ class Aurora(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, moderator=interaction.user, reason=reason, moderation_type='tempbanned', response=await interaction.original_response(), duration=parsed_time)
embed = await embed_factory('message', await self.bot.get_embed_color(interaction.channel) , guild=interaction.guild, moderator=interaction.user, reason=reason, moderation_type='tempbanned', response=await interaction.original_response(), duration=parsed_time)
await target.send(embed=embed)
except discord.errors.HTTPException:
pass
@ -465,7 +465,7 @@ class Aurora(commands.Cog):
silent = not await 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, moderator=interaction.user, reason=reason, moderation_type='banned', response=await interaction.original_response())
embed = embed = await embed_factory('message', await self.bot.get_embed_color(interaction.channel), guild=interaction.guild, moderator=interaction.user, reason=reason, moderation_type='banned', response=await interaction.original_response())
await target.send(embed=embed)
except discord.errors.HTTPException:
pass
@ -512,7 +512,7 @@ class Aurora(commands.Cog):
silent = not await 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, moderator=interaction.user, reason=reason, moderation_type='unbanned', response=await interaction.original_response())
embed = await embed_factory('message', await self.bot.get_embed_color(interaction.channel), guild=interaction.guild, moderator=interaction.user, reason=reason, moderation_type='unbanned', response=await interaction.original_response())
await target.send(embed=embed)
except discord.errors.HTTPException:
pass
@ -634,7 +634,7 @@ class Aurora(commands.Cog):
start_index = (page - 1) * pagesize
end_index = page * pagesize
embed = discord.Embed(color=await self.bot.get_embed_color(None))
embed = discord.Embed(color=await self.bot.get_embed_color(interaction.channel))
embed.set_author(icon_url=interaction.guild.icon.url, name='Infraction History')
embed.set_footer(text=f"Page {page:,}/{page_quantity:,} | {case_quantity:,} Results")
@ -765,7 +765,7 @@ class Aurora(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))
embed = await embed_factory('case', await self.bot.get_embed_color(interaction.channel), 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, resolved=True)
@ -822,13 +822,13 @@ class Aurora(commands.Cog):
await interaction.response.send_message(content=box({json.dumps(case_dict, indent=2)}), ephemeral=ephemeral)
return
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', await self.bot.get_embed_color(interaction.channel), interaction=interaction, case_dict=case_dict)
await interaction.response.send_message(embed=embed, ephemeral=ephemeral)
elif evidenceformat:
content = await embed_factory('evidenceformat', await self.bot.get_embed_color(None), interaction=interaction, case_dict=case_dict)
content = await embed_factory('evidenceformat', await self.bot.get_embed_color(interaction.channel), interaction=interaction, case_dict=case_dict)
await interaction.response.send_message(content=content, ephemeral=ephemeral)
else:
embed = await embed_factory('case', await self.bot.get_embed_color(None), interaction=interaction, case_dict=case_dict)
embed = await embed_factory('case', await self.bot.get_embed_color(interaction.channel), 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)
@ -925,7 +925,7 @@ class Aurora(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)
embed = await embed_factory('case', await self.bot.get_embed_color(interaction.channel), interaction=interaction, case_dict=new_case)
await interaction.response.send_message(content=f"✅ Moderation #{case:,} edited!", embed=embed, ephemeral=True)
await log(interaction, case)
@ -1040,7 +1040,7 @@ class Aurora(commands.Cog):
for setting in user_settings:
user_settings_string += f"**{setting}**: {user_settings[setting]}\n"
embed = discord.Embed(color=await self.bot.get_embed_color(None))
embed = discord.Embed(color=await self.bot.get_embed_color(ctx.channel))
embed.set_author(icon_url=ctx.guild.icon.url, name=f"{ctx.guild.name} Moderation Settings")
if ctx.guild:
embed.add_field(name="Guild Settings", value=guild_settings_string)
@ -1206,7 +1206,7 @@ class Aurora(commands.Cog):
if role:
role_list += f"{role.mention}\n"
if role_list:
embed = discord.Embed(title="Immune Roles", description=role_list, color=await self.bot.get_embed_color(None))
embed = discord.Embed(title="Immune Roles", description=role_list, color=await self.bot.get_embed_color(ctx.channel))
await ctx.send(embed=embed)
@auroraset.group(autohelp=True, name='blacklist')
@ -1266,7 +1266,7 @@ class Aurora(commands.Cog):
if role:
blacklist_list += f"{role.mention} - {blacklist_role['duration']}\n"
if blacklist_list:
embed = discord.Embed(title="Blacklist Types", description=blacklist_list, color=await self.bot.get_embed_color(None))
embed = discord.Embed(title="Blacklist Types", description=blacklist_list, color=await self.bot.get_embed_color(ctx.channel))
await ctx.send(embed=embed)
@auroraset.command(name="ignorebots")