Skip to content

BasketBandit/ddblAPI.java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ddblAPI.java

Java wrapper for the DivineDiscordBotList API.

Class Data

Methods

 .postStats(int serverCount);
 .postStats(int serverCount, int shardCount);
 .canPost();
 .getStats();
 .getVotes();
 .hasVoted(String userId);
 .hasVoted(String userId, int hours);

Usage

Setup

DivineAPI ddbl = new DivineAPI.Builder()
        .botId("botId")
        .token("token")
        .build();

Post

#1 - Post the total server count for your bot.

int serverCount = ...; // The server count for the bot.

if(canPost()) {
    ddbl.postStats(serverCount);
}

#2 - Post both the total server count and the shard count.

int serverCount = ...; // The server count for the bot.
int shards = ...; // The number of shards the bot has.

if(canPost()) {
    ddbl.postStats(serverCount, shards);
}

Get

Stats - Retrieve the stats stored about your bot, such as description and server count.

DivineBot bot = ddbl.getStats();

bot.getDescription(); // Long description of your bot.
bot.getStats().getServerCount() // Server count of your bot.

Votes - Retrieve a list of all of the votes for your bot.

List<Vote> votes = ddbl.getVotes();

votes.getSize(); // Number of votes.
votes.get(0).getUsername(); // Username of the user for vote index 0.

Voted #1 - Retrieves a boolean value of if a user has voted in the past 24 hours.

String userId = ...; // The ID of the user to check against. E.g. "215161101460045834"

boolean voted = ddbl.hasVoted(userId);

Voted #2 - Retrieves a boolean value of if a user has voted in the past x hours.

String userId = ...; // The ID of the user to check against. E.g. "215161101460045834"
int hours = ...; The number of hours in the past to check against. E.g. 6.

boolean voted = ddbl.hasVoted(userId, hours);

Download

Replace VERSION with the JitPack version number you can see above.

Gradle

repositories {
    maven { url 'https://jitpack.io' }
}
dependencies {
    implementation 'com.github.BasketBandit:ddblAPI.java:VERSION'
}

Maven

<repositories>
    <repository>
        <id>jitpack.io</id>
        <url>https://jitpack.io</url>
    </repository>
</repositories>
<dependency>
    <groupId>com.github.BasketBandit</groupId>
    <artifactId>ddblAPI.java</artifactId>
    <version>VERSION</version>
</dependency>

Dependencies

name version
SLF4J 2.0.0-alpha1
OkHttp 4.5.0
Gson 2.8.6

About

Java wrapper for the DivineDiscordBotList API

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages