diff --git a/backend/src/plugins/Automod/events/runAutomodOnThreadEvents.ts b/backend/src/plugins/Automod/events/runAutomodOnThreadEvents.ts index 449b8ba5..d64900bb 100644 --- a/backend/src/plugins/Automod/events/runAutomodOnThreadEvents.ts +++ b/backend/src/plugins/Automod/events/runAutomodOnThreadEvents.ts @@ -14,6 +14,7 @@ export const RunAutomodOnThreadCreate = typedGuildEventListener c.id === thread.parentId); - messageBlock: if (sourceChannel?.isText()) { + if (sourceChannel?.isText()) { const sourceMessage = sourceChannel.messages.cache.find( (m) => m.thread?.id === thread.id || m.reference?.channelId === thread.id, ); @@ -56,6 +57,7 @@ export const RunAutomodOnThreadDelete = typedGuildEventListener()({ return; } - if (triggerConfig.locked && !context.threadChange.locked) { - return; - } else if (triggerConfig.locked === false && !context.threadChange.unlocked) { + const thread = context.threadChange.archived; + console.log("matching thread_archive"); + + if (typeof triggerConfig.locked === "boolean" && thread.locked !== triggerConfig.locked) { return; } - - const thread = context.threadChange.archived; + console.log("locked pass"); if (triggerConfig.parent) { const parentIds = Array.isArray(triggerConfig.parent) ? triggerConfig.parent : [triggerConfig.parent]; if (thread.parentId && !parentIds.includes(thread.parentId)) return; } - + console.log("parent pass"); return { extra: { matchedThreadId: thread.id, diff --git a/backend/src/plugins/Automod/types.ts b/backend/src/plugins/Automod/types.ts index ed7cf56e..c9aa8865 100644 --- a/backend/src/plugins/Automod/types.ts +++ b/backend/src/plugins/Automod/types.ts @@ -117,6 +117,7 @@ export interface AutomodContext { user?: User; message?: SavedMessage; member?: GuildMember; + thread?: ThreadChannel; partialMember?: GuildMember | PartialGuildMember; joined?: boolean; rolesChanged?: {