A Java wrapper for the top.gg API
First, build a DiscordBotListAPI object.
DiscordBotListAPI api = new DiscordBotListAPI.Builder()
.token("token")
.botId("botId")
.build();
DBL provides three ways to post your bots stats.
#1 Posts the server count for the whole bot.
int serverCount = ...; // the total amount of servers across all shards
api.setStats(serverCount);
#2 Posts the server count for an individual shard.
int shardId = ...; // the id of this shard
int shardCount = ...; // the amount of shards
int serverCount = ...; // the server count of this shard
api.setStats(shardId, shardCount, serverCount);
#3 Posts the server counts for every shard in one request.
List<Integer> shardServerCounts = ...; // a list of all the shards' server counts
api.setStats(shardServerCounts);
String userId = ...; // ID of the user you're checking
api.hasVoted(userId).whenComplete((hasVoted, e) -> {
if(hasVoted)
System.out.println("This person has voted!");
else
System.out.println("This person has not voted!");
});
api.getVotingMultiplier().whenComplete((multiplier, e) -> {
if(multiplier.isWeekend())
System.out.println("It's the weekend, so votes are worth 2x!");
else
System.out.println("It's not the weekend :pensive:");
});
Replace VERSION
with the latest version or commit hash. The latest version can be found under releases.
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.github.Monmcgt</groupId>
<artifactId>java-sdk</artifactId>
<version>master-SNAPSHOT</version>
</dependency>
</dependencies>
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
compile 'com.github.Monmcgt:java-sdk:master-SNAPSHOT'
}