Skip to content

Commit

Permalink
fix: 1、指令过滤类型声明错误
Browse files Browse the repository at this point in the history
2、适配器初始化时机移动到插件初始化完成后
  • Loading branch information
lc-cn committed Oct 9, 2023
1 parent 487f88f commit 07e4507
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -535,13 +535,13 @@ export namespace Command {
};
export type Filters = AttrFilter<Session> | WithFilter | UnionFilter | ExcludeFilter;
export type WithFilter = {
and: Filters;
$and: Filters;
};
export type UnionFilter = {
or: Filters;
$or: Filters;
};
export type ExcludeFilter = {
not: Filters;
$not: Filters;
};

export function createFilterFunction<T extends Filters>(filters: T) {
Expand Down
14 changes: 7 additions & 7 deletions src/zhin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -488,13 +488,6 @@ export class Zhin extends Context {
async start(mode: "dev" | "prod" | string) {
this.mode = mode;
await this.emitSync("before-start");
for (const adapter of Object.keys(this.options.adapters || {})) {
try {
this.adapter(adapter as keyof Zhin.Adapters, this.options.adapters[adapter]);
} catch (e) {
this.logger.warn(e.message, e.stack);
}
}
const installedPlugins = this.getInstalledModules("plugin");
installedPlugins.forEach(plugin => {
try {
Expand All @@ -517,6 +510,13 @@ export class Zhin extends Context {
this.isReady = true;
await this.emitSync("after-ready");
this.isStarted = true;
for (const adapter of Object.keys(this.options.adapters || {})) {
try {
this.adapter(adapter as keyof Zhin.Adapters, this.options.adapters[adapter]);
} catch (e) {
this.logger.warn(e.message, e.stack);
}
}
this.emit("start");
await this.emitSync("after-start");
}
Expand Down

0 comments on commit 07e4507

Please sign in to comment.