/[sudobot]/branches/2.x/src/client/ServiceManager.ts
ViewVC logotype

Contents of /branches/2.x/src/client/ServiceManager.ts

Parent Directory Parent Directory | Revision Log Revision Log


Revision 577 - (show annotations)
Mon Jul 29 18:52:37 2024 UTC (8 months ago) by rakinar2
File MIME type: application/typescript
File size: 777 byte(s)
chore: add old version archive branches (2.x to 9.x-dev)
1 import Service from "../utils/structures/Service";
2 import DiscordClient from "./Client";
3
4 export default class ServiceManager {
5 constructor(protected client: DiscordClient, protected aliases: { [alias: string]: string }= {}) {
6
7 }
8
9 load(services: { [alias: string]: string }) {
10 for (const service of Object.keys(services)) {
11 let path = service;
12
13 for (const alias in this.aliases) {
14 path = path.replace('@' + alias, this.aliases[alias]);
15 }
16
17 console.log('Loading service: ', service);
18
19 const { default: ServiceClass }: { default: typeof Service } = require(path);
20
21 // @ts-ignore
22 this.client[services[service]] = new ServiceClass(this.client);
23 }
24 }
25 }

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26