forked from pinano-discord/Pinano-Discord-Bot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodule_manager.js
More file actions
48 lines (38 loc) · 939 Bytes
/
module_manager.js
File metadata and controls
48 lines (38 loc) · 939 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
class ModuleManager {
constructor (client, guild, dispatcher, persistence, config) {
this._client = client
this._guild = guild
this._dispatcher = dispatcher
this._persistence = persistence
this._config = config
this._modules = new Map()
}
registerModule (name, module) {
this._modules.set(name, module)
}
getClient () {
return this._client
}
getGuild () {
return this._guild
}
getDispatcher () {
return this._dispatcher
}
getPersistence () {
return this._persistence
}
getConfig () {
return this._config
}
getModule (name) {
return this._modules.get(name)
}
completeInitialization () {
this._modules.forEach(module => { module.resume() })
}
}
function createModuleManager (client, guild, dispatcher, persistence, config) {
return new ModuleManager(client, guild, dispatcher, persistence, config)
}
module.exports = createModuleManager