Greg dev #62

Merged
greg6775 merged 2 commits from greg-dev into master 2019-11-16 18:36:08 +01:00
2 changed files with 21 additions and 0 deletions
Showing only changes of commit ccbc023085 - Show all commits

View file

@ -113,4 +113,8 @@ public class Config {
public String getDiscordBoatsToken() {
return config.getJSONObject("Tokens").getString("DiscordBoats");
}
public String getYetAnotherBotListToken() {
return config.getJSONObject("Tokens").getString("YetAnotherBotList");
}
}

View file

@ -23,6 +23,7 @@ public class BotList {
private static String DiscordBotList = "https://discordbotlist.com/api/bots/637002314162372639/stats";
private static String DiscordBestBots = "https://discordsbestbots.xyz/api/bots/637002314162372639/stats";
private static String DiscordBoats = "https://discord.boats/api/bot/637002314162372639";
private static String YetAnotherBotList = "https://yabl.xyz/api/bot/637002314162372639/stats";
private Config config;
@ -34,6 +35,7 @@ public class BotList {
if (Files.notExists(Paths.get("./DEBUG"))) {
JSONObject json = new JSONObject();
json.put("server_count", Hadder.shardManager.getGuilds().size());
json.put("guildCount", Hadder.shardManager.getGuilds().size());
json.put("guilds", Hadder.shardManager.getGuilds().size());
json.put("users", Hadder.shardManager.getUsers().size());
@ -113,6 +115,21 @@ public class BotList {
} catch (IOException e) {
e.printStackTrace();
}
// Yet Another Bot List
Request yetanotherbotlist = new Request.Builder()
.url(YetAnotherBotList)
.post(body)
.addHeader("Authorization", config.getYetAnotherBotListToken())
.build();
try {
new OkHttpClient().newCall(yetanotherbotlist).execute().close();
System.out.println("Successfully postes count to Yet Another Bot List!");
} catch (IOException e) {
e.printStackTrace();
}
}
}