- Notifications
You must be signed in to change notification settings - Fork0
Library for posting stats to most available Discord Bot Lists!
License
burdoto/discordbotlist-stats
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Easy-to-use library for posting stats on most available Discord Bot list.
The core module holds basic implementation and is necessary fordiscordbotlist-stats
to work properly.
The core module is the only dependency of each submodule, so you can just simply depend on the module that you need for the library you are using.All other dependencies, like the REST-Client, or a JSON library are used from the respective library. Why depend on them if they are already there?
Using withCatnip

<dependency> <groupId>de.kaleidox</groupId> <artifactId>discordbotslist-stats-catnip</artifactId> <version>0.1.0</version></dependency>
dependencies { implementation'de.kaleidox:discordbotlist-stats-catnip:0.1.0'}
With Catnip, using this library becomes easy-as-pie!You only need to do two additional steps:
- Build a
BotListSettings
object. - Load the
CatnipStatsExtension
in Catnip.
Catnipcatnip =Catnip.catnip("token");/* ... */BotListSettingsbotListSettings =BotListSettings.builder()/* define a file from which tokens will be scanned */ .tokenFile(newFile("list_tokens.properties"))/* define a Supplier<Boolean> to tell the library when updating should be disabled in this case, we check for the OS using another class */ .postStatsTester(OSValidator::isUnix) .build();// load the extensioncatnip.loadExtension(newCatnipStatsExtension(botListSettings));
Using withDiscord4J

<dependency> <groupId>de.kaleidox</groupId> <artifactId>discordbotslist-stats-discord4j</artifactId> <version>0.1.3</version></dependency>
dependencies { implementation'de.kaleidox:discordbotlist-stats-discord4j:0.1.3'}
Using withJavacord

<dependency> <groupId>de.kaleidox</groupId> <artifactId>discordbotslist-stats-javacord</artifactId> <version>0.1.3</version></dependency>
dependencies { implementation'de.kaleidox:discordbotlist-stats-javacord:0.1.3'}
You have two possible ways of using this library.In these examples, we will be using Javacord for demonstration purposes.
To create a single sharded stats connection, you must first define your JavacordDiscordApi
object, and then pass that to theJavacordStatsClient
constructor.
You will also need to create aBotListSettings
object, which will serve as your token carrier.This object can be built using the included builder structure.If you do not set a token for a bot list service in the builder, no stats will be posted to that service.
DiscordApiapi =newDiscordApiBuilder() .setToken(/* token */) .login() .join();BotListSettingssettings =BotListSettings.builder()/* define all tokens that you want to use */ .setTop_gg_token(/* token */) .setDivinediscordbots_com_token(/* token */) .build();StatsClientstats =newJavacordStatsClient(settings,API);
That's it already! TheStatsClient
object does the rest for you.In every library, it will register itself as aGuildJoin
andGuildLeave
listener,and update the stats everytime the bot joins or leaves a guild.
Using withJDA

<dependency> <groupId>de.kaleidox</groupId> <artifactId>discordbotslist-stats-jda</artifactId> <version>0.1.3</version></dependency>
dependencies { implementation'de.kaleidox:discordbotlist-stats-jda:0.1.3'}
About
Library for posting stats to most available Discord Bot Lists!