From 16a3bedbd29286579b3f0265be4b75ea907ca68e Mon Sep 17 00:00:00 2001 From: Cool aid <84676543+cool-aid-man@users.noreply.github.com> Date: Thu, 25 Jan 2024 09:49:03 +0530 Subject: [PATCH 1/4] Fix the exception - object has no attribute 'target' - This fixes the issue with `cmdlog cache` --- cmdlog/objects.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmdlog/objects.py b/cmdlog/objects.py index c6bd09f3..7f813e48 100644 --- a/cmdlog/objects.py +++ b/cmdlog/objects.py @@ -232,6 +232,6 @@ def __sizeof__(self) -> int: size += getsizeof(self.channel) size += getsizeof(self.guild) size += getsizeof(self.time) - size += getsizeof(self.target) + size += getattr(self, 'target', 0) return size From e69480786f44028adbbc527e9ba7e56349ca89b0 Mon Sep 17 00:00:00 2001 From: Vexed Date: Fri, 2 Feb 2024 13:15:43 +0000 Subject: [PATCH 2/4] set target & style --- cmdlog/objects.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmdlog/objects.py b/cmdlog/objects.py index 7f813e48..fb0b0ffe 100644 --- a/cmdlog/objects.py +++ b/cmdlog/objects.py @@ -165,8 +165,8 @@ def __init__( if isinstance(target, discord.User): self.target = BasicDiscordObject(target.id, target.name) - else: - target = target + else: # partial message, already low mem usage so leave as is + self.target = target self.time = datetime.datetime.now().strftime(TIME_FORMAT) @@ -232,6 +232,6 @@ def __sizeof__(self) -> int: size += getsizeof(self.channel) size += getsizeof(self.guild) size += getsizeof(self.time) - size += getattr(self, 'target', 0) + size += getsizeof(getattr(self, "target", 0)) return size From 4947ff88f3973d649e475e085565d36d309a2bc8 Mon Sep 17 00:00:00 2001 From: Vexed Date: Fri, 2 Feb 2024 13:25:20 +0000 Subject: [PATCH 3/4] fix docs not really sure why tests suddenly fail but hopefully this works --- docs/getting_started.rst | 2 +- docs/requirements.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/getting_started.rst b/docs/getting_started.rst index 2091fe2e..2d895794 100644 --- a/docs/getting_started.rst +++ b/docs/getting_started.rst @@ -75,5 +75,5 @@ Cog name Summary Support ------- -If you want some help with my cogs, you can ask in the :ref:`Red - Cog Support` server, +If you want some help with my cogs, you can ask in the `Red - Cog Support`_ server, in #support_vex-cogs. diff --git a/docs/requirements.txt b/docs/requirements.txt index a95ae18b..6f427936 100644 --- a/docs/requirements.txt +++ b/docs/requirements.txt @@ -1 +1,2 @@ furo +sphinx-rtd-theme \ No newline at end of file From 3556fc9b490042decd715e7fb3f51704f5949a50 Mon Sep 17 00:00:00 2001 From: Vexed Date: Fri, 2 Feb 2024 13:28:09 +0000 Subject: [PATCH 4/4] more style... sorry --- anotherpingcog/anotherpingcog.py | 20 ++++++++++++-------- betteruptime/commands.py | 8 +++++--- fivemstatus/loop.py | 6 +++--- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/anotherpingcog/anotherpingcog.py b/anotherpingcog/anotherpingcog.py index d2132111..9d8cb47f 100644 --- a/anotherpingcog/anotherpingcog.py +++ b/anotherpingcog/anotherpingcog.py @@ -154,11 +154,13 @@ async def ping(self, ctx: commands.Context): embed.colour = colour await message.edit( content=( - "Message Send is worse for slash commands. Try using the text command for " - "a better result." - ) - if ctx.interaction - else None, + ( + "Message Send is worse for slash commands. Try using the text command for " + "a better result." + ) + if ctx.interaction + else None + ), embed=embed, ) @@ -501,9 +503,11 @@ async def settings(self, ctx: commands.Context): footer += ( "Default - the default text will be used in the embed footer." if settings.footer == "default" - else "None - there will not be any footer text in the embed." - if settings.footer == "none" - else f"Custom - {settings.footer}" + else ( + "None - there will not be any footer text in the embed." + if settings.footer == "none" + else f"Custom - {settings.footer}" + ) ) main_embed.add_field(name="Footer", value=footer, inline=False) diff --git a/betteruptime/commands.py b/betteruptime/commands.py index b3383fcc..ec4a27a1 100644 --- a/betteruptime/commands.py +++ b/betteruptime/commands.py @@ -178,9 +178,11 @@ async def uptimegraph(self, ctx: commands.Context, num_days: int = 30): embed = discord.Embed( title="Daily uptime data for the last " + str(num_days) + " days", - description=f"The top lowest uptime days (under `{labelled_pc}%`) will be labelled." - if labelled_pc - else None, + description=( + f"The top lowest uptime days (under `{labelled_pc}%`) will be labelled." + if labelled_pc + else None + ), colour=await ctx.embed_colour(), ) embed.set_footer(text="Times are in UTC. This excludes today.") diff --git a/fivemstatus/loop.py b/fivemstatus/loop.py index 58423d8d..ff133c26 100644 --- a/fivemstatus/loop.py +++ b/fivemstatus/loop.py @@ -37,9 +37,9 @@ async def fivemstatus_loop(self) -> NoReturn: await self.loop_meta.sleep_until_next() async def update_messages(self) -> None: - all_guilds: dict[ - int, dict[Literal["message"], MessageData] - ] = await self.config.all_guilds() + all_guilds: dict[int, dict[Literal["message"], MessageData]] = ( + await self.config.all_guilds() + ) if not all_guilds: _log.debug("Nothing registered, nothing to do...") return