mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-07-11 13:07:20 +00:00
added parent info in the matchSummary
This commit is contained in:
parent
fcfc96c30d
commit
723995f30c
2 changed files with 20 additions and 8 deletions
|
@ -7,6 +7,8 @@ import { automodTrigger } from "../helpers";
|
|||
interface ThreadCreateResult {
|
||||
matchedThreadId: Snowflake;
|
||||
matchedThreadName: string;
|
||||
matchedThreadParentId: Snowflake;
|
||||
matchedThreadParentName: string;
|
||||
matchedThreadOwner: User | undefined;
|
||||
}
|
||||
|
||||
|
@ -33,6 +35,8 @@ export const ThreadCreateTrigger = automodTrigger<ThreadCreateResult>()({
|
|||
extra: {
|
||||
matchedThreadId: thread.id,
|
||||
matchedThreadName: thread.name,
|
||||
matchedThreadParentId: thread.parentId ?? "Unknown",
|
||||
matchedThreadParentName: thread.parent?.name ?? "Unknown",
|
||||
matchedThreadOwner: context.user,
|
||||
},
|
||||
};
|
||||
|
@ -42,11 +46,12 @@ export const ThreadCreateTrigger = automodTrigger<ThreadCreateResult>()({
|
|||
const threadId = matchResult.extra.matchedThreadId;
|
||||
const threadName = matchResult.extra.matchedThreadName;
|
||||
const threadOwner = matchResult.extra.matchedThreadOwner;
|
||||
const parentId = matchResult.extra.matchedThreadParentId;
|
||||
const parentName = matchResult.extra.matchedThreadParentName;
|
||||
const base = `Thread **#${threadName}** (\`${threadId}\`) has been created in the **#${parentName}** (\`${parentId}\`) channel`;
|
||||
if (threadOwner) {
|
||||
return `Thread **#${Util.escapeBold(threadName)}** (\`${threadId}\`) has been created by **${
|
||||
threadOwner.tag
|
||||
}** (\`${threadOwner.id}\`)`;
|
||||
return `${base} by **${Util.escapeBold(threadOwner.tag)}** (\`${threadOwner.id}\`)`;
|
||||
}
|
||||
return `Thread **#${Util.escapeBold(threadName)}** (\`${threadId}\`) has been created`;
|
||||
return base;
|
||||
},
|
||||
});
|
||||
|
|
|
@ -7,6 +7,8 @@ import { automodTrigger } from "../helpers";
|
|||
interface ThreadDeleteResult {
|
||||
matchedThreadId: Snowflake;
|
||||
matchedThreadName: string;
|
||||
matchedThreadParentId: Snowflake;
|
||||
matchedThreadParentName: string;
|
||||
matchedThreadOwner: User | undefined;
|
||||
}
|
||||
|
||||
|
@ -33,6 +35,8 @@ export const ThreadDeleteTrigger = automodTrigger<ThreadDeleteResult>()({
|
|||
extra: {
|
||||
matchedThreadId: thread.id,
|
||||
matchedThreadName: thread.name,
|
||||
matchedThreadParentId: thread.parentId ?? "Unknown",
|
||||
matchedThreadParentName: thread.parent?.name ?? "Unknown",
|
||||
matchedThreadOwner: context.user,
|
||||
},
|
||||
};
|
||||
|
@ -40,13 +44,16 @@ export const ThreadDeleteTrigger = automodTrigger<ThreadDeleteResult>()({
|
|||
|
||||
renderMatchInformation({ matchResult }) {
|
||||
const threadId = matchResult.extra.matchedThreadId;
|
||||
const threadName = matchResult.extra.matchedThreadName;
|
||||
const threadOwner = matchResult.extra.matchedThreadOwner;
|
||||
const threadName = matchResult.extra.matchedThreadName;
|
||||
const parentId = matchResult.extra.matchedThreadParentId;
|
||||
const parentName = matchResult.extra.matchedThreadParentName;
|
||||
if (threadOwner) {
|
||||
return `Thread **${Util.escapeBold(threadName ?? "Unknown")}** (\`${threadId}\`) created by **${Util.escapeBold(
|
||||
return `Thread **#${threadName ?? "Unknown"}** (\`${threadId}\`) created by **${Util.escapeBold(
|
||||
threadOwner.tag,
|
||||
)}** (\`${threadOwner.id}\`) has been deleted`;
|
||||
)}** (\`${threadOwner.id}\`) in the **#${parentName}** (\`${parentId}\`) channel has been deleted`;
|
||||
}
|
||||
return `Thread **${Util.escapeBold(threadName ?? "Unknown")}** (\`${threadId}\`) has been deleted`;
|
||||
return `Thread **#${threadName ??
|
||||
"Unknown"}** (\`${threadId}\`) from the **#${parentName}** (\`${parentId}\`) channel has been deleted`;
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue