1.5.1 • Published 4 years ago

tamako-api v1.5.1

Weekly downloads
27
License
Apache-2.0
Repository
github
Last release
4 years ago

Tamako-API

Quick Tamako API wrapper for beginners.

App Version Node License

Tamako-API

Features

  • Beginner friendly
  • Ideal for beginner Discord Bot creators
  • Easy to use

Quick Example

// Destructure the class from the library
const { TAMAKOAPI } = require("tamako-api");

// Note: Username, id, and secret are important, you should store them
// in an environment variable whenever possible and be kept private at all times

// Instantiate the class before you can use it
// Parameters are only required if you want to use the chatbot method
// You can get your own username, id, and secret here -> https://appcenter.theskyfallen.com/
// chatbot parameter is optional
const tamako = new TAMAKOAPI({
 svcid: process.env.TAMAKO_SERVICEID,
 prvid: process.env.TAMAKO_PROVISIONID,
 svcsecret: process.env.TAMAKO_SECRET,
 chatbot: {
   name: "The name for the bot",
   gender: "The assumed gender of the bot",
   prefix: "The prefix of your bot",
   dev: "The creator of your bot (naturally it is you)"
   }
});

// Using default values for options found in tamako.cboptions
tamako.chatbot('hello there', { user: '123456' }).then((response) => {
   console.log(response);
});

// Using own values without using the options found on tamako.cboptions
tamako.chatbot('hello there', {
   name: "The name for the bot",
   gender: "The assumed gender of the bot",
   user: "123456",
   prefix: "The prefix of your bot",
   dev: "The creator of your bot (naturally it is you)"
}).then(response => console.log(response));

// Fires whenever an error occurs
tamako.on("error", error => {
   console.log(error);
});

Authenticated Functions

chatbot(message, options)

Note: Requires authentication Returns message sent by the chatbot or undefined (if error occurs)

ParameterTypeDefaultOptionalDescription
messagestringnoneThe message you want the chatbot to reply with
options.namestringTamako✔️The name of the chatbot
options.genderstringfemale✔️The gender of the chatbot
options.userstringnoneUnique ID to tell users using the endpoint apart
options.prefixstringNot Set By Developer✔️It should be your bot's prefix
options.devstringBear#3437✔️Name Of the developer of the bot

Unauthenticated Functions

lyrics(name)

Returns lyrics of the song from the name | Parameter | Type | Default | Optional | Description | | - | - | - | :-: | - | | name | string | none | ❌ | The title of the song |

Example

const { TAMAKOAPI } = require('tamako-api');
const tamako = new TAMAKOAPI();

tamako.lyrics('In the End')
.then(res => {
const lyrics = res.lyrics;
const cover = res['album-art'];
const artist = res.artist;
const link = res.link

console.log(lyrics, cover, artist, link);
});

pokemon(name)

Returns an object containing information about the Pokemon | Parameter | Type | Default | Optional | Description | | - | - | - | :-: | - | | name | string | none | ❌ | The name of the pokemon |

Example

const { TAMAKOAPI } = require('tamako-api');
const tamako = new TAMAKOAPI();

tamako.pokemon('pikachu')
.then(res => console.log(res));

joke()

Returns a random joke

Example

const { TAMAKOAPI } = require('tamako-api');
const tamako = new TAMAKOAPI();

tamako.joke()
.then(joke => console.log(joke));

animalfact(name)

Returns a fact of the mentioned animal

name can be any of the following: | | | | | | | | | | | | | | - | - | - | - | - | - | - | - | - | - | - | - | | bird | bunny | cat | dog | fox | giraffe | kangaroo | koala | panda | racoon | whale | elephant |

Example

const { TAMAKOAPI } = require('tamako-api');
const tamako = new TAMAKOAPI();

tamako.animalfact('dog')
.then(res => console.log(res))

image(type)

Returns an image link

type can be any of the following: | | | | | | | | | | | | - | - | - | - | - | - | - | - | - | - | | bird | dog | cat | dog | fox | koala | panda | redpanda | tamako | mai |

Example

const { TAMAKOAPI } = require('tamako-api');
const tamako = new TAMAKOAPI();

tamako.image('dog')
.then(res => console.log(res))

roleplay(type)

Returns a gif image link

type can be any of the following: | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - | - |- | | baka | bite | blush | celebrate | cry | dance | disgust | eat | explode | feed | fistbump | happy | highfive | holdhands | hug | inhale | kill | kiss | lick | midfing | pat | poke | punch | slap | sleep | smug | tickle | wave | wink |

Example

const { TAMAKOAPI } = require('tamako-api');
const tamako = new TAMAKOAPI();

tamako.roleplay('hug')
.then(res => console.log(res))

Events

error - Returns an error if an error is returned from the API. Example

tamako.on('error', (err) => {
  console.log('Encountered an error:' + err.message)
})

Links

1.5.1

4 years ago

1.5.0

4 years ago

1.4.0

4 years ago

1.3.5

4 years ago

1.3.3

4 years ago

1.3.2

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.5

4 years ago

1.2.0

4 years ago

1.1.0

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago