1.2.2 • Published 8 months ago

starnime v1.2.2

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago
  • Anime Images: Get random gifs or pictures of anime characters suitable for roleplaying.
  • Easy-to-Use: Utilize the tool either manually or through pre-built functions for effortless API fetching.
  • Trivia: It is recommended to use this for discord bots; it is easy to maintain and can be stored as JSON.
  • Rule34: Fetch data from the Rule34 API with a pre-built function that is already typed and easy to use.
  • Iwara: Fetch Iwara.tv videos or images to download or get the information.
  • Danbooru: Similar to Rule34, but with additional features.
  • Discord: Interact with the Discord API with ease, including integration with Discord webhooks.
  • Error Handling: Equipped with a versatile error handling class that efficiently manages any encountered errors and can be easily extracted for further analysis.
$ npm install starnime@latest
$ npm install https://github.com/Stawa/Starnime

This is the pre-built function, so you don't have to import many classes. Also, the output is already being typed using the ApiResponse class. If you want to configure each parameter individually, you can use the parameters that are typed using the ParametersOptions class.

const { Starnime } = require('starnime');

const starnime = new Starnime({ skipMissingError: false });

async function example() {
    console.log(await starnime.neko({ totalAmount: 5 }));
};

example();
const { Starnime, Version, IconsRoutes, OutputType } = require('starnime');

const starnime = new Starnime({ skipMissingError: false }); // Return undefined instead of error if there's an error.

async function example() {
    console.log(await starnime.image(Version.V1, IconsRoutes.PLUS, OutputType.RANDOM, 2));
};

example();

Starnime already has an error class handler called StarError error class that can be handled easily and can also extract information such as the error name, error message, and error code.

const { Starnime } = require('starnime');

const starnime = new Starnime({ skipMissingError: false }); // Return an error instead of undefined if there's an error.

async function example() {
    try {
        console.log(await starnime.image('invalid_version', 'invalid_endpoint', 'invalid_type', 'invalid_total'));
    } catch(err) {
        console.log(err.name, err.code, err.message)
    }
};

example();

If you got an unexpected error, you can request an issue on our Github repository. If something is missing, you can use the Starnime.image function and then request a pull request if you want. Also, if you don't know how to use the extra features, you can check out our documentation!