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'; |
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'; |
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 |
|
|
25 |
export default class DiscordClient extends Client { |
export default class DiscordClient extends Client { |
26 |
private _commands = new Collection<string, BaseCommand>(); |
private _commands = new Collection<string, BaseCommand>(); |
27 |
|
private _cliCommands = new Collection<string, BaseCLICommand>(); |
28 |
private _events = new Collection<string, BaseEvent>(); |
private _events = new Collection<string, BaseEvent>(); |
29 |
|
|
30 |
rootdir: string; |
rootdir: string; |
44 |
cooldown: Cooldown; |
cooldown: Cooldown; |
45 |
startupManager: StartupManager; |
startupManager: StartupManager; |
46 |
autoClear: AutoClear; |
autoClear: AutoClear; |
47 |
|
randomStatus: RandomStatus; |
48 |
|
debugLogger: DebugLogger; |
49 |
|
verification: Verification; |
50 |
|
|
51 |
static client: DiscordClient; |
static client: DiscordClient; |
52 |
|
|
53 |
constructor(options: ClientOptions, rootdir: string = __dirname) { |
constructor(options: ClientOptions, rootdir: string = __dirname) { |
54 |
super({ |
super({ |
55 |
ws: { |
ws: { |
56 |
properties: { |
properties: { |
57 |
$browser: "Discord iOS" |
$browser: "Discord iOS" |
58 |
} |
} |
59 |
}, |
}, |
60 |
...options |
...options |
61 |
}); |
}); |
62 |
|
|
63 |
|
console.log('init'); |
64 |
|
|
65 |
this.rootdir = rootdir; |
this.rootdir = rootdir; |
66 |
|
|
67 |
|
DiscordClient.client = this; |
68 |
|
|
69 |
this.config = new Config(this); |
this.config = new Config(this); |
70 |
this.db = new Database(path.resolve(rootdir, 'database.db'), this); |
this.db = new Database(path.resolve(rootdir, 'database.db'), this); |
80 |
this.cooldown = new Cooldown(this); |
this.cooldown = new Cooldown(this); |
81 |
this.startupManager = new StartupManager(this); |
this.startupManager = new StartupManager(this); |
82 |
this.autoClear = new AutoClear(this); |
this.autoClear = new AutoClear(this); |
83 |
|
this.randomStatus = new RandomStatus(this); |
84 |
|
this.debugLogger = new DebugLogger(this); |
85 |
|
this.verification = new Verification(this); |
86 |
|
|
87 |
DiscordClient.client = this; |
discordModals(this); |
88 |
} |
} |
89 |
|
|
90 |
get commands(): Collection<string, BaseCommand> { |
get commands(): Collection<string, BaseCommand> { |
91 |
return this._commands; |
return this._commands; |
92 |
} |
} |
93 |
|
|
94 |
|
get cliCommands(): Collection<string, BaseCLICommand> { |
95 |
|
return this._cliCommands; |
96 |
|
} |
97 |
|
|
98 |
get events(): Collection<string, BaseEvent> { |
get events(): Collection<string, BaseEvent> { |
99 |
return this._events; |
return this._events; |
100 |
} |
} |