Files
sern-community/src/plugins/onCorrectThread.ts
2024-05-09 22:27:02 -05:00

17 lines
551 B
TypeScript

import { controller, DiscordEventControlPlugin } from "@sern/handler";
import { ChannelType } from "discord.js";
export function onCorrectThread(parentId: string) {
return DiscordEventControlPlugin("threadCreate", (thread, newlyMade) => {
const isBadThread =
!thread.parent ||
thread.parentId !== parentId ||
thread.parent.type !== ChannelType.GuildForum ||
!newlyMade;
if (!isBadThread) {
return controller.next();
}
return controller.stop();
});
}