Skip to content
/ Starnime Public

Advanced tool that delivers random anime images with extra features.

License

Notifications You must be signed in to change notification settings

Stawa/Starnime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Starnime

Advanced tool that delivers random anime images with extra features.

CodeFactor

Features

  • 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.

📦 Installation

There are two choices for installing: stable and the latest version. Here's how,

$ npm install starnime@latest
$ npm install https://github.com/Stawa/Starnime

🚀 Quickstart

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();

You can skip this one if you don't understand or don't want to use it manually to fetch our API.

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();

⚠️ Error Handler

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();

Help

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!

🔗 Links