★ wanayoo — archive 1999 https://github.com/DiscordBotList/DBL-Java-LibraryNouvelle recherche | Portail wanayoo
Skip to content
Please note that GitHub no longer supports your web browser.

We recommend upgrading to the latest Google Chrome or Firefox.

Learn more
An API wrapper for https://discordbots.org/api/docs that works in Java
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
gradle/wrapper Updated gradle wrapper (again? apparently) Jul 14, 2018
src/main/java/org/discordbots/api/client try/catch error message parsing in case DBL isn't sending the error m… Aug 20, 2018
LICENSE Create LICENSE Jan 29, 2018
README.md Had a couple params backwards Aug 19, 2018
build.gradle Added OffsetDateTime type adapter Jul 20, 2018
gradlew Setup basic gradle dependencies Jan 29, 2018
gradlew.bat

README.md

DBL Java Library

A Java wrapper for the discordbots.org API

Usage

First, build a DiscordBotListAPI object.

DiscordBotListAPI api = new DiscordBotListAPI.Builder()
	.token("token")
	.botId("botId")
	.build();

Posting stats

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);

Checking votes

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!");
});

Getting voting multiplier

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:");
});

Download

Release

Replace VERSION with the latest version or commit hash. The latest version can be found under releases.

Maven

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>org.discordbots</groupId>
        <artifactId>DBL-Java-Library</artifactId>
        <version>VERSION</version>
    </dependency>
</dependencies>

Gradle

repositories {
    maven { url 'https://jitpack.io' }
}
dependencies {
    compile 'org.discordbots:DBL-Java-Library:VERSION'
}
You can’t perform that action at this time.