diff --git a/changelog.md b/changelog.md index d5c5df9e..a6488764 100644 --- a/changelog.md +++ b/changelog.md @@ -12,10 +12,20 @@ Changes since 2026.06.15 ## Moderation +### Moderator +- Fix /mute command using the wrong datetime object + +### Nickname +- Fix config call missing guild ID + +### Notes +- Fix clear note/note being wrong in modlog entries + ## Operation ### Factoid - Make /factoid call work with factoids with spaces +- Fix permissions on /factoid add ## Utility diff --git a/modules/moderation/moderator.py b/modules/moderation/moderator.py index 92c588c6..3dca1cf1 100644 --- a/modules/moderation/moderator.py +++ b/modules/moderation/moderator.py @@ -2,7 +2,7 @@ from __future__ import annotations -from datetime import datetime, timedelta +from datetime import UTC, datetime, timedelta from typing import TYPE_CHECKING, Self import dateparser @@ -319,7 +319,7 @@ async def handle_mute_user( await interaction.response.send_message(embed=embed) return - expires_at = datetime.datetime.now(datetime.UTC) + delta_duration + expires_at = datetime.now(UTC) + delta_duration result = await moderation.mute_user( user=target, reason=f"{reason} - muted by {interaction.user}", diff --git a/modules/moderation/modlog.py b/modules/moderation/modlog.py index 21915ec9..4c8bfef3 100644 --- a/modules/moderation/modlog.py +++ b/modules/moderation/modlog.py @@ -289,8 +289,6 @@ async def on_audit_log_entry_create( # This is NOT for native automod actions. Because why be even slightly consistent moderator = await self.bot.fetch_user(entry.user_id) - print(moderator) - if not moderator or moderator.bot: return diff --git a/modules/moderation/nickname.py b/modules/moderation/nickname.py index eff212d9..e8a74a5b 100644 --- a/modules/moderation/nickname.py +++ b/modules/moderation/nickname.py @@ -94,7 +94,9 @@ async def match(self: Self, ctx: commands.Context, content: str) -> bool: Returns: bool: If the nickname needs to be changed or not """ - if not configuration.get_config_entry("nickname_enable_on_message"): + if not configuration.get_config_entry( + ctx.guild.id, "nickname_enable_on_message" + ): return False modified_name = format_username(ctx.author.display_name) diff --git a/modules/moderation/notes.py b/modules/moderation/notes.py index 21770e1f..ea3dfde6 100644 --- a/modules/moderation/notes.py +++ b/modules/moderation/notes.py @@ -156,7 +156,7 @@ async def set_note( await modlog.log_action( bot=self.bot, - action_type="clear note", + action_type="note", guild=interaction.guild, member=user, moderator=interaction.user, @@ -234,7 +234,7 @@ async def clear_notes( await modlog.log_action( bot=self.bot, - action_type="note", + action_type="clear note", guild=interaction.guild, member=user, moderator=interaction.user, diff --git a/modules/operation/factoids.py b/modules/operation/factoids.py index 60c2cbb3..587a7895 100644 --- a/modules/operation/factoids.py +++ b/modules/operation/factoids.py @@ -71,6 +71,24 @@ async def has_manage_factoids_role(ctx: commands.Context) -> bool: ) +async def has_manage_factoids_role_interaction( + interaction: discord.Interaction, +) -> bool: + """A command check to determine if the invoker is allowed to modify basic factoids + + Args: + interaction (discord.Interaction): The context the command was run + + Returns: + bool: True if the command can be run, False if it can't + """ + return await has_given_factoids_role( + interaction.guild, + interaction.user, + configuration.get_config_entry(interaction.guild.id, "factoids_manage_roles"), + ) + + async def has_admin_factoids_role(ctx: commands.Context) -> bool: """A command check to determine if the invoker is allowed to modify factoid properties @@ -1113,6 +1131,7 @@ async def factoid_call_command( sent_message, interaction.user, interaction.channel, factoid.message ) + @app_commands.check(has_manage_factoids_role_interaction) @factoid_app_group.command( name="add", description="Creates a new factoid.",