suyamiko-api

1.0.2 • Public • Published

NPM version NPM downloads Dependencies Paypal

Suyamiko-API

A simple wrapper around the Suyamiko Bot's API

A bridge to the world of moe (and other services provided by the suya.moe API)!

npm install suyamiko-api@1.0.1

https://api.suya.moe/cdn.gif?awoo=SGs0VlhIbVBiZQ.gif

awoo

The Suyamiko API is private, thus this package is not meant to be used by people who do not have prior authorization to use it.

Easy setup

const ApiClient = require('suyamiko-api');
const token = 'API TOKEN HERE';

const client = new ApiClient(token); // To set a new token: client.set_token('new token')

client.neko().then(console.log)
const another_url = await client.neko();

Endpoints is defined as:

const endpoints = [
  'neko', 'awoo', 'bang', 'bite', 'blush',
  'cat', 'cry', 'cuddle', 'dance', 'hug',
  'kiss', 'lewd', 'lick', 'lizard', 'neko',
  'nom', 'nuzzle', 'pat', 'poke', 'pout',
  'shrug', 'slap', 'sleepy', 'tickle'
];

Any of these are methods of the client:

client.cuddle(), client.slap(), etc

All endpoints return promises that resolve to a url. As with all promises, append a .catch to catch errors if not using await.

try {
  const url = await client.pout();
} catch (err) {
  console.error(err);
}

Request handling errors (hopefully) contain three properties: error, code, and message

• error contains an Error object with a stack trace error.stack

• code contains the status code of the request

• message contains the body returned by the server. If possible, it will be a parsed JSON.

Common errors:

Error code 401, message { error: 'Invalid Authorization Received for protected endpoint' }

• Problem: The key you provided was invalid. • Solution: Contact the owner of the API on discord via Kazuko#0180

Other errors: Open an issue on github or contact me on discord at William Zhou#0001 via https://discord.gg/jj5FzF7

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i suyamiko-api

    Weekly Downloads

    0

    Version

    1.0.2

    License

    UNLICENSED

    Unpacked Size

    14.5 kB

    Total Files

    11

    Last publish

    Collaborators

    • wzhouwzhou
    • kannagikazuko