mirror of
https://github.com/sern-handler/sern-community
synced 2026-06-28 02:32:19 +00:00
17 lines
551 B
TypeScript
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();
|
|
});
|
|
}
|