Skip to content
This repository has been archived by the owner on Sep 2, 2023. It is now read-only.
/ BotListHandler Public archive

a library which handles discord bot lists stats updating for you

Notifications You must be signed in to change notification settings

sebm253/BotListHandler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BotListHandler has been discontinued as of September 2nd, 2023. I lost interest in Java a long time ago and somewhat recently, in bot lists as well.

BotListHandler

This handler can be used in 3 ways:

  • standalone (updating the stats yourself)
  • using JDA
  • using Javacord

Getting the handler

Replace %VERSION_xyz% with the latest release tag:

  • version_core
  • version_jda
  • version_javacord

Modules

  • core: the core module of the handler, required and bundled with every module (however it's recommended to declare the dependency separately for independent updates)
  • jda: the jda module of the handler, use this if you intend to get the data from a JDA bot
  • javacord: the javacord module of the handler, use this if you intend to get the data from a Javacord bot

Gradle

repositories {
  mavenCentral()
}

dependencies {
  // required (bundled with every module, see the Modules section)
  implementation group: 'dev.mlnr', name: 'BotListHandler-core', version: '%VERSION_core%'
  
  // optional
  implementation group: 'dev.mlnr', name: 'BotListHandler-jda', version: '%VERSION_jda%'
  implementation group: 'dev.mlnr', name: 'BotListHandler-javacord', version: '%VERSION_javacord%'
}

Maven

<dependencies>
    <!--required (bundled with every module, see the Modules section)-->
    <dependency>
        <groupId>dev.mlnr</groupId>
        <artifactId>BotListHandler-core</artifactId>
        <version>%VERSION_core%</version>
    </dependency>
    <!--optional-->
    <dependency>
        <groupId>dev.mlnr</groupId>
        <artifactId>BotListHandler-jda</artifactId>
        <version>%VERSION_jda%</version>
    </dependency>
    <dependency>
        <groupId>dev.mlnr</groupId>
        <artifactId>BotListHandler-javacord</artifactId>
        <version>%VERSION_javacord%</version>
    </dependency>
</dependencies>

Initialization

Using the addBotList method:

BotListHandler botListHandler = new BLHBuilder().addBotList(BotList.TOP_GG, "top_gg_token")
  .addBotList(BotList.DSERVICES, "dservices_token")
  .build();

Using the constructor:

Map<BotList, String> botLists = new EnumMap<>(BotList.class);
botLists.put(BotList.DBL, "dbl_token");
botLists.put(BotList.DEL, "del_token");

BotListHandler botListHandler = new BLHBuilder(botLists).build();

Using the setBotLists method:

Map<BotList, String> botLists = new EnumMap<>(BotList.class);
botLists.put(BotList.DISCORDS, "discords_token");
botLists.put(BotList.DBOTS_GG, "dbots_gg_token");

BotListHandler botListHandler = new BLHBuilder().setBotLists(botLists).build();

You can store the BotListHandler instance to add bot lists or hotswap invalid tokens at runtime.

Implementation

There are 3 ways to use BotListHandler:

Standalone

botListHandler.updateAllStats(botId, serverCount);

Event based

// JDA
BLHJDAListener jdaListener = new BLHJDAListener(botListHandler);
JDA jda = JDABuilder.create("token", intents)
  .addEventListeners(jdaListener)
  .build();
  
jda.awaitReady(); // optional, but if you want to update the stats after a ReadyEvent, it's required

// Javacord
BLHJavacordListener javacordListener = new BLHJavacordListener(botListHandler);
new DiscordApiBuilder().setToken(token)
        .addListener(javacordListener)
        .login();

Automatic stats posting (recommended)

// JDA - supports sharding
JDA jda = JDABuilder.create("token", intents)
  .build();
  
jda.awaitReady(); // optional

BLHJDAUpdater jdaUpdater = new BLHJDAUpdater(jda);
BotListHandler botListHandler = new BLHBuilder(jdaUpdater, botLists)
  .setAutoPostDelay(10, TimeUnit.MINUTES).build();

// Javacord - supports sharding. async approach - call join() after login() to block
new DiscordApiBuilder().setToken(token)
        .login()
        .thenAccept(discordApi -> {
            BLHJavacordUpdater javacordUpdater = new BLHJavacordUpdater(discordApi);
            new BLHBuilder(javacordUpdater, botLists)
                    .setAutoPostDelay(3, TimeUnit.MINUTES).build();
        });

// your own updater
MyUpdater myUpdater = new MyUpdater(); // this class has to implement IBLHUpdater
BotListHandler botListHandler = new BLHBuilder(myUpdater, botLists)
  .setAutoPostDelay(1, TimeUnit.HOURS).build();

Your own updater for automatic stats posting

Creating your own updater for automatic stats posting is simple. All you have to do is to have your updater class implement IBLHUpdater and then provide values in the overriden methods.

Currently supported bot lists

botsondiscord.xyz

discord.bots.gg

discordbotlist.com

discordbots.co

discordextremelist.xyz

discords.com

discordservices.net

top.gg

Troubleshooting

Please visit the wiki for troubleshooting steps. If the wiki doesn't contain the problem you're having, open a new issue.

About

a library which handles discord bot lists stats updating for you

Resources

Stars

Watchers

Forks

Languages