Skip to content

Nekos-life/Nekos4J

Repository files navigation

Nekos4J

Download

Java API for Nekos.Life API v2

Adding to your project

Maven:

<dependency>
  <groupId>pw.aru.api</groupId>
  <artifactId>nekos4j</artifactId>
  <version>VERSION</version>
  <type>pom</type>
</dependency>

Gradle:

compile 'pw.aru.api:nekos4j:VERSION'

You can find the latest version here

Usage

To get started, you need an instance of Nekos4J

Nekos4J api = new Nekos4J.Builder().build();

Images

ImageProvider imageProvider = api.getImageProvider();

//blocking call
Image image = imageProvider.getRandomImage("pat").execute();
try {
    //futures are supported too
    byte[] bytes = image.download().submit().get();
    System.out.println("Downloaded image " + image.getId() + ", with " + bytes.length + " bytes");
} catch(InterruptedException|ExecutionException e) {
    e.printStackTrace();
}

Text

TextProvider textProvider = api.getTextProvider();

textProvider.owoifyText("hello, how are you?").async(text->{
    System.out.println("OwOified Text: " + text);
});

textProvider.getRandom8Ball().async(data->{
    System.out.println("8ball: " + data.getResponse());
});

Additional info can be found on the javadocs for the Nekos4J class and on the official Discord server.

Releases

No releases published

Packages

No packages published

Languages