5 |
import Database from './Database'; |
import Database from './Database'; |
6 |
import path from 'path'; |
import path from 'path'; |
7 |
import Logger from '../automod/Logger'; |
import Logger from '../automod/Logger'; |
|
import SpamFilter from '../automod/SpamFilter'; |
|
8 |
import SnippetManager from '../services/SnippetManager'; |
import SnippetManager from '../services/SnippetManager'; |
9 |
import AFKEngine from '../services/AFKEngine'; |
import AFKEngine from '../services/AFKEngine'; |
10 |
import Auth from '../services/Auth'; |
import Auth from '../services/Auth'; |
14 |
import Server from '../api/Server'; |
import Server from '../api/Server'; |
15 |
import Cooldown from '../automod/Cooldown'; |
import Cooldown from '../automod/Cooldown'; |
16 |
import StartupManager from '../services/StartupManager'; |
import StartupManager from '../services/StartupManager'; |
17 |
|
import AutoClear from '../automod/AutoClear'; |
18 |
|
import RandomStatus from '../services/RandomStatus'; |
19 |
|
import DebugLogger from '../services/DebugLogger'; |
20 |
|
import BaseCLICommand from '../utils/structures/BaseCLICommand'; |
21 |
|
import discordModals from 'discord-modals'; |
22 |
|
import SpamFilter from '../automod/SpamFilter'; |
23 |
|
import Verification from '../services/Verification'; |
24 |
|
import Welcomer from '../services/Welcomer'; |
25 |
|
import Antijoin from '../automod/Antijoin'; |
26 |
|
|
27 |
export default class DiscordClient extends Client { |
export default class DiscordClient extends Client { |
28 |
private _commands = new Collection<string, BaseCommand>(); |
private _commands = new Collection<string, BaseCommand>(); |
29 |
|
private _cliCommands = new Collection<string, BaseCLICommand>(); |
30 |
private _events = new Collection<string, BaseEvent>(); |
private _events = new Collection<string, BaseEvent>(); |
31 |
|
|
32 |
rootdir: string; |
rootdir: string; |
45 |
server: Server; |
server: Server; |
46 |
cooldown: Cooldown; |
cooldown: Cooldown; |
47 |
startupManager: StartupManager; |
startupManager: StartupManager; |
48 |
|
autoClear: AutoClear; |
49 |
|
randomStatus: RandomStatus; |
50 |
|
debugLogger: DebugLogger; |
51 |
|
verification: Verification; |
52 |
|
welcomer: Welcomer; |
53 |
|
antijoin: Antijoin; |
54 |
|
|
55 |
static client: DiscordClient; |
static client: DiscordClient; |
56 |
|
|
57 |
constructor(options: ClientOptions, rootdir: string = __dirname) { |
constructor(options: ClientOptions, rootdir: string = __dirname) { |
58 |
super({ |
super({ |
59 |
ws: { |
ws: { |
60 |
properties: { |
properties: { |
61 |
$browser: "Discord iOS" |
browser: "Discord iOS" |
62 |
} |
} |
63 |
}, |
}, |
64 |
...options |
...options |
65 |
}); |
}); |
66 |
|
|
67 |
|
console.log('init'); |
68 |
|
|
69 |
this.rootdir = rootdir; |
this.rootdir = rootdir; |
70 |
|
|
71 |
|
DiscordClient.client = this; |
72 |
|
|
73 |
this.config = new Config(this); |
this.config = new Config(this); |
74 |
this.db = new Database(path.resolve(rootdir, 'database.db'), this); |
this.db = new Database(path.resolve(rootdir, 'database.db'), this); |
83 |
this.server = new Server(this); |
this.server = new Server(this); |
84 |
this.cooldown = new Cooldown(this); |
this.cooldown = new Cooldown(this); |
85 |
this.startupManager = new StartupManager(this); |
this.startupManager = new StartupManager(this); |
86 |
|
this.autoClear = new AutoClear(this); |
87 |
|
this.randomStatus = new RandomStatus(this); |
88 |
|
this.debugLogger = new DebugLogger(this); |
89 |
|
this.verification = new Verification(this); |
90 |
|
this.welcomer = new Welcomer(this); |
91 |
|
this.antijoin = new Antijoin(this); |
92 |
|
|
93 |
DiscordClient.client = this; |
discordModals(this); |
94 |
} |
} |
95 |
|
|
96 |
get commands(): Collection<string, BaseCommand> { |
get commands(): Collection<string, BaseCommand> { |
97 |
return this._commands; |
return this._commands; |
98 |
} |
} |
99 |
|
|
100 |
|
get cliCommands(): Collection<string, BaseCLICommand> { |
101 |
|
return this._cliCommands; |
102 |
|
} |
103 |
|
|
104 |
get events(): Collection<string, BaseEvent> { |
get events(): Collection<string, BaseEvent> { |
105 |
return this._events; |
return this._events; |
106 |
} |
} |