diff --git a/config.example.toml b/config.example.toml
index 5c16c03c..7cb4bf45 100644
--- a/config.example.toml
+++ b/config.example.toml
@@ -70,6 +70,7 @@ embed_color = "ffb800"
[logs]
show_log_on_edit = true
show_log_on_delete = true
+hide_ticket_rename_logs = false
[updates]
enabled = true
diff --git a/crates/rustmail/src/handlers/guild_moderation_handler.rs b/crates/rustmail/src/handlers/guild_moderation_handler.rs
index fd94e581..8c9d9a42 100644
--- a/crates/rustmail/src/handlers/guild_moderation_handler.rs
+++ b/crates/rustmail/src/handlers/guild_moderation_handler.rs
@@ -4,10 +4,10 @@ use crate::prelude::db::*;
use crate::prelude::features::*;
use crate::prelude::i18n::*;
use crate::prelude::utils::*;
-use serenity::all::audit_log::Action;
+use serenity::all::audit_log::{Action, Change};
use serenity::all::{ButtonStyle, ChannelAction};
use serenity::{
- all::{AuditLogEntry, ChannelId, Context, EventHandler, GuildId},
+ all::{AuditLogEntry, ChannelId, Context, EventHandler, GuildId, UserId},
async_trait,
};
@@ -90,6 +90,21 @@ async fn manage_creating_ticket_via_opening_thread(
.await;
}
+fn is_bot_channel_rename(entry: &AuditLogEntry, bot_id: UserId) -> bool {
+ let Action::Channel(ChannelAction::Update) = entry.action else {
+ return false;
+ };
+ if entry.user_id != bot_id {
+ return false;
+ }
+ match entry.changes.as_deref() {
+ Some(changes) if !changes.is_empty() => changes
+ .iter()
+ .all(|change| matches!(change, Change::Name { .. })),
+ _ => false,
+ }
+}
+
#[async_trait]
impl EventHandler for GuildModerationHandler {
async fn guild_audit_log_entry_create(
@@ -118,6 +133,12 @@ impl EventHandler for GuildModerationHandler {
None => return,
};
+ if self.config.logs.hide_ticket_rename_logs
+ && is_bot_channel_rename(&entry, ctx.cache.current_user().id)
+ {
+ return;
+ }
+
let user = match entry.user_id.to_user(ctx.clone()).await {
Ok(user) => user,
Err(_) => {
diff --git a/crates/rustmail_panel/src/components/configuration.rs b/crates/rustmail_panel/src/components/configuration.rs
index 506465f4..a4533d6d 100644
--- a/crates/rustmail_panel/src/components/configuration.rs
+++ b/crates/rustmail_panel/src/components/configuration.rs
@@ -1637,6 +1637,19 @@ fn logs_reminder_section(props: &LogsReminderSectionProps) -> Html {
}}
/>
+