File tree 3 files changed +13
-11
lines changed
3 files changed +13
-11
lines changed Original file line number Diff line number Diff line change 1
1
const path = require ( 'path' )
2
2
const { AkairoClient, CommandHandler, ListenerHandler } = require ( 'discord-akairo' )
3
- const Sync = require ( './sync.js' )
4
- const HubServer = require ( './hubServer.js' )
5
3
const database = require ( '../database/index.js' )
6
4
const { ownerID, prefix } = require ( '../config.js' )
7
- const EmojiVotingPoll = require ( './poll/EmojiVotingPoll.js' )
8
- const RenameVotingPoll = require ( './poll/RenameVotingPoll.js' )
9
5
10
6
module . exports = class RinonClient extends AkairoClient {
11
7
constructor ( ) {
@@ -45,13 +41,8 @@ module.exports = class RinonClient extends AkairoClient {
45
41
this . commandHandler . useListenerHandler ( this . listenerHandler )
46
42
this . listenerHandler . loadAll ( )
47
43
48
- this . once ( 'ready' , ( ) => {
49
- this . sync = new Sync ( this )
50
- this . hubServer = new HubServer ( this )
51
- // NOTE: This stays here because the 2 classes depend on the `hubServer[votingChannel]` props
52
- this . hubServer . polls = { emoji : new EmojiVotingPoll ( this ) , rename : new RenameVotingPoll ( this ) }
53
- this . sync . status ( )
54
- } )
44
+ this . sync = null
45
+ this . hubServer = null
55
46
}
56
47
57
48
async login ( token ) {
Original file line number Diff line number Diff line change 1
1
const { hubServerID } = require ( '../config.js' )
2
2
const regexes = require ( '../util/regexes.js' )
3
+ const EmojiVotingPoll = require ( './poll/EmojiVotingPoll.js' )
4
+ const RenameVotingPoll = require ( './poll/RenameVotingPoll.js' )
3
5
4
6
module . exports = class HubServer {
5
7
constructor ( client ) {
6
8
this . client = client
7
9
this . guild = client . guilds . cache . get ( hubServerID )
10
+ this . polls = {
11
+ emoji : new EmojiVotingPoll ( client ) ,
12
+ rename : new RenameVotingPoll ( client ) ,
13
+ }
8
14
}
9
15
10
16
_getChannel ( name ) {
Original file line number Diff line number Diff line change 1
1
const { Listener } = require ( 'discord-akairo' )
2
+ const Sync = require ( '../core/sync.js' )
3
+ const HubServer = require ( '../core/hubServer.js' )
2
4
3
5
module . exports = class ReadyListener extends Listener {
4
6
constructor ( ) {
@@ -10,6 +12,9 @@ module.exports = class ReadyListener extends Listener {
10
12
}
11
13
12
14
exec ( ) {
15
+ this . client . sync = new Sync ( this . client )
16
+ this . client . hubServer = new HubServer ( this . client )
17
+ this . client . sync . status ( )
13
18
console . log ( `${ this . client . user . tag } ready!` )
14
19
}
15
20
}
You can’t perform that action at this time.
0 commit comments