Skip to content
This repository has been archived by the owner on Sep 27, 2022. It is now read-only.
Matt Malec edited this page Nov 17, 2018 · 2 revisions

KSoft4J

Java wrapper for the KSoft API

Examples:

Getting a random meme:

public class Main {
    public static void main(String[] args) {
        KSoftAPI api = new KSoftAPI("token");
        Reddit reddit = api.getRedditImage(ImageType.RANDOM_MEME).execute();
        System.out.printf("Title: %s\nURL: %s\nSubreddit: %s\nAuthor: %s", reddit.getTitle(), reddit.getSourceUrl(), reddit.getSubreddit(), reddit.getAuthor());
    }
}

Getting a random meme from a custom subreddit:

public class Main {
    public static void main(String[] args) {
        KSoftAPI api = new KSoftAPI("token");
        Reddit reddit = api.getRedditImage(ImageType.RANDOM_REDDIT).setSubreddit("thathappened").execute();
        System.out.printf("Title: %s\nURL: %s\nSubreddit: %s\nAuthor: %s", reddit.getTitle(), reddit.getSourceUrl(), reddit.getSubreddit(), reddit.getAuthor());
    }
}

Getting a ban:

public class Main {
    public static void main(String[] args) {
        KSoftAPI api = new KSoftAPI("token");
        Ban ban = api.getBan().setUserId("1234").execute();
        System.out.printf("Ban: %s\nModerator: %s\nReason: %s\nProof: %s", ban.getEffectiveName(), ban.getModId(), ban.getReason(), ban.getProof());
    }
}

Reporting a user:

public class Main {
    public static void main(String[] args) {
        KSoftAPI api = new KSoftAPI("token");
        BanAction ban = api.getBan();
        AddBan addBan = ban.addBan();
        addBan
        .setUsername("username")
        .setDiscriminator("1234")
        .setUserId("4321").setReason("Being mean!")
        .setProof("google.com")
        .set().execute();
    }
}

Download

Latest Stable Version: Bintray Release
Latest Version: Download

Be sure to replace the VERSION key below with the one of the versions shown above!

Maven

<dependency>
    <groupId>net.explodingbush.KSoft4J</groupId>
    <artifactId>KSoft4J</artifactId>
    <version>VERSION</version>
</dependency>
<repository>
    <id>jcenter</id>
    <name>jcenter-bintray</name>
    <url>http://jcenter.bintray.com</url>
</repository>

Gradle

dependencies {
    compile 'net.explodingbush.KSoft4J:KSoft4J:VERSION'
}

repositories {
    jcenter()
}

The builds are distributed using JCenter through Bintray KSoft4J JCenter Bintray

Getting Help

For general troubleshooting, you can view some troubleshooting steps in the examples (this will be soon moved to the wiki)
If you need help, or just want to talk with the KSoft.Si or other devs, you can join the KSoft.Si Discord server

Documentation

The docs will have everything you need to know in order to use the wrapper.

KSoft4J Docs can be found here. It should be reletively easy to understand. If you have any questions regarding the documentation, please don't hesitate to contact me on Discord.

Contributing to KSoft4J

If you want to contribute to KSoft4J, make sure to base your branch off of our development branch (when we make one) and create your PR into that same branch.

It is recommended to get in touch with the devs before opening Pull Requests (either through an issue or on Discord).

Dependencies

This project requires Java 8.
For other dependencies, see README

Clone this wiki locally