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