Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ public String getBotToken() {
return config.getString("token", "");
}

// #easteregg
public String getHttpProxyServer() {
return config.getString("http-proxy-server", "");
}

public long getGuildId() {
return config.getLong("guild", 0);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import com.earth2me.essentials.utils.FormatUtil;
import com.earth2me.essentials.utils.NumberUtil;
import com.earth2me.essentials.utils.VersionUtil;
import com.neovisionaries.ws.client.ProxySettings;
import com.neovisionaries.ws.client.WebSocketFactory;
import net.dv8tion.jda.api.JDA;
import net.dv8tion.jda.api.JDABuilder;
import net.dv8tion.jda.api.entities.Guild;
Expand Down Expand Up @@ -168,7 +170,14 @@ public void startup() throws LoginException, InterruptedException {
throw new IllegalArgumentException(tlLiteral("discordErrorNoToken"));
}

final WebSocketFactory wsFactory = new WebSocketFactory();
if (!plugin.getSettings().getHttpProxyServer().trim().isEmpty()) {
final ProxySettings proxySettings = wsFactory.getProxySettings();
proxySettings.setServer(plugin.getSettings().getHttpProxyServer());
}

jda = JDABuilder.createDefault(plugin.getSettings().getBotToken())
.setWebsocketFactory(wsFactory)
.addEventListeners(new DiscordListener(this))
.enableIntents(GatewayIntent.MESSAGE_CONTENT)
.enableCache(CacheFlag.EMOJI)
Expand Down
Loading