Skip to content

Commit

Permalink
fix: properly load plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
KagChi committed Jul 9, 2024
1 parent 0678d13 commit bd775a7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Stores/PluginStore.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import { Store } from "@sapphire/pieces";
import { Plugin } from "./Plugin.js";
import { FastifyInstance } from "fastify";

export class PluginStore extends Store<Plugin> {
public constructor() {
super(Plugin, { name: "plugins" });
}

public async run(fastify: FastifyInstance): Promise<void> {
await Promise.all(this.map(x => x.run(fastify)));
}
}
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const fasting = async (fastify: FastifyInstance, options: FastingOptions): Promi

fastify.decorate("fasting-stores", stores);

await stores.get("plugins").run(fastify);
await fastify.register(middie);
await stores.load();
};
Expand Down

0 comments on commit bd775a7

Please sign in to comment.