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 |
|
import Automute from '../automod/Automute'; |
27 |
|
|
28 |
export default class DiscordClient extends Client { |
export default class DiscordClient extends Client { |
29 |
private _commands = new Collection<string, BaseCommand>(); |
private _commands = new Collection<string, BaseCommand>(); |
30 |
|
private _cliCommands = new Collection<string, BaseCLICommand>(); |
31 |
private _events = new Collection<string, BaseEvent>(); |
private _events = new Collection<string, BaseEvent>(); |
32 |
|
|
33 |
rootdir: string; |
rootdir: string; |
46 |
server: Server; |
server: Server; |
47 |
cooldown: Cooldown; |
cooldown: Cooldown; |
48 |
startupManager: StartupManager; |
startupManager: StartupManager; |
49 |
|
autoClear: AutoClear; |
50 |
|
randomStatus: RandomStatus; |
51 |
|
debugLogger: DebugLogger; |
52 |
|
verification: Verification; |
53 |
|
welcomer: Welcomer; |
54 |
|
antijoin: Antijoin; |
55 |
|
automute: Automute; |
56 |
|
|
57 |
static client: DiscordClient; |
static client: DiscordClient; |
58 |
|
|
59 |
constructor(options: ClientOptions, rootdir: string = __dirname) { |
constructor(options: ClientOptions, rootdir: string = __dirname) { |
60 |
super({ |
super({ |
61 |
ws: { |
ws: { |
62 |
properties: { |
properties: { |
63 |
$browser: "Discord iOS" |
browser: "Discord iOS" |
64 |
} |
} |
65 |
}, |
}, |
66 |
...options |
...options |
67 |
}); |
}); |
68 |
|
|
69 |
|
console.log('init'); |
70 |
|
|
71 |
this.rootdir = rootdir; |
this.rootdir = rootdir; |
72 |
|
|
73 |
|
DiscordClient.client = this; |
74 |
|
|
75 |
this.config = new Config(this); |
this.config = new Config(this); |
76 |
this.db = new Database(path.resolve(rootdir, 'database.db'), this); |
this.db = new Database(path.resolve(rootdir, 'database.db'), this); |
85 |
this.server = new Server(this); |
this.server = new Server(this); |
86 |
this.cooldown = new Cooldown(this); |
this.cooldown = new Cooldown(this); |
87 |
this.startupManager = new StartupManager(this); |
this.startupManager = new StartupManager(this); |
88 |
|
this.autoClear = new AutoClear(this); |
89 |
|
this.randomStatus = new RandomStatus(this); |
90 |
|
this.debugLogger = new DebugLogger(this); |
91 |
|
this.verification = new Verification(this); |
92 |
|
this.welcomer = new Welcomer(this); |
93 |
|
this.antijoin = new Antijoin(this); |
94 |
|
this.automute = new Automute(this); |
95 |
|
|
96 |
DiscordClient.client = this; |
discordModals(this); |
97 |
} |
} |
98 |
|
|
99 |
get commands(): Collection<string, BaseCommand> { |
get commands(): Collection<string, BaseCommand> { |
100 |
return this._commands; |
return this._commands; |
101 |
} |
} |
102 |
|
|
103 |
|
get cliCommands(): Collection<string, BaseCLICommand> { |
104 |
|
return this._cliCommands; |
105 |
|
} |
106 |
|
|
107 |
get events(): Collection<string, BaseEvent> { |
get events(): Collection<string, BaseEvent> { |
108 |
return this._events; |
return this._events; |
109 |
} |
} |