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