Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Vexed01/Vex-Cogs
Browse files Browse the repository at this point in the history
  • Loading branch information
Vexed01 committed Jun 30, 2024
2 parents 4f82897 + a856cd0 commit 9ce4893
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
4 changes: 2 additions & 2 deletions cmdlog/cmdlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class CmdLog(commands.Cog):
"""

__author__ = "@vexingvexed"
__version__ = "1.5.4"
__version__ = "1.5.5"

def __init__(self, bot: Red) -> None:
self.bot = bot
Expand Down Expand Up @@ -201,7 +201,7 @@ async def on_interaction(self, inter: "Interaction"):
target = None

log_obj = LoggedAppCom(
author=inter.user,
user=inter.user,
com_name=inter.command.name,
channel=inter.channel,
guild=inter.guild,
Expand Down
18 changes: 9 additions & 9 deletions cmdlog/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,14 @@ class LoggedAppCom(Log):

def __init__(
self,
author: discord.Member | discord.User,
user: discord.Member | discord.User,
com_name: str,
channel: discord.interactions.InteractionChannel | None,
guild: discord.Guild | None,
app_type: Literal[1, 2, 3],
target: discord.PartialMessage | discord.User | None,
):
self.author = BasicDiscordObject(author.id, str(author))
self.user = BasicDiscordObject(user.id, str(user))
self.command = com_name
self.channel = (
BasicDiscordObject(channel.id, channel.name)
Expand All @@ -174,11 +174,11 @@ def __str__(self) -> str: # this is what's logged locally
if self.app_type == 1: # slash com
if not self.guild or not self.channel:
return (
f"Slash command [{self.command}] ran by {self.author.id} [{str(self.author)}]"
f"Slash command [{self.command}] ran by {self.user.id} [{str(self.user)}]"
" in our DMs."
)
return (
f"Slash command [{self.command}] ran by {self.author.id} [{str(self.author)}] "
f"Slash command [{self.command}] ran by {self.user.id} [{str(self.user)}] "
f"in channel {self.channel.id} [{self.channel.name}] "
f"in guild {self.guild.id} [{self.guild.name}]"
)
Expand All @@ -191,13 +191,13 @@ def __str__(self) -> str: # this is what's logged locally
)
if not self.guild or not self.channel:
return (
f"User command [{self.command}] ran by {self.author.id} [{str(self.author)}] "
f"User command [{self.command}] ran by {self.user.id} [{str(self.user)}] "
f"targeting user {self.target.name} [{self.target.id}]"
"in our DMs."
)

return (
f"User command [{self.command}] ran by {self.author.id} [{str(self.author)}] "
f"User command [{self.command}] ran by {self.user.id} [{str(self.user)}] "
f"targeting user {self.target.name} [{self.target.id}]"
f"in channel {self.channel.id} [{self.channel.name}] "
f"in guild {self.guild.id} [{self.guild.name}]"
Expand All @@ -209,12 +209,12 @@ def __str__(self) -> str: # this is what's logged locally
if not self.guild or not self.channel:
return (
f"Message command [{self.command}] ran by"
f" {self.author.id} [{str(self.author)}] targeting message {self.target.id}in"
f" {self.user.id} [{str(self.user)}] targeting message {self.target.id}in"
" our DMs."
)

return (
f"Message command [{self.command}] ran by {self.author.id} [{str(self.author)}] "
f"Message command [{self.command}] ran by {self.user.id} [{str(self.user)}] "
f"targeting message {self.target.id}"
f"in channel {self.channel.id} [{self.channel.name}] "
f"in guild {self.guild.id} [{self.guild.name}]"
Expand All @@ -227,7 +227,7 @@ def __sizeof__(self) -> int:
size = 0

size += getsizeof(self.command)
size += getsizeof(self.author)
size += getsizeof(self.user)
size += getsizeof(self.app_type)
size += getsizeof(self.channel)
size += getsizeof(self.guild)
Expand Down
8 changes: 8 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,14 @@ CaseInsensitive
CmdLog
======

*********
``1.5.5``
*********

2024-05-23

- Fix error with ``cmdlog user`` when a slash/app command has been used

*********
``1.5.4``
*********
Expand Down

0 comments on commit 9ce4893

Please sign in to comment.