@sapphire/plugin-api 3.2.2-next.3825ab5.0 → 3.2.2-next.713221c.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/register.ts +0 -40
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sapphire/plugin-api",
3
- "version": "3.2.2-next.3825ab5.0",
3
+ "version": "3.2.2-next.713221c.0",
4
4
  "description": "Plugin for @sapphire/framework to expose a REST API",
5
5
  "author": "@sapphire",
6
6
  "license": "MIT",
@@ -52,7 +52,7 @@
52
52
  "dist/**/*.js*",
53
53
  "dist/**/*.mjs*",
54
54
  "dist/**/*.d*",
55
- "register.*"
55
+ "./register.*"
56
56
  ],
57
57
  "engines": {
58
58
  "node": ">=v14.0.0",
package/src/register.ts DELETED
@@ -1,40 +0,0 @@
1
- import './index';
2
- import { Plugin, postInitialization, preLogin, SapphireClient } from '@sapphire/framework';
3
- import type { ClientOptions } from 'discord.js';
4
- import { join } from 'path';
5
- import { Server } from './lib/structures/http/Server';
6
-
7
- /**
8
- * @since 1.0.0
9
- */
10
- export class Api extends Plugin {
11
- /**
12
- * @since 1.0.0
13
- */
14
- public static [postInitialization](this: SapphireClient, options: ClientOptions): void {
15
- this.server = new Server(options.api);
16
- this.stores
17
- .register(this.server.routes) //
18
- .register(this.server.mediaParsers)
19
- .register(this.server.middlewares);
20
-
21
- this.stores.get('listeners').registerPath(join(__dirname, 'listeners'));
22
- this.server.routes.registerPath(join(__dirname, 'routes'));
23
- this.server.middlewares.registerPath(join(__dirname, 'middlewares'));
24
- this.server.mediaParsers.registerPath(join(__dirname, 'mediaParsers'));
25
- }
26
-
27
- /**
28
- * @since 1.0.0
29
- */
30
- public static async [preLogin](this: SapphireClient): Promise<void> {
31
- if (!(this.server.options.automaticallyConnect ?? true)) {
32
- return;
33
- }
34
-
35
- await this.server.connect();
36
- }
37
- }
38
-
39
- SapphireClient.plugins.registerPostInitializationHook(Api[postInitialization], 'API-PostInitialization');
40
- SapphireClient.plugins.registerPreLoginHook(Api[preLogin], 'API-PreLogin');