|
54 | 54 |
|
55 | 55 | public final class SkyBot { |
56 | 56 | private static SkyBot instance; |
57 | | - private final ShardManager shardManager; |
58 | | - private WebSocketClient client; |
59 | | - |
60 | 57 | private static final MemberCachePolicy PATRON_POLICY = (member) -> { |
61 | 58 | // Member needs to be cached for JDA to fire role update event |
62 | 59 | // the guild check is required for JDA to catch role updates in the support guild |
63 | 60 | return member.getGuild().getIdLong() == Settings.SUPPORT_GUILD_ID && |
64 | 61 | member.getRoles().stream().anyMatch((role) -> role.getIdLong() == Settings.PATRONS_ROLE); |
65 | 62 | }; |
| 63 | + private final ShardManager shardManager; |
| 64 | + private WebSocketClient client; |
66 | 65 |
|
67 | | - // Sigh, might need to convert this to spring |
68 | | - @SuppressWarnings("PMD.AssignmentToNonFinalStatic") |
69 | 66 | private SkyBot() throws LoginException { |
70 | | - instance = this; |
71 | | - |
72 | 67 | // Load in our container |
73 | 68 | final Variables variables = new Variables(); |
74 | 69 |
|
@@ -102,13 +97,13 @@ private SkyBot() throws LoginException { |
102 | 97 | final EventManager eventManager = new EventManager(variables); |
103 | 98 | // Build our shard manager |
104 | 99 | final DefaultShardManagerBuilder builder = DefaultShardManagerBuilder.create( |
105 | | - GatewayIntent.GUILD_MEMBERS, |
106 | | - GatewayIntent.GUILD_INVITES, |
107 | | - GatewayIntent.GUILD_BANS, |
108 | | - GatewayIntent.GUILD_EMOJIS, |
109 | | - GatewayIntent.GUILD_VOICE_STATES, |
110 | | - GatewayIntent.GUILD_MESSAGES |
111 | | - ) |
| 100 | + GatewayIntent.GUILD_MEMBERS, |
| 101 | + GatewayIntent.GUILD_INVITES, |
| 102 | + GatewayIntent.GUILD_BANS, |
| 103 | + GatewayIntent.GUILD_EMOJIS, |
| 104 | + GatewayIntent.GUILD_VOICE_STATES, |
| 105 | + GatewayIntent.GUILD_MESSAGES |
| 106 | + ) |
112 | 107 | .setToken(token) |
113 | 108 | .setShardsTotal(totalShards) |
114 | 109 | .setActivityProvider((shardId) -> Activity.playing( |
@@ -138,7 +133,7 @@ private SkyBot() throws LoginException { |
138 | 133 | this.shardManager = builder.build(); |
139 | 134 |
|
140 | 135 | HelpEmbeds.init(commandManager); |
141 | | - |
| 136 | + |
142 | 137 | if (config.websocket.enable) { |
143 | 138 | client = new WebSocketClient(variables, shardManager); |
144 | 139 | } |
@@ -185,7 +180,7 @@ public WebSocketClient getWebsocketClient() { |
185 | 180 | } |
186 | 181 |
|
187 | 182 | public static void main(final String[] args) throws LoginException { |
188 | | - new SkyBot(); |
| 183 | + instance = new SkyBot(); |
189 | 184 | } |
190 | 185 |
|
191 | 186 | public static SkyBot getInstance() { |
|
0 commit comments