Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CmdLog] Fix the exception - object has no attribute 'target' #128

Merged
merged 4 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions anotherpingcog/anotherpingcog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

Expand Down Expand Up @@ -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)

Expand Down
8 changes: 5 additions & 3 deletions betteruptime/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down
6 changes: 3 additions & 3 deletions cmdlog/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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 += getsizeof(getattr(self, "target", 0))

return size
2 changes: 1 addition & 1 deletion docs/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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<https://discord.gg/GD43Nb9H86>` server,
If you want some help with my cogs, you can ask in the `Red - Cog Support<https://discord.gg/GD43Nb9H86>`_ server,
in #support_vex-cogs.
1 change: 1 addition & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
furo
sphinx-rtd-theme
6 changes: 3 additions & 3 deletions fivemstatus/loop.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading