check that endpoint is in fact an endpoint

This commit is contained in:
Erik 2022-11-21 16:34:43 +02:00
parent 893aed0945
commit 06a97858d9

View File

@ -1,6 +1,7 @@
const path = require('node:path');
const fs = require('node:fs');
const {Endpoint: BaseEndpoint} = require('../interfaces')
const { Util } = require('../../util');
const { Collection } = require('@discordjs/collection');
@ -50,6 +51,7 @@ class Registry {
continue;
}
const endpoint = new Endpoint(server);
if(!(endpoint instanceof BaseEndpoint)) throw new Error(`Attempt to load invalid endpoint at ${file.name}`)
endpoint.init();
if (endpoints.has(endpoint.resolveable)) throw new Error(`Error registering endpoint ${endpoint.resolveable}: an endpoint with that resolveable already exists`);