diff --git a/aurora/aurora.py b/aurora/aurora.py index 065bafe..89664c0 100644 --- a/aurora/aurora.py +++ b/aurora/aurora.py @@ -19,7 +19,8 @@ from redbot.core import app_commands, commands, data_manager from redbot.core.app_commands import Choice from redbot.core.bot import Red from redbot.core.commands.converter import parse_relativedelta, parse_timedelta -from redbot.core.utils.chat_formatting import box, error, humanize_list, humanize_timedelta, warning +from redbot.core.utils.chat_formatting import (box, error, humanize_list, + humanize_timedelta, warning) from aurora.importers.aurora import ImportAuroraView from aurora.importers.galacticbot import ImportGalacticBotView @@ -28,10 +29,19 @@ from aurora.menus.guild import Guild from aurora.menus.immune import Immune from aurora.menus.overrides import Overrides from aurora.utilities.config import config, register_config -from aurora.utilities.database import connect, create_guild_table, fetch_case, mysql_log -from aurora.utilities.factory import addrole_embed, case_factory, changes_factory, evidenceformat_factory, guild_embed, immune_embed, message_factory, overrides_embed +from aurora.utilities.database import (connect, create_guild_table, fetch_case, + mysql_log) +from aurora.utilities.factory import (addrole_embed, case_factory, + changes_factory, evidenceformat_factory, + guild_embed, immune_embed, + message_factory, overrides_embed) from aurora.utilities.logger import logger -from aurora.utilities.utils import check_moddable, check_permissions, convert_timedelta_to_str, fetch_channel_dict, fetch_user_dict, generate_dict, log, send_evidenceformat, timedelta_from_relativedelta +from aurora.utilities.utils import (check_moddable, check_permissions, + convert_timedelta_to_str, + fetch_channel_dict, fetch_user_dict, + generate_dict, get_footer_image, log, + send_evidenceformat, + timedelta_from_relativedelta) class Aurora(commands.Cog): @@ -224,7 +234,7 @@ class Aurora(commands.Cog): moderation_type="note", response=await interaction.original_response(), ) - await target.send(embed=embed) + await target.send(embed=embed, file=get_footer_image(self)) except discord.errors.HTTPException: pass @@ -283,7 +293,7 @@ class Aurora(commands.Cog): moderation_type="warned", response=await interaction.original_response(), ) - await target.send(embed=embed) + await target.send(embed=embed, file=get_footer_image(self)) except discord.errors.HTTPException: pass @@ -381,7 +391,7 @@ class Aurora(commands.Cog): duration=parsed_time, role=role, ) - await target.send(embed=embed) + await target.send(embed=embed, file=get_footer_image(self)) except discord.errors.HTTPException: pass @@ -487,7 +497,7 @@ class Aurora(commands.Cog): duration=parsed_time, role=role, ) - await target.send(embed=embed) + await target.send(embed=embed, file=get_footer_image(self)) except discord.errors.HTTPException: pass @@ -583,7 +593,7 @@ class Aurora(commands.Cog): response=await interaction.original_response(), duration=parsed_time, ) - await target.send(embed=embed) + await target.send(embed=embed, file=get_footer_image(self)) except discord.errors.HTTPException: pass @@ -658,7 +668,7 @@ class Aurora(commands.Cog): moderation_type="unmuted", response=await interaction.original_response(), ) - await target.send(embed=embed) + await target.send(embed=embed, file=get_footer_image(self)) except discord.errors.HTTPException: pass @@ -717,7 +727,7 @@ class Aurora(commands.Cog): moderation_type="kicked", response=await interaction.original_response(), ) - await target.send(embed=embed) + await target.send(embed=embed, file=get_footer_image(self)) except discord.errors.HTTPException: pass @@ -821,7 +831,7 @@ class Aurora(commands.Cog): response=await interaction.original_response(), duration=parsed_time, ) - await target.send(embed=embed) + await target.send(embed=embed, file=get_footer_image(self)) except discord.errors.HTTPException: pass @@ -865,7 +875,7 @@ class Aurora(commands.Cog): moderation_type="banned", response=await interaction.original_response(), ) - await target.send(embed=embed) + await target.send(embed=embed, file=get_footer_image(self)) except discord.errors.HTTPException: pass @@ -948,7 +958,7 @@ class Aurora(commands.Cog): moderation_type="unbanned", response=await interaction.original_response(), ) - await target.send(embed=embed) + await target.send(embed=embed, file=get_footer_image(self)) except discord.errors.HTTPException: pass @@ -1646,6 +1656,7 @@ class Aurora(commands.Cog): embed = await message_factory( await self.bot.get_embed_color(guild.channels[0]), + file=get_footer_image(self), guild=guild, reason=f"Automatic unban from case #{moderation_id}", moderation_type="unbanned", diff --git a/aurora/data/arrow.png b/aurora/data/arrow.png new file mode 100644 index 0000000..aedf12e Binary files /dev/null and b/aurora/data/arrow.png differ diff --git a/aurora/utilities/factory.py b/aurora/utilities/factory.py index 86aee24..af827e8 100644 --- a/aurora/utilities/factory.py +++ b/aurora/utilities/factory.py @@ -2,12 +2,16 @@ from datetime import datetime, timedelta from typing import Union -from discord import Color, Embed, Guild, Interaction, InteractionMessage, Member, Role, User +from discord import (Color, Embed, Guild, Interaction, InteractionMessage, + Member, Role, User) from redbot.core import commands -from redbot.core.utils.chat_formatting import bold, box, error, humanize_timedelta, warning +from redbot.core.utils.chat_formatting import (bold, box, error, + humanize_timedelta, warning) from aurora.utilities.config import config -from aurora.utilities.utils import fetch_channel_dict, fetch_user_dict, get_bool_emoji, get_next_case_number, get_pagesize_str +from aurora.utilities.utils import (fetch_channel_dict, fetch_user_dict, + get_bool_emoji, get_next_case_number, + get_pagesize_str) async def message_factory( @@ -87,7 +91,7 @@ async def message_factory( embed.set_footer( text=f"Case #{await get_next_case_number(guild.id):,}", - icon_url="https://cdn.discordapp.com/attachments/1070822161389994054/1159469476773904414/arrow-right-circle-icon-512x512-2p1e2aaw.png?ex=65312319&is=651eae19&hm=3cebdd28e805c13a79ec48ef87c32ca532ffa6b9ede2e48d0cf8e5e81f3a6818&", + icon_url="attachment://arrow.png", ) return embed diff --git a/aurora/utilities/utils.py b/aurora/utilities/utils.py index 616fa78..1ff21fa 100644 --- a/aurora/utilities/utils.py +++ b/aurora/utilities/utils.py @@ -5,9 +5,9 @@ from datetime import timedelta as td from typing import Optional, Union from dateutil.relativedelta import relativedelta as rd -from discord import Guild, Interaction, Member, SelectOption, User +from discord import File, Guild, Interaction, Member, SelectOption, User from discord.errors import Forbidden, NotFound -from redbot.core import commands +from redbot.core import commands, data_manager from redbot.core.utils.chat_formatting import error from .config import config @@ -291,3 +291,8 @@ def timedelta_from_relativedelta(relativedelta: rd) -> td: now = datetime.now() then = now - relativedelta return now - then + +def get_footer_image(coginstance: commands.Cog) -> File: + """Returns the footer image for the embeds.""" + image_path = data_manager.bundled_data_path(coginstance) / "arrow.png" + return File(image_path, filename="arrow.png", description="arrow")