Commit 56e412fe authored by nanahira's avatar nanahira

add dupe register check

parent bcea58d2
......@@ -7,6 +7,7 @@ import {
KoishiServiceProvideSym,
KoishiSystemInjectSym,
KoishiSystemInjectSymKeys,
ThirdEyeSym,
} from './def';
import { reflector } from './meta/meta-fetch';
import { SchemaClass } from 'schemastery-gen';
......@@ -62,6 +63,9 @@ export function DefinePlugin<T = any>(
if (options.using) {
UsingService(...options.using)(originalClass);
}
if (originalClass[ThirdEyeSym]) {
return originalClass;
}
const newClass = class extends originalClass implements PluginClass {
static get Config() {
const schemaType =
......@@ -243,6 +247,7 @@ export function DefinePlugin<T = any>(
reflector.get('KoishiPredefineName', originalClass) ||
originalClass.name,
});
newClass[ThirdEyeSym] = true;
return newClass;
};
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment