Greg dev #100

Merged
greg6775 merged 3 commits from greg-dev into master 2019-11-25 08:55:37 +01:00
3 changed files with 27 additions and 0 deletions

View file

@ -6,3 +6,4 @@ The Hadder Discord bot is a multi-purpose Discord Bot.
[![Build Status](https://github.com/BigBotNetwork/Hadder/workflows/Hadder/badge.svg)](https://github.com/BigBotNetwork/Hadder)
<a href="https://discordextremelist.xyz/bots/Hadder"><img src="https://discordextremelist.xyz/api/bot/637002314162372639/widget"/></a>
[![Discord Bots](https://top.gg/api/widget/637002314162372639.svg)](https://top.gg/bot/637002314162372639)

View file

@ -59,6 +59,10 @@ public class Config {
.key("DiscordBotList").value(null)
.key("DiscordBestBots").value(null)
.key("DiscordBoats").value(null)
.key("YetAnotherBotList").value(null)
.value("DiscordExtremeList").value(null)
.value("DiscordBotReviews").value(null)
.value("DiscordBots").value(null)
.endObject().endObject().toString();
}
@ -129,4 +133,8 @@ public class Config {
public String getDiscordBotReviewsToken() {
return config.getJSONObject("Tokens").getString("DiscordBotReviews");
}
public String getDiscordBotsToken() {
return config.getJSONObject("Tokens").getString("DiscordBots");
}
}

View file

@ -26,6 +26,7 @@ public class BotList {
private static String YetAnotherBotList = "https://yabl.xyz/api/bot/637002314162372639/stats";
private static String DiscordExtremeList = "https://discordextremelist.xyz/api/bot/637002314162372639";
private static String DiscordBotReviews = "https://discordbotreviews.xyz/api/bot/637002314162372639/stats";
private static String DiscordBots = "https://top.gg/api/bots/637002314162372639/stats";
private Config config;
@ -40,6 +41,8 @@ public class BotList {
json.put("guildCount", Hadder.shardManager.getGuilds().size());
json.put("guilds", Hadder.shardManager.getGuilds().size());
json.put("users", Hadder.shardManager.getUsers().size());
json.put("shard_count", Hadder.shardManager.getShards().size());
json.put("shards", Hadder.shardManager.getShards());
RequestBody body = RequestBody.create(MediaType.parse("application/json"), json.toString());
@ -162,6 +165,21 @@ public class BotList {
} catch (IOException e) {
e.printStackTrace();
}
// Discord Bots
Request discordbots = new Request.Builder()
.url(DiscordBots)
.post(body)
.addHeader("Authorization", config.getDiscordBotsToken())
.build();
try {
new OkHttpClient().newCall(discordbots).execute().close();
System.out.println("Successfully posted count to Discord Bots!");
} catch (IOException e) {
e.printStackTrace();
}
}
}