diff --git a/packages/hydrooj/src/entry/common.ts b/packages/hydrooj/src/entry/common.ts index bca116946..d65913dac 100644 --- a/packages/hydrooj/src/entry/common.ts +++ b/packages/hydrooj/src/entry/common.ts @@ -68,7 +68,7 @@ export const service = getLoader('service', 'service'); export async function builtinModel(ctx: Context) { const modelDir = path.resolve(__dirname, '..', 'model'); const models = await fs.readdir(modelDir); - for (const t of models) { + for (const t of models.filter((i) => i.endsWith('.ts'))) { const q = path.resolve(modelDir, t); if ('apply' in require(q)) ctx.loader.reloadPlugin(ctx, q, {}, `hydrooj/model/${t.split('.')[0]}`); } diff --git a/packages/hydrooj/src/entry/worker.ts b/packages/hydrooj/src/entry/worker.ts index 610aaf3f0..4bab46a3f 100644 --- a/packages/hydrooj/src/entry/worker.ts +++ b/packages/hydrooj/src/entry/worker.ts @@ -56,7 +56,7 @@ export async function apply(ctx: Context) { const handlerDir = path.resolve(__dirname, '..', 'handler'); const handlers = await fs.readdir(handlerDir); - for (const h of handlers) { + for (const h of handlers.filter((i) => i.endsWith('.ts'))) { ctx.loader.reloadPlugin(ctx, path.resolve(handlerDir, h), {}, `hydrooj/handler/${h.split('.')[0]}`); } await handler(pending, fail, ctx);