Git Product home page Git Product logo

discordbotlist-stats's Introduction

Discord BotList Stats Build Status Development Release

Easy-to-use library for posting stats on most available Discord Bot list.

Warning: The Maven Central release is not up to date. Please use the JitPack release instead.

Currently Supported:

Core Module Javadocs Maven Central Release

The core module holds basic implementation and is necessary for discordbotlist-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 with Catnip Javadocs Maven Central Release

Adding the dependency to your project...

...when using Maven

<dependency>
  <groupId>de.kaleidox</groupId>
  <artifactId>discordbotslist-stats-catnip</artifactId>
  <version>0.1.0</version>
</dependency>

...when using Gradle

dependencies {
    implementation 'de.kaleidox:discordbotlist-stats-catnip:0.1.0'
}

Usage

With Catnip, using this library becomes easy-as-pie! You only need to do two additional steps:

  1. Build a BotListSettings object.
  2. Load the CatnipStatsExtension in Catnip.
Example code:
Catnip catnip = Catnip.catnip("token");

/* ... */

BotListSettings botListSettings = BotListSettings.builder()
        /* define a file from which tokens will be scanned */
        .tokenFile(new File("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 extension
catnip.loadExtension(new CatnipStatsExtension(botListSettings));

Using with Discord4J Javadocs Maven Central Release

Adding the dependency to your project...

...when using Maven

<dependency>
  <groupId>de.kaleidox</groupId>
  <artifactId>discordbotslist-stats-discord4j</artifactId>
  <version>0.1.3</version>
</dependency>

...when using Gradle

dependencies {
    implementation 'de.kaleidox:discordbotlist-stats-discord4j:0.1.3'
}

Using with Javacord Javadocs Maven Central Release

Adding the dependency to your project...

...when using Maven

<dependency>
  <groupId>de.kaleidox</groupId>
  <artifactId>discordbotslist-stats-javacord</artifactId>
  <version>0.1.3</version>
</dependency>

...when using Gradle

dependencies {
    implementation 'de.kaleidox:discordbotlist-stats-javacord:0.1.3'
}

Usage

You have two possible ways of using this library. In these examples, we will be using Javacord for demonstration purposes.

Creating a Single-Sharded stats connection

To create a single sharded stats connection, you must first define your Javacord DiscordApi object, and then pass that to the JavacordStatsClient constructor.

You will also need to create a BotListSettings 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.

DiscordApi api = new DiscordApiBuilder()
        .setToken(/* token */)
        .login()
        .join();

BotListSettings settings = BotListSettings.builder()
        /* define all tokens that you want to use */
        .setTop_gg_token(/* token */)
        .setDivinediscordbots_com_token(/* token */)
        .build();
StatsClient stats = new JavacordStatsClient(settings, API);

That's it already! The StatsClient object does the rest for you. In every library, it will register itself as a GuildJoin and GuildLeave listener, and update the stats everytime the bot joins or leaves a guild.

Using with JDA Javadocs Maven Central Release

Adding the dependency to your project...

...when using Maven

<dependency>
  <groupId>de.kaleidox</groupId>
  <artifactId>discordbotslist-stats-jda</artifactId>
  <version>0.1.3</version>
</dependency>

...when using Gradle

dependencies {
    implementation 'de.kaleidox:discordbotlist-stats-jda:0.1.3'
}

discordbotlist-stats's People

Contributors

burdoto avatar dependabot-preview[bot] avatar

Stargazers

 avatar  avatar

Watchers

 avatar

discordbotlist-stats's Issues

Update top.gg URLs

Current URLs will lead to 404s as soon as top.gg removes their proxy.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.