Skip to content
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
10 changes: 10 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions modules/moderation/moderator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}",
Expand Down
2 changes: 0 additions & 2 deletions modules/moderation/modlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion modules/moderation/nickname.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions modules/moderation/notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
19 changes: 19 additions & 0 deletions modules/operation/factoids.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.",
Expand Down
Loading